ip-hash is balancing algorithm, based on round-robin.
Go (>= 1.8)
go get github.com/hlts2/ip-hash
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"}
ip-hash released under MIT license, refer LICENSE file.