Documentation ¶
Overview ¶
Package packet provides implementations of packet handlers that transform WireGuard packets.
Index ¶
Constants ¶
View Source
const ( WireGuardMessageTypeHandshakeInitiation = 1 WireGuardMessageTypeHandshakeResponse = 2 WireGuardMessageTypeHandshakeCookieReply = 3 WireGuardMessageTypeData = 4 WireGuardMessageLengthHandshakeInitiation = 148 WireGuardMessageLengthHandshakeResponse = 92 WireGuardMessageLengthHandshakeCookieReply = 64 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { // Encrypt encrypts wgPacket and appends the result to dst, returning the updated slice. // // The remaining capacity of dst must not overlap wgPacket. Encrypt(dst, wgPacket []byte) ([]byte, error) // Decrypt decrypts swgpPacket and appends the result to dst, returning the updated slice. // // The remaining capacity of dst must not overlap swgpPacket. Decrypt(dst, swgpPacket []byte) ([]byte, error) // WithMaxPacketSize returns a new Handler with the given maximum packet size. WithMaxPacketSize(maxPacketSize int) Handler }
Handler encrypts WireGuard packets and decrypts swgp packets.
func NewParanoidHandler ¶
NewParanoidHandler creates a "paranoid" handler that uses the given PSK to encrypt and decrypt packets.
Click to show internal directories.
Click to hide internal directories.