Versions in this module Expand all Collapse all v0 v0.0.20241020 Oct 20, 2024 v0.0.20240223 Feb 23, 2024 Changes in this version + const CookieRefreshTime + const DefaultMTU + const HandshakeInitationRate + const IPv4offsetDst + const IPv4offsetSrc + const IPv4offsetTotalLength + const IPv6offsetDst + const IPv6offsetPayloadLength + const IPv6offsetSrc + const KeepaliveTimeout + const LogLevelError + const LogLevelSilent + const LogLevelVerbose + const MaxContentSize + const MaxMessageSize + const MaxPeers + const MaxSegmentSize + const MaxTimerHandshakes + const MessageCookieReplySize + const MessageCookieReplyType + const MessageHandshakeSize + const MessageInitiationSize + const MessageInitiationType + const MessageKeepaliveSize + const MessageResponseSize + const MessageResponseType + const MessageTransportHeaderSize + const MessageTransportOffsetContent + const MessageTransportOffsetCounter + const MessageTransportOffsetReceiver + const MessageTransportSize + const MessageTransportType + const MinMessageSize + const NoiseConstruction + const NoisePresharedKeySize + const NoisePrivateKeySize + const NoisePublicKeySize + const PaddingMultiple + const PreallocatedBuffersPerPool + const QueueHandshakeSize + const QueueInboundSize + const QueueOutboundSize + const QueueStagedSize + const RejectAfterMessages + const RejectAfterTime + const RekeyAfterMessages + const RekeyAfterTime + const RekeyAttemptTime + const RekeyTimeout + const RekeyTimeoutJitterMaxMs + const UnderLoadAfterTime + const WGIdentifier + const WGLabelCookie + const WGLabelMAC1 + var InitialChainKey [blake2s.Size]byte + var InitialHash [blake2s.Size]byte + var ZeroNonce [chacha20poly1305.NonceSize]byte + func DiscardLogf(format string, args ...any) + func HMAC1(sum *[blake2s.Size]byte, key, in0 []byte) + func HMAC2(sum *[blake2s.Size]byte, key, in0, in1 []byte) + func KDF1(t0 *[blake2s.Size]byte, key, input []byte) + func KDF2(t0, t1 *[blake2s.Size]byte, key, input []byte) + func KDF3(t0, t1, t2 *[blake2s.Size]byte, key, input []byte) + type AllowedIPs struct + IPv4 *trieEntry + IPv6 *trieEntry + func (table *AllowedIPs) EntriesForPeer(peer *Peer, cb func(prefix netip.Prefix) bool) + func (table *AllowedIPs) Insert(prefix netip.Prefix, peer *Peer) + func (table *AllowedIPs) Lookup(ip []byte) *Peer + func (table *AllowedIPs) RemoveByPeer(peer *Peer) + type CookieChecker struct + func (st *CookieChecker) CheckMAC1(msg []byte) bool + func (st *CookieChecker) CheckMAC2(msg, src []byte) bool + func (st *CookieChecker) CreateReply(msg []byte, recv uint32, src []byte) (*MessageCookieReply, error) + func (st *CookieChecker) Init(pk NoisePublicKey) + type CookieGenerator struct + func (st *CookieGenerator) AddMacs(msg []byte) + func (st *CookieGenerator) ConsumeReply(msg *MessageCookieReply) bool + func (st *CookieGenerator) Init(pk NoisePublicKey) + type Device struct + func NewDevice(tunDevice tun.Device, bind conn.Bind, logger *Logger) *Device + func (device *Device) BatchSize() int + func (device *Device) Bind() conn.Bind + func (device *Device) BindClose() error + func (device *Device) BindSetMark(mark uint32) error + func (device *Device) BindUpdate() error + func (device *Device) Close() + func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer + func (device *Device) ConsumeMessageResponse(msg *MessageResponse) *Peer + func (device *Device) CreateMessageInitiation(peer *Peer) (*MessageInitiation, error) + func (device *Device) CreateMessageResponse(peer *Peer) (*MessageResponse, error) + func (device *Device) DeleteKeypair(key *Keypair) + func (device *Device) DisableSomeRoamingForBrokenMobileSemantics() + func (device *Device) Down() error + func (device *Device) GetInboundElement() *QueueInboundElement + func (device *Device) GetInboundElementsContainer() *QueueInboundElementsContainer + func (device *Device) GetMessageBuffer() *[MaxMessageSize]byte + func (device *Device) GetOutboundElement() *QueueOutboundElement + func (device *Device) GetOutboundElementsContainer() *QueueOutboundElementsContainer + func (device *Device) IpcGet() (string, error) + func (device *Device) IpcGetOperation(w io.Writer) error + func (device *Device) IpcHandle(socket net.Conn) + func (device *Device) IpcSet(uapiConf string) error + func (device *Device) IpcSetOperation(r io.Reader) (err error) + func (device *Device) IsUnderLoad() bool + func (device *Device) LookupPeer(pk NoisePublicKey) *Peer + func (device *Device) NewOutboundElement() *QueueOutboundElement + func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) + func (device *Device) PopulatePools() + func (device *Device) PutInboundElement(elem *QueueInboundElement) + func (device *Device) PutInboundElementsContainer(c *QueueInboundElementsContainer) + func (device *Device) PutMessageBuffer(msg *[MaxMessageSize]byte) + func (device *Device) PutOutboundElement(elem *QueueOutboundElement) + func (device *Device) PutOutboundElementsContainer(c *QueueOutboundElementsContainer) + func (device *Device) RemoveAllPeers() + func (device *Device) RemovePeer(key NoisePublicKey) + func (device *Device) RoutineDecryption(id int) + func (device *Device) RoutineEncryption(id int) + func (device *Device) RoutineHandshake(id int) + func (device *Device) RoutineReadFromTUN() + func (device *Device) RoutineReceiveIncoming(maxBatchSize int, recv conn.ReceiveFunc) + func (device *Device) RoutineTUNEventReader() + func (device *Device) SendHandshakeCookie(initiatingElem *QueueHandshakeElement) error + func (device *Device) SendKeepalivesToPeersWithCurrentKeypair() + func (device *Device) SetPrivateKey(sk NoisePrivateKey) error + func (device *Device) Up() error + func (device *Device) Wait() chan struct{} + type Handshake struct + func (h *Handshake) Clear() + type IPCError struct + func (s IPCError) Error() string + func (s IPCError) ErrorCode() int64 + func (s IPCError) Unwrap() error + type IndexTable struct + func (table *IndexTable) Delete(index uint32) + func (table *IndexTable) Init() + func (table *IndexTable) Lookup(id uint32) IndexTableEntry + func (table *IndexTable) NewIndexForHandshake(peer *Peer, handshake *Handshake) (uint32, error) + func (table *IndexTable) SwapIndexForKeypair(index uint32, keypair *Keypair) + type IndexTableEntry struct + type Keypair struct + type Keypairs struct + func (kp *Keypairs) Current() *Keypair + type Logger struct + Errorf func(format string, args ...any) + Verbosef func(format string, args ...any) + func NewLogger(level int, prepend string) *Logger + type MessageCookieReply struct + Cookie [blake2s.Size128 + poly1305.TagSize]byte + Nonce [chacha20poly1305.NonceSizeX]byte + Receiver uint32 + Type uint32 + type MessageInitiation struct + Ephemeral NoisePublicKey + MAC1 [blake2s.Size128]byte + MAC2 [blake2s.Size128]byte + Sender uint32 + Static [NoisePublicKeySize + poly1305.TagSize]byte + Timestamp [tai64n.TimestampSize + poly1305.TagSize]byte + Type uint32 + type MessageResponse struct + Empty [poly1305.TagSize]byte + Ephemeral NoisePublicKey + MAC1 [blake2s.Size128]byte + MAC2 [blake2s.Size128]byte + Receiver uint32 + Sender uint32 + Type uint32 + type MessageTransport struct + Content []byte + Counter uint64 + Receiver uint32 + Type uint32 + type NoiseNonce uint64 + type NoisePresharedKey [NoisePresharedKeySize]byte + func (key *NoisePresharedKey) FromHex(src string) error + type NoisePrivateKey [NoisePrivateKeySize]byte + func (key *NoisePrivateKey) FromHex(src string) (err error) + func (key *NoisePrivateKey) FromMaybeZeroHex(src string) (err error) + func (key NoisePrivateKey) Equals(tar NoisePrivateKey) bool + func (key NoisePrivateKey) IsZero() bool + type NoisePublicKey [NoisePublicKeySize]byte + func (key *NoisePublicKey) FromHex(src string) error + func (key NoisePublicKey) Equals(tar NoisePublicKey) bool + func (key NoisePublicKey) IsZero() bool + type Peer struct + func (peer *Peer) BeginSymmetricSession() error + func (peer *Peer) ExpireCurrentKeypairs() + func (peer *Peer) FlushStagedPackets() + func (peer *Peer) NewTimer(expirationFunction func(*Peer)) *Timer + func (peer *Peer) ReceivedWithKeypair(receivedKeypair *Keypair) bool + func (peer *Peer) RoutineSequentialReceiver(maxBatchSize int) + func (peer *Peer) RoutineSequentialSender(maxBatchSize int) + func (peer *Peer) SendBuffers(buffers [][]byte) error + func (peer *Peer) SendHandshakeInitiation(isRetry bool) error + func (peer *Peer) SendHandshakeResponse() error + func (peer *Peer) SendKeepalive() + func (peer *Peer) SendStagedPackets() + func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) + func (peer *Peer) StagePackets(elems *QueueOutboundElementsContainer) + func (peer *Peer) Start() + func (peer *Peer) Stop() + func (peer *Peer) String() string + func (peer *Peer) ZeroAndFlushAll() + type QueueHandshakeElement struct + type QueueInboundElement struct + type QueueInboundElementsContainer struct + type QueueOutboundElement struct + type QueueOutboundElementsContainer struct + type Timer struct + func (timer *Timer) Del() + func (timer *Timer) DelSync() + func (timer *Timer) IsPending() bool + func (timer *Timer) Mod(d time.Duration) + type WaitPool struct + func NewWaitPool(max uint32, new func() any) *WaitPool + func (p *WaitPool) Get() any + func (p *WaitPool) Put(x any)