Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EndpointMapping ¶
type EndpointMapping struct {
GravityVIP string `json:"gravity_vip"`
HadronVIP string `json:"hadron_vip"`
ContainerID string `json:"container_id"`
MachineID string `json:"machine_id"`
ProjectID string `json:"project_id"`
DNSNames []string `json:"dns_names"`
Timestamp int64 `json:"timestamp"`
}
EndpointMapping describes the mapping between a container and its network endpoints within the Gravity mesh.
type EndpointTombstone ¶
type EndpointTombstone struct {
ContainerID string `json:"container_id"`
MachineID string `json:"machine_id"`
Timestamp int64 `json:"timestamp"`
}
EndpointTombstone marks an endpoint as removed so peers can clean up stale mappings.
type Envelope ¶
type Envelope struct {
Type MessageType `json:"type"`
Payload json.RawMessage `json:"payload"`
}
Envelope is the wire format for gossip messages. It wraps a MessageType together with a JSON-encoded payload so receivers can demux without knowing the concrete type up front.
type MessageType ¶
type MessageType uint8
MessageType identifies the kind of gossip message on the wire.
const ( // MsgEndpointMapping carries a new or updated endpoint mapping. MsgEndpointMapping MessageType = iota + 1 // MsgEndpointTombstone signals removal of an endpoint. MsgEndpointTombstone // MsgNATEntry carries a NAT translation entry. MsgNATEntry // MsgVIPHeartbeat carries a VIP ownership heartbeat. MsgVIPHeartbeat )
func Decode ¶
func Decode(data []byte) (MessageType, any, error)
Decode deserialises a JSON-encoded Envelope and returns the MessageType together with the concrete Go value. The returned value is a pointer to the decoded struct (e.g. *EndpointMapping).
func (MessageType) String ¶
func (m MessageType) String() string
String returns a human-readable name for the message type.
type NATEntry ¶
type NATEntry struct {
Key string `json:"key"`
OriginalDst string `json:"original_dst"`
OriginalSrc string `json:"original_src"`
SrcPort uint16 `json:"src_port"`
DstPort uint16 `json:"dst_port"`
Timestamp int64 `json:"timestamp"`
}
NATEntry represents a single NAT translation entry used to route packets between Gravity instances.
type VIPHeartbeat ¶
type VIPHeartbeat struct {
VIP string `json:"vip"`
Owners map[string]int64 `json:"owners"`
Timestamp int64 `json:"timestamp"`
NewNATs []NATEntry `json:"new_nats,omitempty"`
NewEndpoints []EndpointMapping `json:"new_endpoints,omitempty"`
}
VIPHeartbeat advertises ownership and recent changes for a VIP.