Documentation ¶
Index ¶
Constants ¶
const CacheTime = 15 * time.Second
CacheTime is the time a mapping will cache an external address for
const MappingDuration = time.Minute
MappingDuration is a default port mapping duration. Port mappings are renewed every (MappingDuration / 3)
Variables ¶
var ErrNoMapping = errors.New("mapping not established")
ErrNoMapping signals no mapping exists for an address
Functions ¶
This section is empty.
Types ¶
type NAT ¶
type NAT struct {
// contains filtered or unexported fields
}
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.
func DiscoverNAT ¶
DiscoverNAT looks for a NAT device in the network and returns an object that can manage port mappings.
func (*NAT) AddMapping ¶ added in v0.28.0
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.