From c9c3e55b6f75661dbdbcb1f90f0e3aecb7111e66 Mon Sep 17 00:00:00 2001 From: Mstislav Bobakov Date: Thu, 18 Oct 2018 12:15:31 +0300 Subject: [PATCH] Readme --- LICENCE | 21 +++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++-- consul_test.go | 16 ++++++++-------- 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 LICENCE diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..0330872 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Mstislav Bobakov + +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/README.md b/README.md index 536289a..b85cf21 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,16 @@ -### Connection string +# GRPC consul resolver + +Feature rich and easy-to-use resolver which return endpoints for service from the [Hashicorp Consul](https://www.consul.io) and watch for the changes. + +This library is *production ready* and will always *save backward-compatibility* + +## Quick Start + +For using resolving endpoints from your [Hashicorp Consul](https://www.consul.io) just import this library with `import _ /github.com/mbobakov/grpc-consul-resolver` and pass valid connection string to the `grpc.Dial`. + +For full example see [this section](#example) + +## Connection string `consul://[user:password@]127.0.0.127:8555/my-service?[healthy=]&[wait=]&[near=]&[insecure=]&[limit=]&[tag=]` *Parameters:* @@ -13,7 +25,7 @@ | limit | int | Limit number of endpoints for the service. Default: no limit | | timeout | as in time.ParseDuration | Http-client timeout. Default: 60s | -### Example +## Example ```go package main @@ -37,3 +49,11 @@ func main() { ... } ``` +<<<<<<< HEAD +======= + +## License + +MIT-LICENSE. See [LICENSE](http://olivere.mit-license.org/) +or the LICENSE file provided in the repository for details. +>>>>>>> Readme diff --git a/consul_test.go b/consul_test.go index f387f49..5f58d8f 100644 --- a/consul_test.go +++ b/consul_test.go @@ -18,24 +18,24 @@ func TestPopulateEndpoints(t *testing.T) { input [][]string want []resolver.Address }{ - {"one", [][]string{[]string{"127.0.0.1:50051"}}, []resolver.Address{resolver.Address{Addr: "127.0.0.1:50051"}}}, + {"one", [][]string{{"127.0.0.1:50051"}}, []resolver.Address{{Addr: "127.0.0.1:50051"}}}, {"sorted", [][]string{ - []string{"227.0.0.1:50051", "127.0.0.1:50051"}, + {"227.0.0.1:50051", "127.0.0.1:50051"}, }, []resolver.Address{ - resolver.Address{Addr: "127.0.0.1:50051"}, - resolver.Address{Addr: "227.0.0.1:50051"}, + {Addr: "127.0.0.1:50051"}, + {Addr: "227.0.0.1:50051"}, }, }, {"multy", [][]string{ - []string{"127.0.0.1:50051"}, - []string{"127.0.0.1:50052"}, - []string{"127.0.0.1:50053"}, + {"127.0.0.1:50051"}, + {"127.0.0.1:50052"}, + {"127.0.0.1:50053"}, }, []resolver.Address{ - resolver.Address{Addr: "127.0.0.1:50053"}, + {Addr: "127.0.0.1:50053"}, }, }, }