Commit Graph

536 Commits

Author SHA1 Message Date
Derek Collison
f7ba3d175e Correct invocation of misspell with fixes 2017-04-21 09:21:33 -07:00
Derek Collison
ddd1b472e2 Removed need for ignore check on staticcheck, added misspell check 2017-04-21 09:11:28 -07:00
Derek Collison
acb740dbe9 Use checkClusterFormed 2017-04-20 18:34:08 -07:00
Derek Collison
0fa0003c9e Fixes for routes test with bcrypt and auth 2017-04-20 16:55:44 -07:00
Derek Collison
45d523e800 Fixups for auth always being checked now 2017-04-20 13:26:59 -07:00
Derek Collison
eae0834669 lower bcrypt costs for race tests, raise timeouts 2017-04-20 13:20:45 -07:00
Derek Collison
76de921f65 Cleanup for Auth 2017-04-20 12:41:48 -07:00
Ivan Kozlovic
0cf8455a3a [ADDED] Support for token in configuration file
So far, it was only possible to use token from the command line.

Resolves #464
2017-03-30 11:23:07 -06:00
Ivan Kozlovic
474cacad90 Increase code coverage
- Two files were showing poor code coverage affecting the overall
total.
- Fix to a route test that would fail on Windows.

Resolves #460
2017-03-24 11:58:58 -06:00
Derek Collison
b11ba5b118 Merge pull request #456 from wallyqs/gometalinter-checks
Fixes to a couple of `gometalinter` checks
2017-03-24 09:35:09 -07:00
Ivan Kozlovic
a0245fc0c8 [FIXED] Server not sending PINGs to TSL connections (clients or routes)
- Removed unnecessary cast check to (*net.TCPConn). When the timer
fires, the connection is already established. Replaced with check
that connection has not been closed.
- Add PING test that checks that pings are sent to TLS connections.
- Changed Go version to 1.7.5 in travis.
- Removed test package from code coverage.
2017-03-24 09:49:42 -06:00
Waldemar Quevedo
ed05c357fc Remove unused type 2017-03-23 20:41:47 -07:00
Waldemar Quevedo
8926fa0ff1 Fix unconvert checks in server 2017-03-23 20:41:38 -07:00
Ivan Kozlovic
a804516540 Fix gosimple report 2017-03-22 22:52:33 -06:00
Colin Sullivan
efbd423e96 Updates based on comments. 2017-03-01 20:46:47 -07:00
Colin Sullivan
3f8a0d8b4a Use atomic.Load to access fields used in /varz and /subsz requests.
* Includes a unit test that checks all endpoints for data races.
2017-03-01 16:13:20 -07:00
Ivan Kozlovic
1c5a34ea42 Update client connect to route port test
With the following client fix: https://github.com/nats-io/go-nats/pull/260
the client should always be able to connect after the initial
failure.
2017-01-27 09:59:29 -07:00
Derek Collison
fdf1a24d78 Merge pull request #424 from nats-io/reject_client_connecting_to_route
[ADDED] Reject clients connecting to route's listen port
2017-01-26 09:50:02 -08:00
Ivan Kozlovic
1fb9f211ca Added gosimple
- Get gosimple package
- Updated staticcheck's URL
- Moved build and above checks in `before_script` section to fail fast
- Fixed reports from gosimple
2017-01-25 13:30:11 -07:00
Ivan Kozlovic
c925e1c9bf Restored behavior after c.parse() error 2017-01-25 09:15:47 -07:00
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
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
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
Ivan Kozlovic
f1c513d7bf Removed last references to max_pending_size [ci skip] 2017-01-18 14:38:34 -07: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
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
Colin Sullivan
9312ec21db Update cipher suites and curve preferences for go version 1.8 2016-12-30 14:24: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
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
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
614c435b08 Release v0.9.6 2016-12-15 15:38:15 -07: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
874921ed9f Remove comment for old cluster options 2016-12-02 15:14:36 -08:00
Derek Collison
8fbacaaea1 Cleanup for cluster opts 2016-12-02 14:29:22 -08:00
Waldemar Quevedo
ff2d6d1983 Add function and test for processing sub command args 2016-12-01 18:18:52 -08:00
Ivan Kozlovic
fda43ea564 Remove non needed test for ErrTooManyConnections in client's readLoop
Since we now return an error before setting up the client's readLoop,
testing for this error in readLoop in not needed.
2016-12-01 09:54:12 -07:00
Ivan Kozlovic
ca268290a6 Perform the check on accept, not in processing CONNECT
This will protect the server from non NATS clients (telnet, etc),
or misbehaving clients that would create the tcp connection but
block before sending the CONNECT.
The drawback is that the client may or may not receive the error
message (in my tests, it was getting only between 10%-20% of times).
2016-12-01 08:48:04 -07:00
Ivan Kozlovic
6bcd324955 [FIXED] Honor max_connections setting
The max_connections config parameter was accepted but the server
would not check this limit when processing client connections.

Resolves #386
2016-11-30 18:20:12 -07:00
Waldemar Quevedo
2a8aa96af4 Remove "max_pending_size" option
Previous implementations of the server checked the pending data size
being currently buffered for a client to detect slow consumers,
though this does not apply to latest version of the server so removing
it as a config option to avoid confusion as it is not implemented.
2016-11-22 20:07:39 -08:00
Colin Sullivan
e9dc5fa054 Updates based on comments 2016-11-22 16:22:51 -07:00
Colin Sullivan
ccca711edd Differentiate signal handling for windows.
Windows has limited support for signals, and does not define syscall.SIGUSR1.  Log rotation will be handled differently in windows.

* Add signal.go for all non-windows builds
* Add signal_windows.go for windows builds.

Today, windows looks to be the only platform that does not have syscall.SIGUSR1 defined.
2016-11-22 15:22:34 -07:00
Derek Collison
1c32f28934 Support to reopen file based logs for rotation 2016-11-21 21:55:24 -08:00
Derek Collison
9e92aaa2de Version bump 2016-11-21 15:12:18 -08:00