app

package
v0.0.0-...-75dd31c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPADDR  int = 0
	MACADDR int = 3
	// TODO:
	// Make loadbalancer capable of redirecting traffic
	// through other interfaces.
	IFNAME int = 5

	DEFAULT_ARP_PATH = "/proc/net/arp"
)
View Source
const (
	LB_SIZE_BYTES     = 14
	EGRESS_SIZE_BYTES = 14
)
View Source
const BACKEND_SIZE_BYTES = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type Arp

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

func (*Arp) Refresh

func (a *Arp) Refresh() (err error)

func (*Arp) Search

func (a *Arp) Search(ipaddr string) (mac string, err error)

type Backend

type Backend struct {
	IP  net.IP
	Mac net.HardwareAddr
}

func (*Backend) MarshalBinary

func (b *Backend) MarshalBinary() ([]byte, error)

type Config

type Config struct {
	Backends []string `yaml:"backends"`
	Pinpath  string   `yaml:"pinpath"`
}

func (*Config) ReadYaml

func (cfg *Config) ReadYaml(filepath string) error

type Egress

type Egress struct {
	IP    net.IP
	Mac   net.HardwareAddr
	Index int
}

func NewEgress

func NewEgress(ifName string) (*Egress, error)

func (*Egress) MarshalBinary

func (e *Egress) MarshalBinary() ([]byte, error)

func (*Egress) WriteToMap

func (e *Egress) WriteToMap(egressMap *ebpf.Map) error

type LoadBalancer

type LoadBalancer struct {
	Config Config
	IP     net.IP
	Mac    net.HardwareAddr
	Index  int
	Arp    *Arp
}

func NewLoadBalancer

func NewLoadBalancer(ifName string, config string, arp string) (*LoadBalancer, error)

func (*LoadBalancer) MarshalBinary

func (lb *LoadBalancer) MarshalBinary() ([]byte, error)

func (*LoadBalancer) WriteBackends

func (lb *LoadBalancer) WriteBackends(m *ebpf.Map) error

func (*LoadBalancer) WriteToMap

func (lb *LoadBalancer) WriteToMap(lbMap *ebpf.Map) error

WriteToMap writes the load balancer's addresses into the LbMetadata map.

Jump to

Keyboard shortcuts

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