Documentation
¶
Index ¶
- func Init(opts ...p2pConnmgr.Option) (*p2pConnmgr.BasicConnMgr, error)
- type ConnectionGater
- func (cg *ConnectionGater) InterceptAccept(conn network.ConnMultiaddrs) (allow bool)
- func (cg *ConnectionGater) InterceptAddrDial(p p2peer.ID, _ multiaddr.Multiaddr) (allow bool)
- func (cg *ConnectionGater) InterceptPeerDial(p p2peer.ID) (allow bool)
- func (cg *ConnectionGater) InterceptSecured(nd network.Direction, p p2peer.ID, _ network.ConnMultiaddrs) (allow bool)
- func (cg *ConnectionGater) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(opts ...p2pConnmgr.Option) (*p2pConnmgr.BasicConnMgr, error)
Types ¶
type ConnectionGater ¶ added in v0.3.0
type ConnectionGater struct { AllowAll bool ConnMgr *p2pConnmgr.BasicConnMgr }
ConnectionGater is a struct that implements the network.ConnectionGater interface.
func NewConnectionGater ¶ added in v0.3.0
func NewConnectionGater(connMgr *p2pConnmgr.BasicConnMgr) *ConnectionGater
New creates a new CustomConnectionGater instance.
func (*ConnectionGater) InterceptAccept ¶ added in v0.3.0
func (cg *ConnectionGater) InterceptAccept(conn network.ConnMultiaddrs) (allow bool)
InterceptAccept checks if an incoming connection from the specified network address should be allowed.
func (*ConnectionGater) InterceptAddrDial ¶ added in v0.3.0
func (cg *ConnectionGater) InterceptAddrDial(p p2peer.ID, _ multiaddr.Multiaddr) (allow bool)
func (*ConnectionGater) InterceptPeerDial ¶ added in v0.3.0
func (cg *ConnectionGater) InterceptPeerDial(p p2peer.ID) (allow bool)
InterceptPeerDial checks if we should allow dialing the specified peer.
func (*ConnectionGater) InterceptSecured ¶ added in v0.3.0
func (cg *ConnectionGater) InterceptSecured(nd network.Direction, p p2peer.ID, _ network.ConnMultiaddrs) (allow bool)
InterceptSecured, InterceptUpgraded, and other methods can be implemented as needed. For simplicity, they are set to allow all connections in this example.
func (*ConnectionGater) InterceptUpgraded ¶ added in v0.3.0
func (cg *ConnectionGater) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason)
Click to show internal directories.
Click to hide internal directories.