Documentation
¶
Overview ¶
Package portmap implements port mapping using NAT-PMP or uPNP.
Index ¶
Constants ¶
View Source
const ( NATPMP = 1 UPNP = 2 All = NATPMP | UPNP )
Variables ¶
This section is empty.
Functions ¶
func Map ¶
func Map(ctx context.Context, label string, internal uint16, kind int, f func(proto string, status Status, err error)) error
Map runs a portmapping loop for both TCP and UDP. The kind parameter indicates the portmapping protocols to attempt.
The label is passed to the UPNP server (it is not used with NAT-PMP) and may be displayed in the router's user interface.
The callback function is called whenever a mapping is established or changes, or when an error occurs; it may be nil.
Types ¶
type WANIPConnection ¶
type WANIPConnection interface { GetSpecificPortMappingEntryCtx( context.Context, string, uint16, string, ) (uint16, string, bool, string, uint32, error) AddPortMappingCtx( context.Context, string, uint16, string, uint16, string, bool, string, uint32, ) error DeletePortMappingCtx(context.Context, string, uint16, string) error }
Click to show internal directories.
Click to hide internal directories.