package node import ( "net/netip" "sync/atomic" "vppn/m" ) var zeroAddrPort = netip.AddrPort{} const ( bufferSize = 1536 if_mtu = 1200 if_queue_len = 2048 controlCipherOverhead = 16 dataCipherOverhead = 16 ) type peerRoute struct { IP byte Up bool // True if data can be sent on the route. Relay bool // True if the peer is a relay. ControlCipher *controlCipher DataCipher *dataCipher RemoteAddr netip.AddrPort // Remote address if directly connected. LocalAddr netip.AddrPort // Local address as seen by the remote. RelayIP byte // Non-zero if we should relay. } // Configuration for this peer. var ( netName string localIP byte localPub bool privateKey []byte ) // Shared interface for writing. var _iface *ifWriter // Shared connection for writing. var _conn *connWriter // Counters for sending to each peer. var sendCounters [256]uint64 // Duplicate checkers for incoming packets. var dupChecks [256]*dupCheck // Channels for incoming control packets. var controlPackets [256]chan controlPacket // Channels for incoming peer updates from the hub. var peerUpdates [256]chan *m.Peer // Global routing table. var routingTable [256]*atomic.Pointer[peerRoute]