connmgr

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL