NAT is an object that manages address port mappings in
NATs (Network Address Translators). It is a long-running
service that will periodically renew port mappings,
and keep an up-to-date list of all the external addresses. AddMapping attempts to construct a mapping on protocol and internal port.
It blocks until a mapping was established. Once added, it periodically renews the mapping.
May not succeed, and mappings may change over time;
NAT devices may not respect our port requests, and even lie. Close shuts down all port mappings. NAT can no longer be used.(*NAT) GetMapping(protocol string, port int) (addr netip.AddrPort, found bool) RemoveMapping removes a port mapping.
It blocks until the NAT has removed the mapping.
*NAT : github.com/prometheus/common/expfmt.Closer
*NAT : io.Closer
func DiscoverNAT(ctx context.Context) (*NAT, error)
Package-Level Functions (only one)
DiscoverNAT looks for a NAT device in the network and returns an object that can manage port mappings.
Package-Level Variables (only one)
ErrNoMapping signals no mapping exists for an address
Package-Level Constants (total 2)
CacheTime is the time a mapping will cache an external address for
MappingDuration is a default port mapping duration.
Port mappings are renewed every (MappingDuration / 3)
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.