diff --git a/.travis.yml b/.travis.yml index a01e6d00..67b2ca07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ branches: script: - go build + - go fmt ./... - go vet ./... - go test -i -race ./... - go test -v -race ./... diff --git a/README.md b/README.md index 2f741d56..51e65333 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,101 @@ A High Performance [NATS](https://github.com/derekcollison/nats) Server written in [Go.](http://golang.org) [![Build Status](https://magnum.travis-ci.com/apcera/gnatsd.png?token=UGjrGa8sFWGQcHSJeAvp)](http://magnum.travis-ci.com/apcera/gnatsd) + +## Usage + +``` + +Server options: + -a, --addr HOST Bind to HOST address (default: 0.0.0.0) + -p, --port PORT Use PORT (default: 4222) + -P, --pid FILE File to store PID + -m, --http_port PORT Use HTTP PORT + -c, --config FILE Configuration File + +Logging options: + -l, --log FILE File to redirect log output + -T, --logtime Timestamp log entries (default: true) + -D, --debug Enable debugging output + -V, --trace Trace the raw protocol + +Authorization options: + --user user User required for connections + --pass password Password required for connections + +Common options: + -h, --help Show this message + -v, --version Show version + +``` + +## Configuration + +``` +# Sample config file + +port: 4242 +net: apcera.me # net interface + +http_port: 8222 + +authorization { + user: derek + password: T0pS3cr3t + timeout: 1 +} + +cluster { + host: '127.0.0.1' + port: 4244 + + authorization { + user: route_user + password: T0pS3cr3tT00! + timeout: 0.5 + } + + # Routes are actively solicited and connected to from this server. + # Other servers can connect to us if they supply the correct credentials + # in their routes definitions from above. + + routes = [ + nats-route://user1:pass1@127.0.0.1:4245 + nats-route://user2:pass2@127.0.0.1:4246 + ] +} + +# logging options +debug: false +trace: true +logtime: false +log_file: "/tmp/gnatsd.log" + +#pid file +pid_file: "/tmp/gnatsd.pid" +``` + + +## License + +(The MIT License) + +Copyright (c) 2012-2013 Apcera Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/gnatsd.go b/gnatsd.go index b497ad49..cef017a8 100644 --- a/gnatsd.go +++ b/gnatsd.go @@ -1,4 +1,4 @@ -// Copyright 2012 Apcera Inc. All rights reserved. +// Copyright 2012-2013 Apcera Inc. All rights reserved. package main diff --git a/server/client_test.go b/server/client_test.go index 0ecc1c9c..944c0007 100644 --- a/server/client_test.go +++ b/server/client_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package server import ( diff --git a/server/opts_test.go b/server/opts_test.go index d4830de1..0ad55e50 100644 --- a/server/opts_test.go +++ b/server/opts_test.go @@ -1,5 +1,3 @@ -// Copyright 2012-2013 Apcera Inc. All rights reserved. - package server import ( diff --git a/server/parser_test.go b/server/parser_test.go index b14fd075..7e8999fa 100644 --- a/server/parser_test.go +++ b/server/parser_test.go @@ -1,5 +1,3 @@ -// Copyright 2012-2013 Apcera Inc. All rights reserved. - package server import ( diff --git a/server/routes_test.go b/server/routes_test.go index 3017d95f..6b4d226c 100644 --- a/server/routes_test.go +++ b/server/routes_test.go @@ -1,5 +1,3 @@ -// Copyright 2013 Apcera Inc. All rights reserved. - package server import ( diff --git a/server/split_test.go b/server/split_test.go index 484b9908..77721431 100644 --- a/server/split_test.go +++ b/server/split_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package server import ( diff --git a/server/util.go b/server/util.go index 2a99ecaf..0b4f4def 100644 --- a/server/util.go +++ b/server/util.go @@ -51,6 +51,7 @@ func parseInt64(d []byte) (n int64) { return n } +// Helper to move from float seconds to time.Duration func secondsToDuration(seconds float64) time.Duration { ttl := seconds * float64(time.Second) return time.Duration(ttl) diff --git a/test/auth_test.go b/test/auth_test.go index 8473c357..36a356b3 100644 --- a/test/auth_test.go +++ b/test/auth_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/bench_test.go b/test/bench_test.go index 2951dd35..f7353857 100644 --- a/test/bench_test.go +++ b/test/bench_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/gosrv_test.go b/test/gosrv_test.go index edc71f7c..24444a97 100644 --- a/test/gosrv_test.go +++ b/test/gosrv_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/log_test.go b/test/log_test.go index 430c068a..bbbccb60 100644 --- a/test/log_test.go +++ b/test/log_test.go @@ -1,5 +1,3 @@ -// Copyright 2013 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/monitor_test.go b/test/monitor_test.go index 7369b9a8..bd4da85b 100644 --- a/test/monitor_test.go +++ b/test/monitor_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( @@ -112,7 +110,7 @@ func TestVarz(t *testing.T) { } func TestConnz(t *testing.T) { - s := runMonitorServer(server.DEFAULT_HTTP_PORT+1) + s := runMonitorServer(server.DEFAULT_HTTP_PORT + 1) defer s.Shutdown() url := fmt.Sprintf("http://localhost:%d/", server.DEFAULT_HTTP_PORT+1) diff --git a/test/pedantic_test.go b/test/pedantic_test.go index df65063d..c7ac3c5e 100644 --- a/test/pedantic_test.go +++ b/test/pedantic_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/pid_test.go b/test/pid_test.go index 68517ced..3287a4c3 100644 --- a/test/pid_test.go +++ b/test/pid_test.go @@ -1,5 +1,3 @@ -// Copyright 2013 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/ping_test.go b/test/ping_test.go index f800d2a4..706654bb 100644 --- a/test/ping_test.go +++ b/test/ping_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/proto_test.go b/test/proto_test.go index 2fc3127e..a63063dc 100644 --- a/test/proto_test.go +++ b/test/proto_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/routes_test.go b/test/routes_test.go index 35d2231a..3deed9b1 100644 --- a/test/routes_test.go +++ b/test/routes_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/test.go b/test/test.go index a2b4593e..f64172f4 100644 --- a/test/test.go +++ b/test/test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import ( diff --git a/test/verbose_test.go b/test/verbose_test.go index b22cdffc..d675c955 100644 --- a/test/verbose_test.go +++ b/test/verbose_test.go @@ -1,5 +1,3 @@ -// Copyright 2012 Apcera Inc. All rights reserved. - package test import (