status-go/vendor/github.com/libp2p/go-libp2p/p2p/host/autonat/interface.go

32 lines
804 B
Go
Raw Normal View History

package autonat
import (
"context"
2022-04-01 16:16:46 +00:00
"io"
2022-11-04 13:57:20 +00:00
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/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
2022-04-01 16:16:46 +00:00
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.
2023-05-19 20:23:55 +00:00
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