github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/connectionGater.go (about)

     1  package p2p
     2  
     3  import "github.com/libp2p/go-libp2p/core/connmgr"
     4  
     5  // ConnectionGater the customized interface for the connection gater in the p2p package.
     6  // It acts as a wrapper around the libp2p connmgr.ConnectionGater interface and adds some custom methods.
     7  type ConnectionGater interface {
     8  	connmgr.ConnectionGater
     9  
    10  	// SetDisallowListOracle sets the disallow list oracle for the connection gater.
    11  	// If one is set, the oracle is consulted upon every incoming or outgoing connection attempt, and
    12  	// the connection is only allowed if the remote peer is not on the disallow list.
    13  	// In Flow blockchain, it is not optional to dismiss the disallow list oracle, and if one is not set
    14  	// the connection gater will panic.
    15  	// Also, it follows a dependency injection pattern and does not allow to set the disallow list oracle more than once,
    16  	// any subsequent calls to this method will result in a panic.
    17  	// Args:
    18  	// 	oracle: the disallow list oracle to set.
    19  	// Returns:
    20  	// 	none
    21  	// Panics:
    22  	// 	if the disallow list oracle is already set.
    23  	SetDisallowListOracle(oracle DisallowListOracle)
    24  }