Source File
filter.go
Belonging Package
github.com/libp2p/go-libp2p/p2p/protocol/holepunch
package holepunchimport (ma)// WithAddrFilter is a Service option that enables multiaddress filtering.// It allows to only send a subset of observed addresses to the remote// peer. E.g., only announce TCP or QUIC multi addresses instead of both.// It also allows to only consider a subset of received multi addresses// that remote peers announced to us.// Theoretically, this API also allows to add multi addresses in both cases.func ( AddrFilter) Option {return func( *Service) error {.filter =return nil}}// AddrFilter defines the interface for the multi address filtering.type AddrFilter interface {// FilterLocal filters the multi addresses that are sent to the remote peer.FilterLocal(remoteID peer.ID, maddrs []ma.Multiaddr) []ma.Multiaddr// FilterRemote filters the multi addresses received from the remote peer.FilterRemote(remoteID peer.ID, maddrs []ma.Multiaddr) []ma.Multiaddr}
![]() |
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. |