pkg

package
v0.0.0-...-0c26abf Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ARPSendGratuitous

func ARPSendGratuitous(arp *ARPGratuitous) error

ARPSendGratuitous sends a gratuitous ARP message via the specified interface.

func Serve

func Serve(cfg Config)

func SplitIP

func SplitIP(addr string) (string, error)

Types

type ARPGratuitous

type ARPGratuitous struct {
	IfaceName string
	IP        net.IP
}

ARPGratuitous encapsulates a request to send a gratuitous ARP message.

type Config

type Config struct {
	Raft    Raft    `toml:"raft"`
	Network Network `toml:"network"`
	Ntp     Ntp     `toml:"ntp"`
}

type FSM

type FSM struct {
}

func (FSM) Apply

func (fsm FSM) Apply(log *raft.Log) interface{}

func (FSM) Restore

func (fsm FSM) Restore(snap io.ReadCloser) error

func (FSM) Snapshot

func (fsm FSM) Snapshot() (raft.FSMSnapshot, error)

type Logger

type Logger struct {
}

func (Logger) Write

func (logger Logger) Write(data []byte) (count int, error error)

type Manager

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

func NewManager

func NewManager(id, bind string, peers RaftPeers, logger Logger, networkManager NetworkManager, ntpManager NTPManager) *Manager

func (*Manager) Action

func (manager *Manager) Action(raftServer *raft.Raft)

func (*Manager) LeaderAddr

func (manager *Manager) LeaderAddr(raftServer *raft.Raft) string

func (*Manager) Start

func (manager *Manager) Start() error

func (*Manager) Stop

func (manager *Manager) Stop()

type NTPConfig

type NTPConfig struct {
	LeaderIP   string
	IsInternal bool
	NTPServers []string
}

func NewNTPConfig

func NewNTPConfig(isInternal bool, ntpServers []string) (*NTPConfig, error)

func (*NTPConfig) RenderFollower

func (ntpConfig *NTPConfig) RenderFollower(leaderIP string) error

func (*NTPConfig) RenderLeader

func (ntpConfig *NTPConfig) RenderLeader() error

func (*NTPConfig) RestartService

func (ntpConfig *NTPConfig) RestartService() error

type NTPManager

type NTPManager interface {
	RenderLeader() error
	RenderFollower(leaderIP string) error
	RestartService() error
}

type Network

type Network struct {
	Vip       string `toml:"vip"`
	Interface string `toml:"interface"`
}

type NetworkConfig

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

NetworkConfig for link

func NewNetworkConfig

func NewNetworkConfig(address, link string) (*NetworkConfig, error)

NewNetworkConfig return NetworkConfig

func (*NetworkConfig) AddIP

func (nc *NetworkConfig) AddIP()

func (*NetworkConfig) DelIP

func (nc *NetworkConfig) DelIP()

func (*NetworkConfig) IP

func (nc *NetworkConfig) IP() string

func (*NetworkConfig) IsSet

func (nc *NetworkConfig) IsSet() (bool, error)

func (*NetworkConfig) IsUsed

func (nc *NetworkConfig) IsUsed() bool
func (nc *NetworkConfig) Link() string

func (*NetworkConfig) SendARP

func (nc *NetworkConfig) SendARP() error

type NetworkManager

type NetworkManager interface {
	AddIP()
	DelIP()
	IsSet() (bool, error)
	IsUsed() bool
	IP() string
	Link() string
	SendARP() error
}

type Ntp

type Ntp struct {
	Mode    string   `toml:"mode"`
	Servers []string `toml:"servers"`
}

type Peer

type Peer struct {
	ID   string
	Bind string
}

type Peers

type Peers struct {
	ID   string `toml:"id"`
	Addr string `toml:"addr"`
}

type Raft

type Raft struct {
	ID    string  `toml:"id"`
	Bind  string  `toml:"bind"`
	Peers []Peers `toml:"peers"`
}

type RaftPeers

type RaftPeers map[string]string

type Snapshot

type Snapshot struct {
}

func (Snapshot) Persist

func (snapshot Snapshot) Persist(sink raft.SnapshotSink) error

func (Snapshot) Release

func (snapshot Snapshot) Release()

Jump to

Keyboard shortcuts

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