This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathnat.go
36 lines (29 loc) · 1.37 KB
/
nat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/p2p/net/nat.
package nat
import (
"context"
"time"
"github.com/libp2p/go-libp2p/p2p/net/nat"
)
// ErrNoMapping signals no mapping exists for an address
// Deprecated: use github.com/libp2p/go-libp2p/p2p/net/nat.ErrNoMapping instead.
var ErrNoMapping = nat.ErrNoMapping
// MappingDuration is a default port mapping duration.
// Port mappings are renewed every (MappingDuration / 3)
// Deprecated: use github.com/libp2p/go-libp2p/p2p/net/nat.MappingDuration instead.
const MappingDuration = time.Second * 60
// CacheTime is the time a mapping will cache an external address for
// Deprecated: use github.com/libp2p/go-libp2p/p2p/net/nat.CacheTime instead.
const CacheTime = time.Second * 15
// DiscoverNAT looks for a NAT device in the network and
// returns an object that can manage port mappings.
// Deprecated: use github.com/libp2p/go-libp2p/p2p/net/nat.DiscoverNat instead.
func DiscoverNAT(ctx context.Context) (*NAT, error) {
return nat.DiscoverNAT(ctx)
}
// 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.
// Deprecated: use github.com/libp2p/go-libp2p/p2p/net/nat.Nat instead.
type NAT = nat.NAT