Documentation ¶
Overview ¶
Package disco contains the discovery message types.
A discovery message is:
Header:
magic [6]byte // “TS💬” (0x54 53 f0 9f 92 ac) senderDiscoPub [32]byte // nacl public key nonce [24]byte
The recipient then decrypts the bytes following (the nacl secretbox) and then the inner payload structure is:
messageType byte (the MessageType constants below) messageVersion byte (0 for now; but always ignore bytes at the end) message-paylod [...]byte
Index ¶
Constants ¶
const ( TypePing = MessageType(0x01) TypePong = MessageType(0x02) TypeCallMeMaybe = MessageType(0x03) )
const Magic = "TS💬" // 6 bytes: 0x54 53 f0 9f 92 ac
Magic is the 6 byte header of all discovery messages.
const NonceLen = 24
NonceLen is the length of the nonces used by nacl secretboxes.
Variables ¶
This section is empty.
Functions ¶
func LooksLikeDiscoWrapper ¶ added in v1.0.0
LooksLikeDiscoWrapper reports whether p looks like it's a packet containing an encrypted disco message.
func MessageSummary ¶
MessageSummary returns a short summary of m for logging purposes.
Types ¶
type CallMeMaybe ¶
type CallMeMaybe struct{}
CallMeMaybe is a message sent only over DERP to request that the recipient try to open up a magicsock path back to the sender.
The sender should've already sent UDP packets to the peer to open up the stateful firewall mappings inbound.
The recipient may choose to not open a path back, if it's already happy with its path. But usually it will.
func (CallMeMaybe) AppendMarshal ¶
func (CallMeMaybe) AppendMarshal(b []byte) []byte
type Message ¶
type Message interface { // AppendMarshal appends the message's marshaled representation. AppendMarshal([]byte) []byte }
Message a discovery message.
type MessageType ¶
type MessageType byte