package natpmp
Import Path
github.com/jackpal/go-nat-pmp (on go.dev)
Dependency Relation
imports 3 packages, and imported by one package
Package-Level Type Names (total 3)
Results of the NAT-PMP AddPortMapping operation
InternalPort uint16
MappedExternalPort uint16
PortMappingLifetimeInSeconds uint32
SecondsSinceStartOfEpoc uint32
func (*Client).AddPortMapping(protocol string, internalPort, requestedExternalPort int, lifetime int) (result *AddPortMappingResult, err error)
Client is a NAT-PMP protocol client.
Add (or delete) a port mapping. To delete a mapping, set the requestedExternalPort and lifetime to 0.
Note that this call can take up to 128 seconds to return.
Get the external address of the router.
Note that this call can take up to 128 seconds to return.
func NewClient(gateway net.IP) (nat *Client)
func NewClientWithTimeout(gateway net.IP, timeout time.Duration) (nat *Client)
Results of the NAT-PMP GetExternalAddress operation.
ExternalIPAddress [4]byte
SecondsSinceStartOfEpoc uint32
func (*Client).GetExternalAddress() (result *GetExternalAddressResult, err error)
Package-Level Functions (total 2)
Create a NAT-PMP client for the NAT-PMP server at the gateway.
Uses default timeout which is around 128 seconds.
Create a NAT-PMP client for the NAT-PMP server at the gateway, with a timeout.
Timeout defines the total amount of time we will keep retrying before giving up.
Package-Level Constants (only one)
The recommended mapping lifetime for AddPortMapping.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |