github.com/koko1123/flow-go-1@v0.29.6/network/p2p/connector.go (about) 1 package p2p 2 3 import ( 4 "context" 5 6 "github.com/libp2p/go-libp2p/core/peer" 7 ) 8 9 // Connector connects to peer and disconnects from peer using the underlying networking library 10 type Connector interface { 11 // UpdatePeers connects to the given peer.IDs. It also disconnects from any other peers with which it may have 12 // previously established connection. 13 // UpdatePeers implementation should be idempotent such that multiple calls to connect to the same peer should not 14 // create multiple connections 15 UpdatePeers(ctx context.Context, peerIDs peer.IDSlice) 16 } 17 18 type PeerFilter func(peer.ID) error 19 20 // AllowAllPeerFilter returns a peer filter that does not do any filtering. 21 func AllowAllPeerFilter() PeerFilter { 22 return func(p peer.ID) error { 23 return nil 24 } 25 }