Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlts2/ip-hash
ip-hash balancing algorithm, based on round-robin.
https://github.com/hlts2/ip-hash
algorithm balancer balancing balancing-algorithm go golang golang-library goroutine-safe ip ip-hash library round-robin threadsafe
Last synced: about 1 month ago
JSON representation
ip-hash balancing algorithm, based on round-robin.
- Host: GitHub
- URL: https://github.com/hlts2/ip-hash
- Owner: hlts2
- License: mit
- Created: 2018-07-17T14:50:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T04:21:32.000Z (over 5 years ago)
- Last Synced: 2024-06-19T05:45:39.182Z (5 months ago)
- Topics: algorithm, balancer, balancing, balancing-algorithm, go, golang, golang-library, goroutine-safe, ip, ip-hash, library, round-robin, threadsafe
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ip-hash
ip-hash is balancing algorithm, based on [round-robin](https://github.com/hlts2/round-robin).## Requrement
Go (>= 1.8)
## Installation
```shell
go get github.com/hlts2/ip-hash
```## Example
```go
ip, _ := iphash.New([]*url.URL{
{Host: "192.168.33.10"},
{Host: "192.168.33.11"},
{Host: "192.168.33.12"},
})ip.Next(&url.URL{Host: "192.168.33.10"}) // {Host: "192.168.33.10"}
ip.Next(&url.URL{Host: "192.168.33.10"}) // {Host: "192.168.33.10"}
ip.Next(&url.URL{Host: "192.168.33.44"}) // {Host: "192.168.33.11"}
ip.Next(&url.URL{Host: "192.168.33.44"}) // {Host: "192.168.33.11"}
```## Author
[hlts2](https://github.com/hlts2)## LICENSE
ip-hash released under MIT license, refer [LICENSE](https://github.com/hlts2/ip-hash/blob/master/LICENSE) file.