goloba

package module
v0.0.0-...-c5efcc6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 25 Imported by: 0

README

goloba Build Status Go Report Card GoDoc MIT licensed

A layer 4 load balancer written in Go.

Features

  • lvs contorol
  • hearthcheck
  • vrrp

Credits

Documentation

Index

Constants

View Source
const MaxWeight = 65535

MaxWeight is the maximum value for the destination weight. The minimum value is zero.

Variables

View Source
var ErrInvalidIP = errors.New("invalid IP address")

ErrInvalidIP is the error which is returned when an IP address is invalid.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	ListenAddress string `yaml:"listen_address"`
	AccessLog     string `yaml:"access_log"`
}

APIConfig is the configuration about API server.

type Config

type Config struct {
	PIDFile        string          `yaml:"pid_file"`
	ErrorLog       string          `yaml:"error_log"`
	EnableDebugLog bool            `yaml:"enable_debug_log"`
	API            APIConfig       `yaml:"api"`
	VRRP           VRRPConfig      `yaml:"vrrp"`
	Services       []ServiceConfig `yaml:"services"`
	// contains filtered or unexported fields
}

Config is the configuration object for the load balancer.

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig loads the configuration from a file.

type DestinationConfig

type DestinationConfig struct {
	Address     netutil.IP        `yaml:"address"`
	Port        uint16            `yaml:"port"`
	Weight      uint16            `yaml:"weight"`
	HealthCheck HealthCheckConfig `yaml:"health_check"`

	Detached bool `yaml:"detached"`
	Locked   bool `yaml:"locked"`
}

DestinationConfig is the configuration about the destination.

type HealthCheckConfig

type HealthCheckConfig struct {
	URL             string        `yaml:"url"`
	HostHeader      string        `yaml:"host_header"`
	EnableKeepAlive bool          `yaml:"enable_keep_alive"`
	SkipVerifyCert  bool          `yaml:"skip_verify_cert"`
	OKStatus        int           `yaml:"ok_status"`
	Timeout         time.Duration `yaml:"timeout"`
	Interval        time.Duration `yaml:"interval"`
}

HealthCheckConfig is the configuration about the health check.

type LoadBalancer

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

LoadBalancer is the load balancer.

func New

func New(config *Config) (*LoadBalancer, error)

New returns a new load balancer.

func (*LoadBalancer) Run

func (l *LoadBalancer) Run(ctx context.Context, listeners []net.Listener) error

Run runs a load balancer.

func (*LoadBalancer) SetKeepVIPsDuringRestart

func (l *LoadBalancer) SetKeepVIPsDuringRestart(keep bool)

type ServiceConfig

type ServiceConfig struct {
	Name         string              `yaml:"name"`
	Address      netutil.IP          `yaml:"address"`
	Port         uint16              `yaml:"port"`
	Schedule     string              `yaml:"schedule"`
	Type         string              `yaml:"type"`
	Destinations []DestinationConfig `yaml:"destinations"`
}

ServiceConfig is the configuration on the service.

type VRRPConfig

type VRRPConfig struct {
	Enabled              bool          `yaml:"enabled"`
	VRID                 uint8         `yaml:"vrid"`
	Priority             uint8         `yaml:"priority"`
	LocalAddress         string        `yaml:"local_address"`
	RemoteAddress        string        `yaml:"remote_address"`
	Preempt              bool          `yaml:"preempt"`
	MasterAdvertInterval time.Duration `yaml:"master_advert_interval"`
	SendGARPInterval     time.Duration `yaml:"send_garp_interval"`
	VIPInterface         string        `yaml:"vip_interface"`
	VIPs                 []string      `yaml:"vips"`
}

VRRPConfig is the configuration about VRRP.

Directories

Path Synopsis
cmd
goloba command
golobactl command

Jump to

Keyboard shortcuts

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