msgcontrol

package
v0.0.0-...-4449afe Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package msgcontrol contains types, constants, and interfaces related to control messages.

Control message interface definitions are sealed within this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientHello

type ClientHello struct {
	ClientNodePub key.NodePublic
}

func (*ClientHello) CMsgType

func (c *ClientHello) CMsgType() ControlMessageType

type ControlMessage

type ControlMessage interface {
	CMsgType() ControlMessageType
}

type ControlMessageType

type ControlMessageType byte
const (
	ClientHelloType ControlMessageType = iota
	ServerHelloType
	LogonType
	LogonAuthenticateType
	LogonDeviceKeyType
	LogonAcceptType
	LogonRejectType
	PingType
	PongType
)
const (
	EndpointUpdateType ControlMessageType = (1 << 8) - (iota + 1)
	HomeRelayUpdateType
	PeerAdditionType
	PeerUpdateType
	PeerRemoveType
	RelayUpdateType
	LogoutType
	DisconnectType
)

type Disconnect

type Disconnect struct {
	Reason string

	RetryStrategy RetryStrategyType `json:",omitempty"`

	RetryAfter time.Duration `json:",omitempty"`
}

-> client

func (*Disconnect) CMsgType

func (c *Disconnect) CMsgType() ControlMessageType

type EndpointUpdate

type EndpointUpdate struct {
	Endpoints []netip.AddrPort
}

-> control

func (*EndpointUpdate) CMsgType

func (c *EndpointUpdate) CMsgType() ControlMessageType

type HomeRelayUpdate

type HomeRelayUpdate struct {
	HomeRelay int64
}

-> control

func (*HomeRelayUpdate) CMsgType

func (c *HomeRelayUpdate) CMsgType() ControlMessageType

type Logon

type Logon struct {
	SessKey key.SessionPublic

	// check data encrypted with sharedkey (control pub x nodekey priv)
	NodeKeyAttestation []byte
	// check data encrypted with sharedkey (control pub x sesskey priv)
	SessKeyAttestation []byte

	ResumeSessionID *string `json:",omitempty"`
}

func (*Logon) CMsgType

func (c *Logon) CMsgType() ControlMessageType

type LogonAccept

type LogonAccept struct {
	IP4 netip.Prefix
	IP6 netip.Prefix

	AuthExpiry time.Time

	SessionID string
}

func (*LogonAccept) CMsgType

func (c *LogonAccept) CMsgType() ControlMessageType

type LogonAuthenticate

type LogonAuthenticate struct {
	AuthenticateURL string
}

func (*LogonAuthenticate) CMsgType

func (c *LogonAuthenticate) CMsgType() ControlMessageType

type LogonDeviceKey

type LogonDeviceKey struct {
	DeviceKey string
}

func (*LogonDeviceKey) CMsgType

func (c *LogonDeviceKey) CMsgType() ControlMessageType

type LogonReject

type LogonReject struct {
	Reason string

	RetryStrategy RetryStrategyType `json:",omitempty"`

	RetryAfter time.Duration `json:",omitempty"`
}

func (*LogonReject) CMsgType

func (c *LogonReject) CMsgType() ControlMessageType

type Logout

type Logout struct{}

-> control

func (*Logout) CMsgType

func (c *Logout) CMsgType() ControlMessageType

type PeerAddition

type PeerAddition struct {
	PubKey  key.NodePublic
	SessKey key.SessionPublic

	IPv4 netip.Addr
	IPv6 netip.Addr

	Endpoints []netip.AddrPort
	HomeRelay int64

	Properties Properties
}

-> client

func (*PeerAddition) CMsgType

func (c *PeerAddition) CMsgType() ControlMessageType

type PeerRemove

type PeerRemove struct {
	PubKey key.NodePublic
}

-> client

func (*PeerRemove) CMsgType

func (c *PeerRemove) CMsgType() ControlMessageType

type PeerUpdate

type PeerUpdate struct {
	PubKey key.NodePublic

	SessKey   *key.SessionPublic `json:",omitempty"`
	Endpoints []netip.AddrPort   `json:",omitempty"`
	HomeRelay *int64             `json:",omitempty"`

	Properties *Properties `json:",omitempty"`
}

-> client

func (*PeerUpdate) CMsgType

func (c *PeerUpdate) CMsgType() ControlMessageType

type Ping

type Ping struct {
	// random data encrypted with shared key (control priv x client pub)
	// to be signed with shared key of nodekey and sesskey
	CheckData []byte
}

func (*Ping) CMsgType

func (c *Ping) CMsgType() ControlMessageType

type Pong

type Pong struct {
	// check data encrypted with sharedkey (control pub x nodekey priv)
	NodeKeyAttestation []byte
	// check data encrypted with sharedkey (control pub x sesskey priv)
	SessKeyAttestation []byte
}

func (*Pong) CMsgType

func (c *Pong) CMsgType() ControlMessageType

type Properties

type Properties struct {
	Quarantine bool
	MDNS       bool
}

type RelayUpdate

type RelayUpdate struct {
	Relays []relay.Information
}

-> client

func (*RelayUpdate) CMsgType

func (c *RelayUpdate) CMsgType() ControlMessageType

type RetryStrategyType

type RetryStrategyType byte
const (
	// Cannot retry, abort
	NoRetryStrategy RetryStrategyType = iota
	// Regenerate session Key
	RegenerateSessionKey
	// Retry without session ID
	RecreateSession
)

func (RetryStrategyType) Error

func (r RetryStrategyType) Error() string

type ServerHello

type ServerHello struct {
	ControlNodePub key.ControlPublic

	// random data encrypted with shared key (control priv x client pub)
	// to be signed with shared key of nodekey and sesskey
	CheckData []byte
}

func (*ServerHello) CMsgType

func (c *ServerHello) CMsgType() ControlMessageType

Jump to

Keyboard shortcuts

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