Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMultipleNAT is an error returned when multiple NATs have been // detected. ErrMultipleNAT = errors.New("multiple NATs detected") )
Functions ¶
This section is empty.
Types ¶
type PMP ¶
type PMP struct {
// contains filtered or unexported fields
}
PMP is a concrete implementation of the Traversal interface that uses the NAT-PMP technique.
func DiscoverPMP ¶
DiscoverPMP attempts to scan the local network for a NAT-PMP enabled device within the given timeout.
func (*PMP) AddPortMapping ¶
AddPortMapping enables port forwarding for the given port.
func (*PMP) DeletePortMapping ¶
DeletePortMapping disables port forwarding for the given port.
func (*PMP) ExternalIP ¶
ExternalIP returns the external IP address of the NAT-PMP enabled device.
func (*PMP) ForwardedPorts ¶
ForwardedPorts returns a list of ports currently being forwarded.
type Traversal ¶
type Traversal interface { // ExternalIP returns the external IP address. ExternalIP() (net.IP, error) // AddPortMapping adds a port mapping for the given port between the // private and public addresses. AddPortMapping(port uint16) error // DeletePortMapping deletes a port mapping for the given port between // the private and public addresses. DeletePortMapping(port uint16) error // ForwardedPorts returns the ports currently being forwarded using NAT // traversal. ForwardedPorts() []uint16 // Name returns the name of the specific NAT traversal technique used. Name() string }
Traversal is an interface that brings together the different NAT traversal techniques.
type UPnP ¶
type UPnP struct {
// contains filtered or unexported fields
}
UPnP is a concrete implementation of the Traversal interface that uses the UPnP technique.
func DiscoverUPnP ¶
DiscoverUPnP scans the local network for a UPnP enabled device.
func (*UPnP) AddPortMapping ¶
AddPortMapping enables port forwarding for the given port.
func (*UPnP) DeletePortMapping ¶
DeletePortMapping disables port forwarding for the given port.
func (*UPnP) ExternalIP ¶
ExternalIP returns the external IP address of the UPnP enabled device.
func (*UPnP) ForwardedPorts ¶
ForwardedPorts returns a list of ports currently being forwarded.