Documentation ¶
Index ¶
- Constants
- type Callbacks
- type ChannelSubscriptionMessage
- type Client
- func (client *Client) Close() error
- func (client *Client) Connect(transport net.Conn) error
- func (client Client) SendChannelSubscription(message ChannelSubscriptionMessage) error
- func (client Client) SendIntro(message IntroMessage) error
- func (client *Client) SendMessage(messageType uint8, payload []byte) error
- func (client Client) SendNodeState(message NodeStateMessage) error
- func (client Client) SendOutro(message OutroMessage) error
- func (client *Client) SendResponseMessage(messageType uint8, messageID uint8, payload []byte) error
- func (client Client) SendStreamPublishing(message StreamPublishingMessage) error
- func (client Client) SendStreamRelaying(message StreamRelayingMessage) error
- type Config
- type IntroMessage
- type MessageHeader
- type NodeStateMessage
- type OutroMessage
- type StreamPublishingMessage
- type StreamRelayingMessage
Constants ¶
const ( TypeIntro = 0 TypeOutro = 1 TypeNodeState = 2 // 3 - 15 Reserved Reserved for future use (server state messaging) TypeChannelSubscription = 16 TypeStreamPublishing = 17 TypeStreamRelaying = 20 )
Message Types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks struct { OnIntro func(header MessageHeader, message IntroMessage) OnOutro func(header MessageHeader, message OutroMessage) OnNodeState func(header MessageHeader, message NodeStateMessage) OnChannelSubscription func(header MessageHeader, message ChannelSubscriptionMessage) OnStreamPublishing func(header MessageHeader, message StreamPublishingMessage) OnStreamRelaying func(header MessageHeader, message StreamRelayingMessage) }
type ChannelSubscriptionMessage ¶
ChannelSubscriptionMessage Indicates whether streams for a given channel should be relayed to this node.
func DecodeChannelSubscriptionMessage ¶
func DecodeChannelSubscriptionMessage(buf []byte) ChannelSubscriptionMessage
func (*ChannelSubscriptionMessage) Encode ¶
func (im *ChannelSubscriptionMessage) Encode() []byte
type Client ¶
type Client struct { ClientHostname string // contains filtered or unexported fields }
func (Client) SendChannelSubscription ¶
func (client Client) SendChannelSubscription(message ChannelSubscriptionMessage) error
func (Client) SendIntro ¶
func (client Client) SendIntro(message IntroMessage) error
func (*Client) SendMessage ¶
func (Client) SendNodeState ¶
func (client Client) SendNodeState(message NodeStateMessage) error
func (Client) SendOutro ¶
func (client Client) SendOutro(message OutroMessage) error
func (*Client) SendResponseMessage ¶
func (Client) SendStreamPublishing ¶
func (client Client) SendStreamPublishing(message StreamPublishingMessage) error
func (Client) SendStreamRelaying ¶
func (client Client) SendStreamRelaying(message StreamRelayingMessage) error
type Config ¶
type Config struct { // Address of the remote orchestrator ip:port format Address string // RegionCode we are representing RegionCode string // Hostname for ourselves, so edges know how to reach us Hostname string // Logger for orchestrator client messages Logger logrus.FieldLogger // Handler for callbacks Callbacks Callbacks }
type IntroMessage ¶
type IntroMessage struct { VersionMajor uint8 VersionMinor uint8 VersionRevision uint8 RelayLayer uint8 RegionCode string Hostname string }
IntroMessage Sent on connect with identifying information.
func DecodeIntroMessage ¶
func DecodeIntroMessage(buf []byte) IntroMessage
func (*IntroMessage) Encode ¶
func (im *IntroMessage) Encode() []byte
type MessageHeader ¶
type MessageHeader struct { // Request Serializes from Request / Response Request bool // Success Serializes from Success / Failure Success bool Type uint8 ID uint8 PayloadLength uint16 }
MessageHeader |- 32 bit / 4 byte -| +---------------------------------------------------------------+ | Msg Desc (8) | Msg Id (8) | Payload Length (16) | +---------------------------------------------------------------+
func DecodeMessageHeader ¶
func DecodeMessageHeader(buf []byte) *MessageHeader
func (MessageHeader) Encode ¶
func (msg MessageHeader) Encode() []byte
type NodeStateMessage ¶
NodeStateMessage Sent periodically by nodes to indicate their current state.
func DecodeNodeStateMessage ¶
func DecodeNodeStateMessage(buf []byte) NodeStateMessage
func (*NodeStateMessage) Encode ¶
func (im *NodeStateMessage) Encode() []byte
type OutroMessage ¶
type OutroMessage struct {
Reason string
}
OutroMessage Sent on disconnect with information on the reason for disconnect.
func DecodeOutroMessage ¶
func DecodeOutroMessage(buf []byte) OutroMessage
func (*OutroMessage) Encode ¶
func (im *OutroMessage) Encode() []byte
type StreamPublishingMessage ¶
StreamPublishingMessage Indicates that a new stream is now available (or unavailable) from this connection.
func DecodeStreamPublishingMessage ¶
func DecodeStreamPublishingMessage(buf []byte) StreamPublishingMessage
func (*StreamPublishingMessage) Encode ¶
func (im *StreamPublishingMessage) Encode() []byte
type StreamRelayingMessage ¶
type StreamRelayingMessage struct { Context uint8 ChannelID ftl.ChannelID StreamID ftl.StreamID TargetHostname string StreamKey []byte }
StreamRelayingMessage Contains information used for relaying streams between nodes.
func DecodeStreamRelayingMessage ¶
func DecodeStreamRelayingMessage(buf []byte) StreamRelayingMessage
func (*StreamRelayingMessage) Encode ¶
func (im *StreamRelayingMessage) Encode() []byte