natpmp

package
v1.80.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package natpmp provides an implementation of NAT-PMP. See https://tools.ietf.org/html/rfc6886

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExternalAddress

func ExternalAddress() (net.IP, error)

ExternalAddress returns the external address the internet sees you as having.

func MapTCP

func MapTCP(port int, notifyChan chan any) (int, error)

MapTCP maps the specified TCP port for external access. It returns the port on the external address that can be used to connect to the internal port. If you wish to be notified of changes to the external port mapping, provide a notify channel. It will be sent an int containing the updated external port mapping when it changes or an error if a renewal fails. The channel will only be sent to if it is ready.

func MapUDP

func MapUDP(port int, notifyChan chan any) (int, error)

MapUDP maps the specified UDP port for external access. It returns the port on the external address that can be used to connect to the internal port. If you wish to be notified of changes to the external port mapping, provide a notify channel. It will be sent an int containing the updated external port mapping when it changes or an error if a renewal fails. The channel will only be sent to if it is ready.

func UnmapTCP

func UnmapTCP(port int) error

UnmapTCP unmaps a previously mapped internal TCP port.

func UnmapUDP

func UnmapUDP(port int) error

UnmapUDP unmaps a previously mapped internal UDP port.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL