Documentation ¶
Index ¶
- func FindGatewayMAC(interfaceName string) (net.HardwareAddr, error)
- func GetMACAddressByInterfaceName(interfaceName string) (string, error)
- func IpToUint32(ipStr string) uint32
- func IsSameSubnet(ip1, ip2 string, subnetMask string) (bool, error)
- func MacStringToInt8Array(macStr string) [6]int8
- func Uint32ToIp(ipInt uint32) string
- type AtomicCounter
- type BroadcastTargets
- type Metadata
- type Node
- type Packet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindGatewayMAC ¶
func FindGatewayMAC(interfaceName string) (net.HardwareAddr, error)
func MacStringToInt8Array ¶
func Uint32ToIp ¶
Types ¶
type AtomicCounter ¶
type AtomicCounter struct {
// contains filtered or unexported fields
}
func NewAtomicCounter ¶
func NewAtomicCounter() *AtomicCounter
func (*AtomicCounter) Next ¶
func (ac *AtomicCounter) Next() uint16
type BroadcastTargets ¶
func (BroadcastTargets) GetIp ¶
func (t BroadcastTargets) GetIp() uint32
func (BroadcastTargets) GetMac ¶
func (t BroadcastTargets) GetMac() [6]int8
func (BroadcastTargets) GetPort ¶
func (t BroadcastTargets) GetPort() uint16
type Metadata ¶
type Metadata struct { Size int // Metadata size Update int64 // Metadata version (update timestamp) Data []byte // Metadata content }
Metadata information
type Node ¶
type Node struct { Addr string `json:"Addr"` // Node IP address (fill in public IP in public network environment) Port int `json:"Port"` // Port number Mac string `json:"Mac"` // Node MAC address Name string `json:"Name"` // Node name (customizable) PrivateData string `json:"PrivateData"` // Node private data (customizable) LinkName string // bind xdp to this interface }
Node represents a node
type Packet ¶
type Packet struct { Type uint8 // 0 not used 1: heartbeat packet, 2: initiator sends an exchange request to the recipient, 3: recipient responds to the initiator, data exchange completed Count uint16 // Broadcast packet count (0-64) Mapkey uint16 // Map key // Metadata information Metadata Metadata // New metadata information, if the packet is a metadata update packet (isUpdate=true), then replace the original cluster metadata with newData // Node information Node Node // Node information in the heartbeat packet Infected map[string]bool // List of nodes already infected by this packet, the key is a string concatenated by Addr:Port, and the value determines whether the node has been infected (true: yes, false: no) IsUpdate bool // Whether it is a metadata update packet (0: no, 1: yes) SecretKey string // Cluster key, if it doesn't match, reject processing this packet CountStr string }
Packet data
Click to show internal directories.
Click to hide internal directories.