Documentation
¶
Overview ¶
Package natmap provides optional NAT helpers (Phase 2b: UPnP IGD port mapping). TURN and other relays are out of scope until Phase 3+.
IPv6 note: UPnP IGD is an IPv4 NAT mechanism. Nodes with a globally routable IPv6 address are directly reachable without any port mapping and do not use this package. UPnP mapping is only attempted when the node's public address is obtained via STUN or natsense and the socket is behind an IPv4 NAT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalIPv4ForUPnP ¶
func LocalIPv4ForUPnP() string
LocalIPv4ForUPnP returns an IPv4 address suitable as IGD "internal client" (typically the LAN address used for outbound UDP).
func MapUDPPort ¶
func MapUDPPort(ctx context.Context, internalPort int, internalClient string) (externalIP string, externalPort int, cleanup func(), err error)
MapUDPPort asks the LAN IGD to forward UDP externalPort -> internalClient:internalPort using the same port number on the WAN side (required for predictable QUIC URLs). Returns cleanup (DeletePortMapping). Errors if no gateway or mapping is rejected.
Types ¶
This section is empty.