Skip to content
/ ip-hash Public

ip-hash balancing algorithm, based on round-robin.

License

Notifications You must be signed in to change notification settings

hlts2/ip-hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ip-hash

ip-hash is balancing algorithm, based on round-robin.

Requrement

Go (>= 1.8)

Installation

go get github.com/hlts2/ip-hash

Example

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

LICENSE

ip-hash released under MIT license, refer LICENSE file.