BasicConnGater class

BasicConnGater is a simple implementation of the ConnGater interface that allows all connections by default but can be configured to block specific peers or addresses.

Implemented types

Constructors

BasicConnGater.new({int maxConnections = 1000, int maxConnectionsPerPeer = 10, Duration connectionTimeout = const Duration(minutes: 5)})
Creates a new BasicConnGater with the specified limits

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

blockAddr(MultiAddr addr) → void
BlockAddr blocks a specific multiaddress
blockConn(String connId) → void
BlockConn blocks a specific connection by its ID
blockPeer(PeerId peerId) → void
BlockPeer blocks a peer by its ID
blockSubnet(String subnet) → void
BlockSubnet blocks a subnet (CIDR notation)
close() → void
Closes the connection gater and cleans up resources
getConnectionMetrics(String connId) ConnectionMetrics?
Gets connection metrics
interceptAccept(Conn conn) bool
Tests whether an incipient inbound Conn is allowed.
override
interceptAddrDial(PeerId peerId, MultiAddr addr) bool
Tests whether we're permitted to dial the specified multiaddr for the given peer.
override
interceptPeerDial(PeerId peerId) bool
Tests whether we're permitted to Dial the specified peer.
override
interceptSecured(bool isInitiator, PeerId peerId, Conn conn) bool
Tests whether a given Conn, now authenticated, is allowed.
override
interceptUpgraded(Conn conn) → (bool, DisconnectReason?)
Tests whether a fully capable Conn is allowed.
override
isAddrBlocked(MultiAddr addr) bool
IsAddrBlocked returns whether an address is blocked
isAddrInBlockedSubnet(MultiAddr addr) bool
Checks if an address is in a blocked subnet
isConnBlocked(String connId) bool
IsConnBlocked returns whether a connection is blocked
isPeerBlocked(PeerId peerId) bool
IsPeerBlocked returns whether a peer is blocked
isSubnetBlocked(String subnet) bool
IsSubnetBlocked returns whether a subnet is blocked
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
unblockAddr(MultiAddr addr) → void
UnblockAddr unblocks a previously blocked address
unblockConn(String connId) → void
UnblockConn unblocks a previously blocked connection
unblockPeer(PeerId peerId) → void
UnblockPeer unblocks a previously blocked peer
unblockSubnet(String subnet) → void
UnblockSubnet unblocks a previously blocked subnet
updateConnectionMetrics(String connId, {int? bytesIn, int? bytesOut}) → void
Updates connection metrics

Operators

operator ==(Object other) bool
The equality operator.
inherited