Documentation ¶
Overview ¶
Package nattraversal provides tools for acquiring ports on a Network Address Translator (NAT).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquirePortFromGateway ¶
func AcquirePortFromGateway(gateway UPNPGateway, port uint16) error
AcquirePortFromGateway sets up UDP and TCP forwarding rules for the given port on the given gateway.
func GetExternalIP ¶
GetExternalIP returns a string formatted external IP address from a UPnP-enabled NAT on the network, if such device is discovered.
Types ¶
type UPNPGateway ¶
UPNPGateway is the interface of a UPnP gateway. It supports forwarding a port and clearing a forwarding rule.
func DiscoverUPNPGateway ¶
func DiscoverUPNPGateway() (UPNPGateway, error)
DiscoverUPNPGateway returns a UPNPGateway if one is found on the network. This process is long - about 30 seconds and is expected to fail in some network setups.
Directories ¶
Path | Synopsis |
---|---|
Package upnp provides a simple and opinionated interface to UPnP-enabled routers, allowing users to forward ports and discover their external IP address.
|
Package upnp provides a simple and opinionated interface to UPnP-enabled routers, allowing users to forward ports and discover their external IP address. |
Click to show internal directories.
Click to hide internal directories.