mirror of
https://github.com/status-im/status-go.git
synced 2025-01-24 21:49:54 +00:00
40359f9c1b
* Adding wakunode module * Adding wakuv2 fleet files * Add waku fleets to update-fleet-config script * Adding config items for waku v2 * Conditionally start waku v2 node depending on config * Adapting common code to use go-waku * Setting log level to info * update dependencies * update fleet config to use WakuNodes instead of BootNodes * send and receive messages * use hash returned when publishing a message * add waku store protocol * trigger signal after receiving store messages * exclude linting rule SA1019 to check deprecated packages
33 lines
939 B
Go
33 lines
939 B
Go
package autonat
|
|
|
|
import (
|
|
"context"
|
|
|
|
"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
|
|
// PublicAddr returns the public dial address when NAT status is public and an
|
|
// error otherwise
|
|
PublicAddr() (ma.Multiaddr, error)
|
|
}
|
|
|
|
// 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) (ma.Multiaddr, 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
|