github.com/koko1123/flow-go-1@v0.29.6/network/p2p/connectionGater.go (about)

     1  package p2p
     2  
     3  import (
     4  	"github.com/libp2p/go-libp2p/core/control"
     5  	"github.com/libp2p/go-libp2p/core/network"
     6  	"github.com/libp2p/go-libp2p/core/peer"
     7  	"github.com/multiformats/go-multiaddr"
     8  )
     9  
    10  // ConnectionGater is a copy of the libp2p ConnectionGater interface:
    11  // https://github.com/libp2p/go-libp2p/blob/master/core/connmgr/gater.go#L54
    12  // We use it here to generate a mock for testing through testify mock.
    13  type ConnectionGater interface {
    14  	InterceptPeerDial(p peer.ID) (allow bool)
    15  
    16  	InterceptAddrDial(peer.ID, multiaddr.Multiaddr) (allow bool)
    17  
    18  	InterceptAccept(network.ConnMultiaddrs) (allow bool)
    19  
    20  	InterceptSecured(network.Direction, peer.ID, network.ConnMultiaddrs) (allow bool)
    21  
    22  	InterceptUpgraded(network.Conn) (allow bool, reason control.DisconnectReason)
    23  }