connmanager

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: ISC Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotBanPermanent = errors.New("ErrCannotBanPermanent")

ErrCannotBanPermanent is the error returned when trying to ban a permanent peer.

Functions

This section is empty.

Types

type ConnectionManager

type ConnectionManager struct {
	// contains filtered or unexported fields
}

ConnectionManager monitors that the current active connections satisfy the requirements of outgoing, requested and incoming connections

func New

func New(cfg *config.Config, netAdapter *netadapter.NetAdapter, addressManager *addressmanager.AddressManager) (*ConnectionManager, error)

New instantiates a new instance of a ConnectionManager

func (*ConnectionManager) AddConnectionRequest

func (c *ConnectionManager) AddConnectionRequest(address string, isPermanent bool)

AddConnectionRequest adds the given address to list of pending connection requests

func (*ConnectionManager) Ban

func (c *ConnectionManager) Ban(netConnection *netadapter.NetConnection) error

Ban marks the given netConnection as banned

func (*ConnectionManager) BanByIP

func (c *ConnectionManager) BanByIP(ip net.IP) error

BanByIP bans the given IP and disconnects from all the connection with that IP.

func (*ConnectionManager) ConnectionCount

func (c *ConnectionManager) ConnectionCount() int

ConnectionCount returns the count of the connected connections

func (*ConnectionManager) IsBanned

func (c *ConnectionManager) IsBanned(netConnection *netadapter.NetConnection) (bool, error)

IsBanned returns whether the given netConnection is banned

func (*ConnectionManager) RemoveConnection

func (c *ConnectionManager) RemoveConnection(address string)

RemoveConnection disconnects the connection for the given address and removes it entirely from the connection manager.

func (*ConnectionManager) Start

func (c *ConnectionManager) Start()

Start begins the operation of the ConnectionManager

func (*ConnectionManager) Stop

func (c *ConnectionManager) Stop()

Stop halts the operation of the ConnectionManager

Jump to

Keyboard shortcuts

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