routing

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sentinal value
	BucketNotCalculated = -1
)

Variables

This section is empty.

Functions

func BalancePacket

func BalancePacket(fwPacket *firewall.Packet, gateways []Gateway) (netip.Addr, bool)

For this function to work correctly it requires that the buckets for the gateways have been calculated If the contract is violated balancing will not work properly and the second return value will return false

func CalculateBucketsForGateways

func CalculateBucketsForGateways(gateways []Gateway)

Implements Hash-Threshold mapping, equivalent to the implementation in the linux kernel. After this function returns each gateway will have a positive bucketUpperBound with a maximum value of 2147483647 (INT_MAX)

Types

type Gateway

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

func NewGateway

func NewGateway(addr netip.Addr, weight int) Gateway

func (*Gateway) Addr

func (g *Gateway) Addr() netip.Addr

func (*Gateway) BucketUpperBound

func (g *Gateway) BucketUpperBound() int

func (*Gateway) String

func (g *Gateway) String() string

type Gateways

type Gateways []Gateway

func (Gateways) String

func (g Gateways) String() string

Jump to

Keyboard shortcuts

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