forked from libp2p/go-libp2p
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
31 lines (24 loc) · 808 Bytes
/
interface.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
package autonat
import (
"context"
"io"
"github.com/zbliujia/go-libp2p/core/network"
"github.com/zbliujia/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"
)
// AutoNAT is the interface for NAT autodiscovery
type AutoNAT interface {
// Status returns the current NAT status
Status() network.Reachability
io.Closer
}
// Client is a stateless client interface to AutoNAT peers
type Client interface {
// DialBack requests from a peer providing AutoNAT services to test dial back
// and report the address on a successful connection.
DialBack(ctx context.Context, p peer.ID) error
}
// AddrFunc is a function returning the candidate addresses for the local host.
type AddrFunc func() []ma.Multiaddr
// Option is an Autonat option for configuration
type Option func(*config) error