Documentation ¶
Overview ¶
Package wireguard manages kernel and user-space Wireguard interfaces.
Index ¶
Constants ¶
View Source
const ( // PeerDownInterval is the time since last handshake when established peer is considered to be down. // // WG whitepaper defines a downed peer as being: // Handshake Timeout (180s) + Rekey Timeout (5s) + Rekey Attempt Timeout (90s) // // This interval is applied when the link is already established. PeerDownInterval = (180 + 5 + 90) * time.Second // LinkMTU is the suggested MTU of the link for Wireguard. // // Wireguard sets DF (Don't Fragment) bit on all packets, so the MTU of the link // should be so that with the overhead of the Wireguard header, the packet // is still smaller than the MTU of the link. // // To be on the safe side, we set the MTU to 1280, which is the minimum MTU // for IPv6. LinkMTU = 1280 // RecommendedPersistentKeepAliveInterval is the recommended interval for persistent keepalive. RecommendedPersistentKeepAliveInterval = 25 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func NetworkPrefix ¶
NetworkPrefix returns IPv6 prefix for the SideroLink.
Server is using the first address in the block. Nodes are using random addresses from the /64 space.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device manages Wireguard link.
func NewDevice ¶
func NewDevice(address netip.Prefix, privateKey wgtypes.Key, listenPort uint16, forceUserspace bool, logger *zap.Logger, ) (*Device, error)
NewDevice creates a new device with settings.
type PeerEvent ¶
type PeerEvent struct { PubKey wgtypes.Key Remove bool Endpoint string Address netip.Addr PersistentKeepAliveInterval *time.Duration }
PeerEvent is the event about peer state change.
type PeerSource ¶
type PeerSource interface {
EventCh() <-chan PeerEvent
}
PeerSource is the interface of the "database" providing SideroLink peer information.
Click to show internal directories.
Click to hide internal directories.