Thread safe load-balancer package for Golang
Install the package using
$ go get github.com/thedevsaddam/trafficTo use the package import it in your *.go code
import "github.com/thedevsaddam/traffic"package main
import (
"fmt"
"github.com/thedevsaddam/traffic"
)
func main() {
t := traffic.NewWeightedRoundRobin()
t.Add("a", 5)
t.Add("b", 2)
t.Add("c", 3)
for i := 0; i < 100; i++ {
fmt.Println(t.Next())
}
}If you are interested to make the package better please send pull requests or create an issue so that others can fix. Read the contribution guide here.
The traffic is an open-source software licensed under the MIT License.