failover

package
v0.0.0-...-1e050b0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Failover

type Failover struct {
	PrimaryInterface    string
	SecondaryInterface  string
	VLANID              int
	IP                  netip.Prefix
	ArpTarget           netip.Addr
	StandbyVLANMode     bool
	ArpInterval         int // ArpInterval in ms.
	ArpTimeout          int // ArpTimeout in ms.
	LinkMonitorInterval int // LinkMonitorInterval in ms.
	// contains filtered or unexported fields
}

func New

func New(primaryInterface, secondaryInterface string, vlanID int, ip netip.Prefix, arpTarget netip.Addr,
	standbyVLANMode bool, arpInterval, arpTimeout, linkMonitorInterval int) *Failover

func (*Failover) AddIPOnVLANInterface

func (f *Failover) AddIPOnVLANInterface(interfaceType InterfaceType) error

AddIPOnVLANInterface adds the IP address to the specified interface.

func (*Failover) LinkMonitor

func (f *Failover) LinkMonitor() error

LinkMonitor runs the failover mechanism.

func (*Failover) LinkUp

func (f *Failover) LinkUp(interfaceType InterfaceType) bool

LinkUp reports if the current interface is up.

func (*Failover) Prober

func (f *Failover) Prober() error

Prober runs the prober mechanism.

func (*Failover) RemoveIPFromVLANInterface

func (f *Failover) RemoveIPFromVLANInterface(interfaceType InterfaceType) error

RemoveIPFromVLANInterface removes the IP address from the specified interface.

func (*Failover) RemoveVLANInterface

func (f *Failover) RemoveVLANInterface(interfaceType InterfaceType) error

RemoveVLANInterface returns the VLAN interface on the selected interface if it exists.

func (*Failover) SendArp

func (f *Failover) SendArp() bool

SendArp sends an ARP packet and reports if a reply was received - it blocks until it receives the answer.

func (*Failover) Setup

func (f *Failover) Setup()

Setup sets up the failover daemon.

func (*Failover) SetupVLANInterface

func (f *Failover) SetupVLANInterface(interfaceType InterfaceType) error

SetupVLANInterface creates the VLAN interface on top of the selected interface.

type InterfaceType

type InterfaceType bool
const (
	InterfacePrimary   InterfaceType = true
	InterfaceSecondary InterfaceType = false
)

Jump to

Keyboard shortcuts

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