Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

holepunch: add multiaddress filter #1839

Merged
merged 7 commits into from
Nov 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
incorporate PR feedback
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
  • Loading branch information
dennis-tra and marten-seemann committed Nov 4, 2022
commit b9e0bece54fff2f0ba34bccc01bdbedbe13145f5
10 changes: 4 additions & 6 deletions p2p/protocol/holepunch/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
ma "github.com/multiformats/go-multiaddr"
)

// WithAddrFilter is a Service option that enables multi address filtering.
// It allows to only allow a subset of observed addresses to the remote
// 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.
Expand All @@ -19,12 +19,10 @@ func WithAddrFilter(maf AddrFilter) Option {
}

// AddrFilter defines the interface for the multi address filtering.
// - FilterLocal is a function that filters the multi addresses that
// we send to the remote peer.
// - FilterRemote is a function that filters the multi addresses which
// we received from the remote peer.
type AddrFilter interface {
// FilterLocal is a function that filters the multi addresses that we send to the remote peer.
dennis-tra marked this conversation as resolved.
Show resolved Hide resolved
FilterLocal(remoteID peer.ID, maddrs []ma.Multiaddr) []ma.Multiaddr
// FilterRemote is a function that filters the multi addresses which we received from the remote peer.
dennis-tra marked this conversation as resolved.
Show resolved Hide resolved
FilterRemote(remoteID peer.ID, maddrs []ma.Multiaddr) []ma.Multiaddr
}

Expand Down