Commit Graph

1970 Commits

Author SHA1 Message Date
Derek Collison
e4a006dbfc Merge pull request #971 from nats-io/leaf_limits
Leafnode account based connections limits
2019-04-25 16:25:54 -07:00
Derek Collison
17839518de Updates based on PR feedback
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-25 15:47:35 -07:00
Derek Collison
2ec3eaeaa9 Leafnode account based connections limits
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-25 14:40:59 -07:00
Derek Collison
f5e574ce33 Merge pull request #968 from nats-io/account_map
Make account lookup faster with sync.Map
2019-04-23 19:34:24 -07:00
Derek Collison
26929d3e4b Fixed description
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-23 18:56:27 -07:00
Derek Collison
f320f318b7 Fixed merge conflict
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-23 17:28:42 -07:00
Derek Collison
bfe83aff81 Make account lookup faster with sync.Map
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-23 17:13:23 -07:00
Ivan Kozlovic
ba7b621951 Merge pull request #965 from nats-io/gw_req_reply_v2
Gateways: Fix race for request reply
2019-04-23 17:30:18 -06:00
Ivan Kozlovic
9f497a6cd4 Revert to use Sublist but use the SublistNoCache version.
Remove sub from rsubs sublist when user UNSUBs.

Fix bench test that was not actually creating a SUB per request
in the Benchmark_Gateways_Requests_CreateOneSubForEach test.
Also UNSUBs older SUBs after a certain threshold to simulate
actual req/reply.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-23 14:13:13 -06:00
Ivan Kozlovic
41436fb787 Updates based on comments
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-22 20:00:21 -06:00
Ivan Kozlovic
bb4e8ae0f9 Gateways: Fix race for request reply
This addresses the following race:
- client connection creates a subscription on a reply subject
- client connection sends a request
- server sends the subscription to inbound gateway
- server sends the message to outbound gateway (those may be
  to different servers)
- receiving server sends to sub interested in request subject
- app sends reply
- its server then check for interest on the reply's subject

In interestOnly mode, there is a possibility that this server
has not received the interest on the reply subject yet and would
then drop the reply.

This PR detects above scenario and will prefix the reply subject
to identify the origin cluster if it is detected that the last
subscription from the sending connection was created less than
a second ago.
Once the destination has this prefix, the destination cluster
will always send back that message to origin cluster even if
there is no registered interest.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-22 20:00:21 -06:00
Derek Collison
2a7b2a9578 Merge pull request #967 from nats-io/nocache
Allow sublist cache to be disabled
2019-04-22 18:42:52 -07:00
Derek Collison
4ccfef004c Update for Ivan's suggestion on just checking s.cache since we have read lock
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-22 18:35:24 -07:00
Derek Collison
da2dab92d1 Allow disabling of shared cache with new constuctor. Also share empty results.
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-22 17:53:14 -07:00
Derek Collison
4ff42224c1 Merge pull request #966 from wallyqs/tls-auth-sans
Support SANs in TLS cert to define user permissions
2019-04-19 09:50:31 -07:00
Waldemar Quevedo
c3ee84a543 Support using SANs present in TLS cert for auth.
Also try multiple email and SANs found in cert until one valid
otherwise, default to the subject in the cert.

```
authorization {
  users [
    { user = "app.nats.dev", permissions = {
	publish {
	  allow = ["sandbox.>"]
	}
	subscribe {
	  allow = ["sandbox.>"]
	}
      }
    }
  ]
}
```

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-04-20 00:59:45 +09:00
Alberto Ricart
84a7e289b0 Added support for account signing keys. (#962)
* Added support for account signing keys. When account signing keys change
the validity of the client JWT and token imports need to be checked as well
as it is possible for the signing key used to sign the user or import
token to have been removed from the source account.
2019-04-18 19:08:26 -05:00
Ivan Kozlovic
bc11c1c284 Merge pull request #963 from nats-io/start_go_routine_lead_node
Fixed invocations of startGoRoutine (continued)
2019-04-18 11:23:31 -06:00
Ivan Kozlovic
ac49f715c4 Fixed invocations of startGoRoutine (continued)
The leafnode start of go routines for readloop and writeloop were
missing from PR #961

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-18 10:31:23 -06:00
Ivan Kozlovic
f17c5142dd Merge pull request #961 from nats-io/fix_start_go_routine_calls
Fixed invocations of startGoRoutine
2019-04-18 09:59:39 -06:00
Ivan Kozlovic
bf07862140 Fixed invocations of startGoRoutine
Resolves #960

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-18 09:51:56 -06:00
Derek Collison
b1d0ec10c6 Merge pull request #959 from nats-io/add_leafnode_test
Test for leafnodes, service imports and clusters
2019-04-17 15:13:15 -07:00
Ivan Kozlovic
fbf84aca9b Merge pull request #958 from nats-io/reduce_gw_init_mem
Reduce startup memory for gateways
2019-04-17 15:38:32 -06:00
Derek Collison
bfef3bd5a6 Fix for service import processing across routes for leaf nodes
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-17 14:37:09 -07:00
Ivan Kozlovic
d8098c134b Reduce startup memory for gateways
Similar to #956 but for gateways code.
Also fixing route test TestLargeClusterMem.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-17 15:18:46 -06:00
Ivan Kozlovic
8f35c6451f Merge pull request #957 from nats-io/fix_955
Fixed panic when server needs to send message to more than 8 routes
2019-04-17 13:40:46 -06:00
Ivan Kozlovic
288f00ff81 Fixed panic when server needs to send message to more than 8 routes
Resolves #955

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-17 13:02:41 -06:00
Derek Collison
0c8bf0ee8b Merge pull request #956 from nats-io/mem
Reduce startup memory for cluster
2019-04-17 11:21:50 -07:00
Derek Collison
f1d06d6c5b Reduce startup memory for cluster
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-17 11:05:29 -07:00
Ivan Kozlovic
bda267ec2c Add LeafNode import/export test with routes
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-16 19:26:28 -06:00
Derek Collison
a4af582dfb Merge pull request #949 from nats-io/gw_doc
Gateways: adding documentation in README [ci skip]
2019-04-15 16:56:37 -05:00
Ivan Kozlovic
756414d833 Gateways: adding documentation in README [ci skip]
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-15 15:39:59 -06:00
Derek Collison
e2ee8127e6 Merge pull request #948 from nats-io/fix_readme_typo
[FIXED] small typo in README [ci skip]
2019-04-15 12:30:10 -05:00
Ivan Kozlovic
6eb06ea7b3 [FIXED] small typo in README [ci skip]
Resolves #947

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-15 11:24:04 -06:00
Ivan Kozlovic
1777e2d1e2 Merge pull request #943 from nats-io/add_tlsconfig_server_name_test
Added test gateway tlsConfig.ServerName
2019-04-15 11:22:09 -06:00
Ivan Kozlovic
4ea96337ed Added test gateway tlsConfig.ServerName
Checks that if not provided server fails to connect to remote
gateway. Once set to expected hostname ("localhost"), connection
works.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-12 11:21:57 -06:00
Ivan Kozlovic
172eca6110 Merge pull request #922 from danielsdeleo/dan/allow-explicit-server-name-in-gateway
Allow explicit server name in tls.Config
2019-04-12 11:20:55 -06:00
Derek Collison
a67fd1bc1a Merge pull request #938 from nats-io/gomod
Update to gomod with vendor directory, update vendored pkgs
2019-04-09 18:04:02 -07:00
Derek Collison
0f98b1506f Update to gomod with vendor directory, update vendored pkgs
Signed-off-by: Derek Collison <derek@nats.io>
2019-04-09 17:41:57 -07:00
Ivan Kozlovic
064b3441cc Merge pull request #937 from nats-io/add_warning_if_cluster_insecure
Add a warning if cluster's insecure setting is enabled
2019-04-09 18:18:31 -06:00
Ivan Kozlovic
4dd1b26cc5 Add a warning if cluster's insecure setting is enabled
For cluster, we allow to skip hostname verification from certificate.
We now print a warning when this option is enabled, both on startup
or if the property is enabled on config reload.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-09 17:37:53 -06:00
Ivan Kozlovic
58b21e392c Merge pull request #935 from nats-io/fix-mkpasswd
[FIXED] mkpasswd utility on Windows
2019-04-09 17:24:10 -06:00
Ivan Kozlovic
031267dfd6 Merge pull request #936 from nats-io/leafnode_get_random_ip
LeafNode: do hostname resolution and get random one from result
2019-04-09 17:07:15 -06:00
Colin Sullivan
44fc27f1d0 Fix mkpasswd on windows
Signed-off-by: Colin Sullivan <colin@synadia.com>
2019-04-09 16:41:37 -06:00
Ivan Kozlovic
515ca5e70f LeafNode: do hostname resolution and get random one from result
This is similar to what we do with Gateways.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-09 16:33:19 -06:00
Ivan Kozlovic
98161722dc Merge pull request #930 from nats-io/route_send_subs_go_routine_threshold
Conditional send of routed subs from a go routine
2019-04-08 14:03:41 -06:00
Ivan Kozlovic
a6aeed3a6b Move unlock/gosched/lock in flushOutbound
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-08 13:57:23 -06:00
Ivan Kozlovic
c191eadc41 Merge pull request #932 from nats-io/leafnode_advertise
LeafNode: support for advertise
2019-04-08 11:29:51 -06:00
Ivan Kozlovic
6b1918efb4 LeafNode: support for advertise
A server that creates a LeafNode connection to a remote cluster
will now be notified of all possible LeafNode URLs in that cluster.
The list is updated when nodes in the cluster come and go.

Also support for advertise address, similar to cluster, gateway, etc..

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-08 10:54:39 -06:00
Ivan Kozlovic
2a86112a30 Conditional send of routed subs from a go routine
When a route is established, it is possible that each server sends
its list of subscriptions to each other at the same time. Doing
it in place from the readLoop could then cause problems because
each side could reach a point where the outbound socket buffer
is full and no one is dequeuing data (since readLoop is doing
the send of the subs list).
We changed sending this list from a go routine. However, for small
number of subscriptions, it is not required and was causing some
of the tests to fail because of timing issues.

We will now send in place if the estimated size of all protocols
is below a give threshold (1MB).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-03-26 17:21:33 -06:00