golb

package module
v0.0.0-...-3baf643 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 6 Imported by: 0

README

GoLB: The Lightweight, User-Friendly Load Balancer for Testing in Go

Discache

GoLB is a simple RoundRobin golang loadbalancer. It performs active cleaning and passive recovery for unhealthy backends.

Features:
  • Cleans: Excludes servers marked as unhealthy from the round-robin rotation.
  • Recovers: Periodically tries to recheck and reintegrate previously unhealthy servers back into service.
package main

import (
    "github.com/dhyanio/golb"
)

func main() {
    // Slice of servers
	servers := []string{"http://localhost:8081", "http://localhost:8082"}

    // Start Loadbalancer
	golb.Start(serverList, "3000")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(serverAddresses []string, port string)

Start initializes servers, sets up the load balancer, and starts listening on the specified port.

Types

type LoadBalancer

type LoadBalancer struct {
	// contains filtered or unexported fields
}

LoadBalancer represents a simple round-robin load balancer with active cleaning and passive recovery.

func NewLoadBalancer

func NewLoadBalancer(port string, servers []server) *LoadBalancer

NewLoadBalancer initializes a LoadBalancer with the specified port and servers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL