package
0.0.0-20230915214220-1d4be15ce5bb
Repository: https://github.com/malcolmseyd/natpunch-go.git
Documentation: pkg.go.dev

# Functions

ApplyBPF constructs a BPF program and applies it to the RawConn.
GetClientIP gets source ip address that will be used when sending data to dstIP.
Handshake performs a Noise-IK handshake with the Server.
HostToAddr resolves a hostname, whether DNS or IP to a valid net.IPAddr.
MakePacket constructs a request packet to send to the server.
ParseResponse takes a response packet and parses it into an IP and port.
RecvDataPacket recieves a UDP packet from server.
RecvPacket recieves a UDP packet from server.
SendDataPacket encrypts and sends packet to the Server.
SendPacket sends packet to the Server.
SetupRawConn creates an ipv4 and udp only RawConn and applies packet filtering.

# Constants

EmptyUDPSize is the size of an empty UDP packet.
PacketData identifies regular data packets.
PacketHandshakeInit identifies handhshake initiation packets.
PacketHandshakeResp identifies handhshake response packets.

# Variables

ErrNonce is returned when the nonce on a packet isn't valid.
ErrPacketType is returned when an unexepcted packet type is enountered.
RekeyDuration is the time after which keys are invalid and a new handshake is required.

# Structs

Peer stores data about a peer's key and endpoint, whether it's another peer or the client While Resolved == false, we consider IP and Port to be uninitialized I could have done a nested struct with Endpoint containing IP and Port but that's unnecessary right now.
Server stores data relating to the server.

# Type aliases

Key stores a 32 byte representation of a Wireguard key.