package nat

Import Path
	github.com/libp2p/go-libp2p/p2p/net/nat (on go.dev)

Dependency Relation
	imports 9 packages, and imported by one package

Involved Source Files nat.go
Package-Level Type Names (only one)
/* sort by: | */
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)