Documentation ¶
Index ¶
Constants ¶
const RECOMMENDED_MAPPING_LIFETIME_SECONDS = 3600
The recommended mapping lifetime for AddPortMapping.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddPortMappingResult ¶
type AddPortMappingResult struct { SecondsSinceStartOfEpoc uint32 InternalPort uint16 MappedExternalPort uint16 PortMappingLifetimeInSeconds uint32 }
Results of the NAT-PMP AddPortMapping operation
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a NAT-PMP protocol client.
func NewClient ¶
Create a NAT-PMP client for the NAT-PMP server at the gateway. Uses default timeout which is around 128 seconds.
func NewClientWithTimeout ¶ added in v1.0.2
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.
func (*Client) AddPortMapping ¶
func (n *Client) AddPortMapping(protocol string, internalPort, requestedExternalPort int, lifetime int) (result *AddPortMappingResult, err error)
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.
func (*Client) GetExternalAddress ¶
func (n *Client) GetExternalAddress() (result *GetExternalAddressResult, err error)
Get the external address of the router.
Note that this call can take up to 128 seconds to return.
type GetExternalAddressResult ¶
Results of the NAT-PMP GetExternalAddress operation.