Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mbobakov committed Oct 18, 2018
1 parent ca9f218 commit c9c3e55
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 10 deletions.
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -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.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:*
Expand All @@ -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

Expand All @@ -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
16 changes: 8 additions & 8 deletions consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
}
Expand Down

0 comments on commit c9c3e55

Please sign in to comment.