floating_ip

package
v1.29.8 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

启动,如果是 active 模式,且没有存在虚拟节点,则切换为 standby 模式; 启动,如果是 standby 模式,如果没有存在虚拟节点,则切换为 active 模式; 运行中,active 节点开启心跳服务端,每 5s 广播 arp 地址; 运行中,standby 节点,连接虚拟节点访问 active 服务器,如果连接成功,继续检测 运行中,standby 节点,连接虚拟节点,如果连接失败,重试 3 次,则提升自己为 active 节点,执行 active 运行任务;

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(config *FloatingIPConfig, req *Request)

send a Broadcast message to network to discovery the cluster

func ServeMulticastDiscovery

func ServeMulticastDiscovery(config *FloatingIPConfig, h func(*net.UDPAddr, int, []byte))

Types

type EchoConfig

type EchoConfig struct {
	EchoPort        int `config:"port"`               //61111
	EchoDialTimeout int `config:"dial_timeout_in_ms"` //10s
	EchoTimeout     int `config:"timeout_in_ms"`      //10s
}

type FloatingIPConfig

type FloatingIPConfig struct {
	Enabled   bool   `config:"enabled"`
	IP        string `config:"ip"`
	Netmask   string `config:"netmask"`
	Interface string `config:"interface"`

	LocalIP string `config:"local_ip"` //local ip address
	PeerIP  string `config:"peer_ip"`  //remote ip to failover

	Echo EchoConfig `config:"echo"`

	Priority               int  `config:"priority"`
	ForcedSwitchByPriority bool `config:"forced_by_priority"`

	BroadcastConfig config.NetworkConfig `config:"broadcast"`
}

type FloatingIPPlugin

type FloatingIPPlugin struct {
}

func (FloatingIPPlugin) Deactivate

func (module FloatingIPPlugin) Deactivate(silence bool)

func (FloatingIPPlugin) Name

func (this FloatingIPPlugin) Name() string

func (FloatingIPPlugin) Setup

func (module FloatingIPPlugin) Setup()

func (FloatingIPPlugin) Start

func (module FloatingIPPlugin) Start() error

func (FloatingIPPlugin) StateMachine

func (module FloatingIPPlugin) StateMachine()

func (FloatingIPPlugin) Stop

func (module FloatingIPPlugin) Stop() error

func (FloatingIPPlugin) SwitchToActiveMode

func (module FloatingIPPlugin) SwitchToActiveMode()

func (FloatingIPPlugin) SwitchToStandbyMode

func (module FloatingIPPlugin) SwitchToStandbyMode(latency time.Duration)

type Request

type Request struct {
	IsActive   bool   `json:"active"`
	FloatingIP string `json:"floating_ip"`
	FixedIP    string `json:"fixed_ip"`
	EchoPort   int    `json:"echo_port"`
	Priority   int    `json:"priority"`
}

type State

type State string
const Active State = "Active"
const Backup State = "Backup"
const Candidate State = "Candidate"
const PreviousActiveIsBack State = "PreviousActiveIsBack"

Jump to

Keyboard shortcuts

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