Documentation ¶
Index ¶
- Variables
- func NewDisabledConnectionsWatcher() *disabledConnectionsWatcher
- func NewPrintConnectionsWatcher(timeToLive time.Duration) (*printConnectionsWatcher, error)
- type Connections
- func (conns *Connections) Connected(network.Network, network.Conn)
- func (conns *Connections) Disconnected(network.Network, network.Conn)
- func (conns *Connections) Listen(network.Network, multiaddr.Multiaddr)
- func (conns *Connections) ListenClose(network.Network, multiaddr.Multiaddr)
- func (conns *Connections) ResetNumConnections() uint32
- func (conns *Connections) ResetNumDisconnections() uint32
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidValueForTimeToLiveParam = errors.New("invalid value for the time-to-live parameter")
ErrInvalidValueForTimeToLiveParam signals that an invalid value for the time-to-live parameter was provided
Functions ¶
func NewDisabledConnectionsWatcher ¶
func NewDisabledConnectionsWatcher() *disabledConnectionsWatcher
NewDisabledConnectionsWatcher returns a disabled ConnectionWatcher implementation
func NewPrintConnectionsWatcher ¶
NewPrintConnectionsWatcher creates a new
Types ¶
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
Connections is a metric that counts connections and disconnections done by the host implementation
func NewConnections ¶
func NewConnections() *Connections
NewConnections returns a new connsDisconnsMetric instance
func (*Connections) Connected ¶
func (conns *Connections) Connected(network.Network, network.Conn)
Connected is called when a connection opened. It increments the numConnections counter
func (*Connections) Disconnected ¶
func (conns *Connections) Disconnected(network.Network, network.Conn)
Disconnected is called when a connection closed it increments the numDisconnections counter
func (*Connections) Listen ¶
func (conns *Connections) Listen(network.Network, multiaddr.Multiaddr)
Listen is called when network starts listening on an addr
func (*Connections) ListenClose ¶
func (conns *Connections) ListenClose(network.Network, multiaddr.Multiaddr)
ListenClose is called when network stops listening on an addr
func (*Connections) ResetNumConnections ¶
func (conns *Connections) ResetNumConnections() uint32
ResetNumConnections resets the numConnections counter returning the previous value
func (*Connections) ResetNumDisconnections ¶
func (conns *Connections) ResetNumDisconnections() uint32
ResetNumDisconnections resets the numDisconnections counter returning the previous value