Commit Graph

1181 Commits

Author SHA1 Message Date
Ivan Kozlovic
7c59ce3dba [ADDED] Reject clients connecting to route's listen port
This happens sometimes, and the latest occurence was today:
https://github.com/nats-io/java-nats/issues/96

When it happens, there is no error but subscribers would not receive
anything, etc...

This PR uses the fact that clients set the field Lang in the CONNECT
protocol that ROUTEs do not. I have checked that all Apcera supported
clients do set Lang in the CONNECT protocol.
If we plan to add Lang for routes, we need to find another field or
use a new one, in which case that would work only for new clients
(that would need to be updated).

With this change, when the server accepts a connection on the route
port and detects that this protocol field is present, it now closes
the client connection.

The nice thing is that newer clients, when incorrectly connecting
to the route port, get from the route's INFO the list of client URLs,
which means that on the initial connect error, they are able to
subsequently connect to the proper client port, so it is transparent
to the user (which may or may not be a good thing). However, it is not
guaranteed because if the client is not setting NoRandomize to true,
the client URL is added but the array shuffled, so it is possible that
the client library does not find the correct port in the connect loop.
2017-01-24 19:46:46 -07:00
Derek Collison
0d45f49d90 Merge pull request #423 from nats-io/fix_staticcheck_errors
Fixed errors found by staticcheck
2017-01-24 18:44:20 -08:00
Ivan Kozlovic
27bfed541c Fixed errors found by staticcheck
Staticcheck has probably been updated and is finding new errors.
They have been fixed.

Also, moved the run of staticcheck before running the test suite,
so if it fails, it fails sooner ;-).
2017-01-24 19:34:17 -07:00
Derek Collison
63d6ef9546 Merge pull request #421 from nats-io/make_write_deadline_configurable
[ADDED] Make Write deadline configurable
2017-01-18 21:40:30 -07:00
Ivan Kozlovic
95d0152449 [ADDED] Make Write deadline configurable
We use a hardcoded value of 2 seconds for Write deadline when
writing data to client's socket.
This PR makes that value configurable.

Question is should we push the setting down to the client's object
to avoid indirection such as client.srv.opts.WriteDeadline?
2017-01-18 20:33:44 -07:00
Derek Collison
bfc521a244 Merge pull request #419 from nats-io/remove_max_pending_size
Removed last references to max_pending_size [ci skip]
2017-01-18 14:01:47 -08:00
Ivan Kozlovic
f1c513d7bf Removed last references to max_pending_size [ci skip] 2017-01-18 14:38:34 -07:00
Derek Collison
2c4ffbf7a1 Merge pull request #418 from nats-io/update-vendoring
Add golang.org/x/sys/windows to vendored files
2017-01-17 12:52:39 -08:00
Colin Sullivan
f5ce5d5172 Add golang.org/x/sys/windows to the vendored files 2017-01-17 11:40:25 -07:00
Derek Collison
e402ddda6f Merge pull request #417 from nats-io/win-container-test-fixes
Unit Test updates for a windows container environment.
2017-01-09 09:57:50 -08:00
Colin Sullivan
6e9e491c79 Updates for running in a windows container environment.
* Fixes unit tests running in windows containers with the default configuration.
2017-01-09 10:07:24 -07:00
Derek Collison
85a3032b4d Merge pull request #416 from nats-io/longer-test-client-timeout
Increase the internal test client dial timeout
2017-01-07 07:59:30 -08:00
Colin Sullivan
31dc3a7e11 Increase the client dial timeout.
* Windows and stressed machines require more time to connect; this was causing flappers.
2017-01-06 15:35:41 -07:00
Derek Collison
c275ec7185 Merge pull request #415 from nats-io/tls-add-chacha-default
Add the ChaCha20 ciphers to the default cipher list.
2017-01-05 15:27:52 -08:00
Colin Sullivan
c9a28b9fc0 Reorder based on comments. 2017-01-05 16:13:44 -07:00
Colin Sullivan
57785c55fb Bump ChaCha ciphers in preferences 2017-01-05 16:02:04 -07:00
Colin Sullivan
62693855e8 Add ChaCha20 ciphers to the default cipher list. 2017-01-05 11:30:16 -07:00
Derek Collison
c6e8014ed0 Merge pull request #412 from nats-io/tls-curve-pref
Add curve preference option to configuration files
2017-01-04 09:03:58 -08:00
Colin Sullivan
afceb6ef1b Merge branch 'master' into tls-curve-pref 2017-01-04 09:31:35 -07:00
Colin Sullivan
c692a2b954 Add golang version 1.8beta2 2017-01-04 09:28:39 -07:00
Derek Collison
bc3afada93 Merge pull request #411 from nats-io/update_travis
Change coverage/cross compile trigger for travis.yml
2017-01-04 05:55:15 -08:00
Colin Sullivan
9312ec21db Update cipher suites and curve preferences for go version 1.8 2016-12-30 14:24:58 -07:00
Colin Sullivan
72e3a28315 Merge branch 'master' into tls-curve-pref 2016-12-30 10:27:47 -07:00
Derek Collison
148446d970 Merge pull request #413 from nats-io/windows-event-log
Implement windows event logging
2016-12-30 07:56:08 -08:00
Colin Sullivan
1df5af0491 Implement windows event logging 2016-12-29 13:53:58 -07:00
Colin Sullivan
b133cda3cd Add curve preference option to configuration files.
* Add a preference to specify and order the curve preferences
* Add details tls help
* Deprecate old 1.4 cipher suite code
2016-12-27 15:41:48 -07:00
Ivan Kozlovic
7964a8125f Change coverage/cross compile trigger for travis.yml
Doing code coverage/cross compile for a single Go release. As of now,
if we were to introduce Go 1.8 in the matrix, we would do code
coverage (which may be ok) and create release (which would not be
ok) for 2 Go releases since were were using >= comparison.
This change ensures that we do for only 1.7.x for now.
2016-12-27 13:28:36 -07:00
Ivan Kozlovic
bc5f864bcc Merge pull request #409 from nats-io/implicit_route_retries
[ADDED] Configure number of connect retries for implicit routes
2016-12-22 15:21:45 -07:00
Ivan Kozlovic
d3555053d0 Change option/parameter name 2016-12-22 14:59:27 -07:00
Ivan Kozlovic
ad1804c6e6 Merge pull request #385 from orus-io/clientauth-tls
Add TLS infos to ClientAuth interface
2016-12-22 12:49:12 -07:00
Christophe de Vienne
696296408c Comment GetTLSConnectionState() 2016-12-22 17:42:43 +01:00
Christophe de Vienne
872c9e0c39 Test GetTLSConnectionState
Run GetTLSConnectionState on a non-tls connection (in a dedicated test)
and a tls connection.
Because initializing the TLS connection in the tests is non-trivial,

I hijacked the TestTLSCloseClientConnection test.
2016-12-21 10:42:50 +01:00
Christophe de Vienne
f94983a9a4 Add TLS infos to ClientAuth interface
It makes it possible to implement a Auth that uses client TLS certificates
to identify them.
2016-12-21 10:31:22 +01:00
Ivan Kozlovic
8e68e0cf80 Add code coverage for cluster's config file parameters 2016-12-20 19:04:59 -07:00
Ivan Kozlovic
a8dfaeae3d [ADDED] Ability to configure number of connect retries for implicit routes
When a server is told to connect to a server (with auto-discovery),
it tries to connect once. There have been a report where that
connection fails, but would probably succeed if tried again (#408).
This new parameter allows to configure the number of times a failed
implicit connect should be tried.

Resolves #408
2016-12-20 18:37:23 -07:00
Ivan Kozlovic
5dcad241bc Merge pull request #403 from nats-io/prepare_for_next_release
Release v0.9.6
v0.9.6
2016-12-15 16:01:36 -07:00
Ivan Kozlovic
614c435b08 Release v0.9.6 2016-12-15 15:38:15 -07:00
Derek Collison
1aaf5e9fe9 Only build release and coverage on success 2016-12-12 08:35:08 -08:00
Derek Collison
c39204b478 Merge pull request #401 from nats-io/wait_server_ready
Replace GetListenEndpoint() with ReadyForConnections()
2016-12-09 15:00:40 -08:00
Ivan Kozlovic
5f471b6e7f Replace GetListenEndpoint() with ReadyForConnections()
The RunServer() function (and the various variants)
call Server.Start() in a go-routine, but do not return until
it has verified that the server is ready to accept connections.
To do so, it use GetListenEndpoint() to get a suitable connect
address (replacing "0.0.0.0" or "::" with localhost - important
on Windows). It then creates a raw TCP connection to ensure the
server is started, repeating the process in case of failure up
to 10 seconds.

This PR replaces this with a function that checks that client
listener, and route listener if configured, are set. This removes
the need to get a connect address and create test tcp connections.

The reason for this change is that NATS Streaming when starting
the NATS Server (unless configured to connect to a remote one)
calls RunServerWithAuth(), which when getting "localhost" from
GetListenEndpoint(), would fail trying to resolve it. This happened
for the NATS Streaming Docker image built with Go 1.7+.
2016-12-09 14:03:45 -07:00
Derek Collison
0598bfa3b0 Merge pull request #400 from nats-io/fix_travis
Fixed Travis check for 1.7 and some cleanup
2016-12-08 13:16:41 -08:00
Ivan Kozlovic
afb3dc9f2f Fixed Travis check for 1.7 and some cleanup
Resolves #399
2016-12-08 10:35:31 -07:00
Derek Collison
6bc9389351 Merge pull request #398 from nats-io/go1.7.4
Go1.7.4
2016-12-06 16:08:53 -08:00
Derek Collison
d999d0c7fd 1.7 trigger for coverage 2016-12-06 15:52:27 -08:00
Derek Collison
3540f0d45f Bump to Go 1.6.4 and 1.7.4 2016-12-06 14:04:26 -08:00
Derek Collison
ee93345fde Merge pull request #395 from clsung/go1.7.4_security
Update golang version to 1.7.4 in Dockerfile, Security Update.
2016-12-04 05:47:05 -08:00
Cheng-Lung Sung
dee59a14e7 Update golang version to 1.7.4 in Dockerfile, Security Update. 2016-12-04 11:31:01 +08:00
Derek Collison
874921ed9f Remove comment for old cluster options 2016-12-02 15:14:36 -08:00
Derek Collison
92f7740609 Merge pull request #394 from nats-io/cluster_opts
Cluster opts
2016-12-02 15:13:30 -08:00
Derek Collison
606f8e95f7 fixup for main 2016-12-02 14:36:52 -08:00