Documentation ¶
Index ¶
- Constants
- Variables
- func AuthFlow(info *nodev1.LoginResponse) (string, error)
- func CompareAddrPort(p1, p2 netip.AddrPort) int
- func DecodeBase64Key(key string) ([]byte, error)
- func GenerateNewKeypair() (noise.DHKey, error)
- func GetPreferredOutboundAddr() (netip.Addr, error)
- func LoadKeyFromDisk() (noise.DHKey, error)
- func NewInboundBuffer() interface{}
- func NewOutboundBuffer() interface{}
- func ParseAddr(addr string) (netip.Addr, error)
- func ParseAddrPort(ap string) (netip.AddrPort, error)
- func PutInboundBuffer(buffer *InboundBuffer)
- func PutOutboundBuffer(buffer *OutboundBuffer)
- func ReportBuffers()
- func StoreKeyToDisk(keyPair noise.DHKey) error
- type ControllerClient
- func (c *ControllerClient) Close() error
- func (c *ControllerClient) ConnectStream(ctx context.Context) (controllerv1.ControllerService_UpdateStreamClient, error)
- func (c *ControllerClient) RunUpdateStream(ctx context.Context)
- func (c *ControllerClient) SubmitUpdate(update *controllerv1.UpdateRequest)
- type IceCreds
- type InboundBuffer
- type Key
- type Node
- func (node *Node) AddPeer(peerInfo *proto.Peer) (*Peer, error)
- func (n *Node) Down(ctx context.Context, req *nodev1.DownRequest) (*nodev1.DownResponse, error)
- func (node *Node) HandleUpdates(ctx context.Context)
- func (n *Node) Login(ctx context.Context, req *nodev1.LoginRequest) (*nodev1.LoginResponse, error)
- func (node *Node) OnTunnelPacket(buffer *OutboundBuffer)
- func (node *Node) ReadTunPackets(callback OnTunnelPacket)
- func (node *Node) Run() error
- func (n *Node) Start() error
- func (node *Node) StartUpdateStream(ctx context.Context)
- func (node *Node) Stop() error
- func (node *Node) StopAllPeers()
- func (n *Node) Up(ctx context.Context, req *nodev1.UpRequest) (*nodev1.UpResponse, error)
- type OnTunnelPacket
- type OutboundBuffer
- type Peer
Constants ¶
View Source
const ( // Timers TimerHandshakeTimeout = time.Second * 5 TimerRxTimeout = time.Second * 15 TimerKeepalive = time.Second * 10 // Counts CountHandshakeRetries = 10 InboundChannelSize = 1024 OutboundChannelSize = 1024 HandshakeChannelSize = 3 )
View Source
const BufferSize = 1600
Variables ¶
View Source
var ( InboundBuffers = sync.Pool{New: NewInboundBuffer} OutboundBuffers = sync.Pool{New: NewOutboundBuffer} IBuffersInUse atomic.Uint64 OBuffersInUse atomic.Uint64 )
Functions ¶
func CompareAddrPort ¶
func DecodeBase64Key ¶
func GenerateNewKeypair ¶
func LoadKeyFromDisk ¶
func NewInboundBuffer ¶
func NewInboundBuffer() interface{}
func NewOutboundBuffer ¶
func NewOutboundBuffer() interface{}
func PutInboundBuffer ¶
func PutInboundBuffer(buffer *InboundBuffer)
func PutOutboundBuffer ¶
func PutOutboundBuffer(buffer *OutboundBuffer)
func ReportBuffers ¶
func ReportBuffers()
func StoreKeyToDisk ¶
Types ¶
type ControllerClient ¶
type ControllerClient struct {
// contains filtered or unexported fields
}
func NewControllerClient ¶
func NewControllerClient(address string) (*ControllerClient, error)
func (*ControllerClient) Close ¶
func (c *ControllerClient) Close() error
func (*ControllerClient) ConnectStream ¶
func (c *ControllerClient) ConnectStream( ctx context.Context, ) (controllerv1.ControllerService_UpdateStreamClient, error)
func (*ControllerClient) RunUpdateStream ¶
func (c *ControllerClient) RunUpdateStream(ctx context.Context)
func (*ControllerClient) SubmitUpdate ¶
func (c *ControllerClient) SubmitUpdate(update *controllerv1.UpdateRequest)
type InboundBuffer ¶
type InboundBuffer struct {
// contains filtered or unexported fields
}
func GetInboundBuffer ¶
func GetInboundBuffer() *InboundBuffer
type Node ¶
type Node struct { nodev1.UnimplementedNodeServiceServer // contains filtered or unexported fields }
TODO: Verify need for mutex for node properties like ip, prefix, id, etc TODO: Handle logged in state and when to refresh TODO: Handle logged in state after running 'down' command
func (*Node) Down ¶
func (n *Node) Down(ctx context.Context, req *nodev1.DownRequest) (*nodev1.DownResponse, error)
func (*Node) HandleUpdates ¶
func (*Node) Login ¶
func (n *Node) Login(ctx context.Context, req *nodev1.LoginRequest) (*nodev1.LoginResponse, error)
func (*Node) OnTunnelPacket ¶
func (node *Node) OnTunnelPacket(buffer *OutboundBuffer)
func (*Node) ReadTunPackets ¶
func (node *Node) ReadTunPackets(callback OnTunnelPacket)
func (*Node) StartUpdateStream ¶
TODO: Fix stream auth
func (*Node) StopAllPeers ¶
func (node *Node) StopAllPeers()
type OnTunnelPacket ¶
type OnTunnelPacket func(buffer *OutboundBuffer)
type OutboundBuffer ¶
type OutboundBuffer struct {
// contains filtered or unexported fields
}
func GetOutboundBuffer ¶
func GetOutboundBuffer() *OutboundBuffer
type Peer ¶
type Peer struct { Hostname string IP netip.Addr ID uint32 // contains filtered or unexported fields }
TODO: proper self-contained state machine for noise handshakes
func (*Peer) InboundPacket ¶
func (peer *Peer) InboundPacket(buffer *InboundBuffer)
func (*Peer) InitiateConnection ¶
func (peer *Peer) InitiateConnection()
TODO: Add retries and counting
func (*Peer) OutboundPacket ¶
func (peer *Peer) OutboundPacket(buffer *OutboundBuffer)
func (*Peer) ResetState ¶
func (peer *Peer) ResetState()
func (*Peer) RespondConnection ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.