Documentation ¶
Overview ¶
This package is not thread safe. All calls to it should happen from a single thread or goroutine or be synchronised by some other mechanism
Index ¶
Constants ¶
const ( UDP protocol = 1 TCP protocol = 2 )
Values to pass to sendnewportmappingrequest()
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NATPMP ¶
type NATPMP struct {
// contains filtered or unexported fields
}
func NewNATPMP ¶
Initialize a natpmp_t object.
The gateway is detected automaticaly. Equivalent to `NewNATPMPWithGW(0)`
func NewNATPMPWithGW ¶
Initialize a natpmp_t object.
The gateway is not detected automaticaly and the passed gateway address is used unless forcedgw == 0
func (NATPMP) SendNewPortMappingRequest ¶
func (self NATPMP) SendNewPortMappingRequest(protocol protocol, privateport, publicport uint16, lifetimeInSeconds uint32) <-chan NewPortMappingResponse
Send a new port mapping NAT-PMP request to the network gateway
Arguments : protocol is either golibnatpmp.TCP or golibnatpmp.UDP, lifetime is in seconds.
To remove a port mapping, set lifetime to zero.
To remove all port mappings to the host, set lifetime and both ports to zero.
func (NATPMP) SendPublicAddressRequest ¶
func (self NATPMP) SendPublicAddressRequest() <-chan PublicAddressResponse
Send a public address NAT-PMP request to the network gateway
type NewPortMappingResponse ¶
type NewPortMappingResponse struct { PrivatePort uint16 MappedPublicPort uint16 LifetimeInSeconds uint32 Err error }
This struct's fields may only be considered valid if Err is nil
type PublicAddressResponse ¶
IP is only valid if Err is nil