vppn/peer/router-types.go
2024-12-14 07:38:06 +01:00

35 lines
751 B
Go

package peer
import (
"net/netip"
"vppn/m"
)
// ----------------------------------------------------------------------------
// A route is used by a peer to send or receive packets. A peer won't send
// packets on a route that isn't up, but will process incoming packets on
// that route.
type route struct {
PeerIP byte
Up bool
Mediator bool
EncSharedKey []byte // Shared key for encoding / decoding packets.
Addr netip.AddrPort
useMediator bool
}
type peerUpdate struct {
PeerIP byte
*m.Peer // nil => delete.
}
// ----------------------------------------------------------------------------
// Wrapper for routing packets.
type wrapper struct {
Packet Packet
Nonce Nonce
SrcAddr netip.AddrPort
}