Documentation ¶
Index ¶
- Variables
- func NewLibp2pConnectionMonitorSimple(reconnecter p2p.Reconnecter, thresholdMinConnectedPeers uint32, ...) (*libp2pConnectionMonitorSimple, error)
- type NilConnectionMonitor
- func (n *NilConnectionMonitor) Close() error
- func (n *NilConnectionMonitor) ClosedStream(network.Network, network.Stream)
- func (n *NilConnectionMonitor) Connected(network.Network, network.Conn)
- func (n *NilConnectionMonitor) Disconnected(network.Network, network.Conn)
- func (n *NilConnectionMonitor) IsConnectedToTheNetwork(netw network.Network) bool
- func (n *NilConnectionMonitor) IsInterfaceNil() bool
- func (n *NilConnectionMonitor) Listen(network.Network, multiaddr.Multiaddr)
- func (n *NilConnectionMonitor) ListenClose(network.Network, multiaddr.Multiaddr)
- func (n *NilConnectionMonitor) OpenedStream(network.Network, network.Stream)
- func (n *NilConnectionMonitor) SetThresholdMinConnectedPeers(thresholdMinConnectedPeers int, _ network.Network)
- func (n *NilConnectionMonitor) ThresholdMinConnectedPeers() int
- type Sharder
Constants ¶
This section is empty.
Variables ¶
var DurationBetweenReconnectAttempts = time.Second * 5
DurationBetweenReconnectAttempts is used as to not call reconnecter.ReconnectToNetwork() too often when there are a lot of peers disconnecting and reconnection to initial nodes succeeds
Functions ¶
func NewLibp2pConnectionMonitorSimple ¶
func NewLibp2pConnectionMonitorSimple( reconnecter p2p.Reconnecter, thresholdMinConnectedPeers uint32, sharder Sharder, ) (*libp2pConnectionMonitorSimple, error)
NewLibp2pConnectionMonitorSimple creates a new connection monitor (version 2 that is more streamlined and does not care about pausing and resuming the discovery process)
Types ¶
type NilConnectionMonitor ¶
type NilConnectionMonitor struct {
// contains filtered or unexported fields
}
NilConnectionMonitor does not monitor the connections made by the host
func (*NilConnectionMonitor) Close ¶ added in v1.2.0
func (n *NilConnectionMonitor) Close() error
Close returns nil
func (*NilConnectionMonitor) ClosedStream ¶
func (n *NilConnectionMonitor) ClosedStream(network.Network, network.Stream)
ClosedStream is called when a stream closed
func (*NilConnectionMonitor) Connected ¶
func (n *NilConnectionMonitor) Connected(network.Network, network.Conn)
Connected is called when a connection opened
func (*NilConnectionMonitor) Disconnected ¶
func (n *NilConnectionMonitor) Disconnected(network.Network, network.Conn)
Disconnected is called when a connection closed
func (*NilConnectionMonitor) IsConnectedToTheNetwork ¶
func (n *NilConnectionMonitor) IsConnectedToTheNetwork(netw network.Network) bool
IsConnectedToTheNetwork returns true if the number of connected peer is at least equal with thresholdMinConnectedPeers
func (*NilConnectionMonitor) IsInterfaceNil ¶
func (n *NilConnectionMonitor) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*NilConnectionMonitor) Listen ¶
func (n *NilConnectionMonitor) Listen(network.Network, multiaddr.Multiaddr)
Listen is called when network starts listening on an addr
func (*NilConnectionMonitor) ListenClose ¶
func (n *NilConnectionMonitor) ListenClose(network.Network, multiaddr.Multiaddr)
ListenClose is called when network stops listening on an addr
func (*NilConnectionMonitor) OpenedStream ¶
func (n *NilConnectionMonitor) OpenedStream(network.Network, network.Stream)
OpenedStream is called when a stream opened
func (*NilConnectionMonitor) SetThresholdMinConnectedPeers ¶
func (n *NilConnectionMonitor) SetThresholdMinConnectedPeers(thresholdMinConnectedPeers int, _ network.Network)
SetThresholdMinConnectedPeers sets the minimum connected peers number when the node is considered connected on the network
func (*NilConnectionMonitor) ThresholdMinConnectedPeers ¶
func (n *NilConnectionMonitor) ThresholdMinConnectedPeers() int
ThresholdMinConnectedPeers returns the minimum connected peers number when the node is considered connected on the network