Documentation ¶
Index ¶
- Variables
- type ConnectionManager
- func (c *ConnectionManager) AddConnectionRequest(address string, isPermanent bool)
- func (c *ConnectionManager) Ban(netConnection *netadapter.NetConnection) error
- func (c *ConnectionManager) BanByIP(ip net.IP) error
- func (c *ConnectionManager) ConnectionCount() int
- func (c *ConnectionManager) IsBanned(netConnection *netadapter.NetConnection) (bool, error)
- func (c *ConnectionManager) RemoveConnection(address string)
- func (c *ConnectionManager) Start()
- func (c *ConnectionManager) Stop()
Constants ¶
This section is empty.
Variables ¶
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 *infraconfig.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