/cslb

Client-Side Load Balancing for Golang

Primary LanguageGo

cslb

Client-Side Load Balancer

This Project is in early developing state

Feature

  • Multiple client-side load balancing solutions support
  • Multiple distributing strategies
    • Round-Robin
    • Weighted Round-Robin
    • Hashed
  • Exile unhealthy node
  • Node list TTL

Usage

Example:

package main

import (
	"log"
	
	"github.com/RangerCD/cslb"
)

func main() {
	lb := cslb.NewLoadBalancer(
		cslb.NewRRDNSService([]string{"example.com"}, true, true), 
		cslb.NewRoundRobinStrategy(),
	)

	log.Println(lb.Next()) // IP 1
	log.Println(lb.Next()) // IP 2
}