weighted_round_robin

package
v0.0.0-...-2a30276 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loadbalancer

type Loadbalancer struct {
	Port string
	// contains filtered or unexported fields
}

func NewLoadBalancer

func NewLoadBalancer(port string, servers []SimpleServer) *Loadbalancer

Creates and returns a new loadbalancer instance

func (*Loadbalancer) ServeProxy

func (loadbalancer *Loadbalancer) ServeProxy(rw http.ResponseWriter, req *http.Request)

Forwards the request to the server returned by the getNextAvailableServer method

type SimpleServer

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

func NewSimpleServer

func NewSimpleServer(addr string, weight int) *SimpleServer

Creates a new instance of the simpleServer struct

func (*SimpleServer) Address

func (s *SimpleServer) Address() string

Returns the adress of the simple server instance

func (*SimpleServer) Serve

func (s *SimpleServer) Serve(rw http.ResponseWriter, req *http.Request)

Serves the through the reverse proxy

Jump to

Keyboard shortcuts

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