package autonatv2
Import Path
github.com/libp2p/go-libp2p/p2p/protocol/autonatv2 (on go.dev)
Dependency Relation
imports 27 packages, and imported by 2 packages
Package-Level Type Names (total 6)
AutoNAT implements the AutoNAT v2 client and server.
Users can check reachability for their addresses using the CheckReachability method.
The server provides amplification attack prevention and rate limiting.
(*AutoNAT) Close()
GetReachability makes a single dial request for checking reachability for requested addresses
(*AutoNAT) Start(h host.Host) error
func New(dialerHost host.Host, opts ...AutoNATOption) (*AutoNAT, error)
func WithMetricsTracer(m MetricsTracer) AutoNATOption
func WithServerRateLimit(rpm, perPeerRPM, dialDataRPM int, maxConcurrentRequestsPerPeer int) AutoNATOption
func New(dialerHost host.Host, opts ...AutoNATOption) (*AutoNAT, error)
DialDataRequired bool
DialStatus pb.DialStatus
DialedAddr ma.Multiaddr
Error error
ResponseStatus pb.DialResponse_ResponseStatus
func MetricsTracer.CompletedRequest(EventDialRequestCompleted)
( MetricsTracer) ClientCompletedRequest([]Request, Result, error)
( MetricsTracer) CompletedRequest(EventDialRequestCompleted)
func NewMetricsTracer(reg prometheus.Registerer) MetricsTracer
func WithMetricsTracer(m MetricsTracer) AutoNATOption
Request is the request to verify reachability of a single address
Addr is the multiaddr to verify
SendDialData indicates whether to send dial data if the server requests it for Addr
func (*AutoNAT).GetReachability(ctx context.Context, reqs []Request) (Result, error)
func MetricsTracer.ClientCompletedRequest([]Request, Result, error)
Result is the result of the CheckReachability call
Addr is the dialed address
AllAddrsRefused is true when the server refused to dial all the addresses in the request.
Idx is the index of the address that was dialed
Reachability is the reachability for `Addr`
func (*AutoNAT).GetReachability(ctx context.Context, reqs []Request) (Result, error)
func MetricsTracer.ClientCompletedRequest([]Request, Result, error)
Package-Level Functions (total 4)
New returns a new AutoNAT instance.
host and dialerHost should have the same dialing capabilities. In case the host doesn't support
a transport, dial back requests for address for that transport will be ignored.
func NewMetricsTracer(reg prometheus.Registerer) MetricsTracer func WithServerRateLimit(rpm, perPeerRPM, dialDataRPM int, maxConcurrentRequestsPerPeer int) AutoNATOption
Package-Level Variables (total 2)
ErrNoPeers is returned when the client knows no autonatv2 servers.
ErrPrivateAddrs is returned when the request has private IP addresses.
Package-Level Constants (total 3)
const DialBackProtocol = "/libp2p/autonat/2/dial-back" const DialProtocol = "/libp2p/autonat/2/dial-request" const ServiceName = "libp2p.autonatv2"![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |