Documentation
¶
Index ¶
- type DataStats
- type HolePunchTracer
- type Info
- type Kind
- type Opt
- type PeerInfo
- type PeerInfoTracker
- func (t *PeerInfoTracker) Connected(_ network.Network, c network.Conn)
- func (t *PeerInfoTracker) Disconnected(n network.Network, c network.Conn)
- func (t *PeerInfoTracker) EnsurePeerInfo(p peer.ID) *Info
- func (t *PeerInfoTracker) EnsureProtoStats(proto protocol.ID) *DataStats
- func (*PeerInfoTracker) Listen(network.Network, ma.Multiaddr)
- func (*PeerInfoTracker) ListenClose(network.Network, ma.Multiaddr)
- func (t *PeerInfoTracker) Protocols() []protocol.ID
- func (t *PeerInfoTracker) RecordReceived(n int64, proto protocol.ID, p peer.ID)
- func (t *PeerInfoTracker) RecordSent(n int64, proto protocol.ID, p peer.ID)
- func (t *PeerInfoTracker) Start(p2pNet network.Network)
- func (t *PeerInfoTracker) Stop()
- type PeerRequestStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStats ¶
type DataStats struct {
// contains filtered or unexported fields
}
func (*DataStats) BytesReceived ¶
func (*DataStats) RecordReceived ¶
func (*DataStats) RecordSent ¶
type HolePunchTracer ¶
type HolePunchTracer struct {
// contains filtered or unexported fields
}
func NewHolePunchTracer ¶
func NewHolePunchTracer(pi PeerInfo, next holepunch.MetricsTracer) *HolePunchTracer
func (*HolePunchTracer) DirectDialFinished ¶
func (h *HolePunchTracer) DirectDialFinished(success bool)
DirectDialFinished implements holepunch.MetricsTracer.
func (*HolePunchTracer) HolePunchFinished ¶
func (h *HolePunchTracer) HolePunchFinished( side string, attemptNum int, theirAddrs, ourAddr []ma.Multiaddr, directConn network.ConnMultiaddrs, )
HolePunchFinished implements holepunch.MetricsTracer.
type Info ¶
type Info struct {
DataStats
ClientStats PeerRequestStats
ServerStats PeerRequestStats
// contains filtered or unexported fields
}
type Opt ¶
type Opt func(t *PeerInfoTracker)
type PeerInfo ¶
type PeerInfo interface {
// EnsurePeerInfo returns Info structure for the specific peers.
// If there's no such structure assigned for the peer yet, it creates one. The
// Info structure will be removed when all connections to the peer are closed.
EnsurePeerInfo(p peer.ID) *Info
// RecordReceived records that n bytes of data has been received from peer p
// via protocol proto.
RecordReceived(n int64, proto protocol.ID, p peer.ID)
// RecordReceived records that n bytes of data has been sent to the peer p
// via protocol proto.
RecordSent(n int64, proto protocol.ID, p peer.ID)
// Protocols returns the list of protocols used so far, in no particular order.
Protocols() []protocol.ID
// EnsureProtoStats returns DataStats structure for the specified protocol,
// allocating one if it doesn't exist yet.
EnsureProtoStats(proto protocol.ID) *DataStats
}
PeerInfo provides peer-related connection status and statistics.
type PeerInfoTracker ¶
type PeerInfoTracker struct {
// contains filtered or unexported fields
}
func NewPeerInfoTracker ¶
func NewPeerInfoTracker(opts ...Opt) *PeerInfoTracker
func (*PeerInfoTracker) Connected ¶
func (t *PeerInfoTracker) Connected(_ network.Network, c network.Conn)
Connected implements network.Notifiee.
func (*PeerInfoTracker) Disconnected ¶
func (t *PeerInfoTracker) Disconnected(n network.Network, c network.Conn)
Disconnected implements network.Notifiee.
func (*PeerInfoTracker) EnsurePeerInfo ¶
func (t *PeerInfoTracker) EnsurePeerInfo(p peer.ID) *Info
func (*PeerInfoTracker) EnsureProtoStats ¶
func (t *PeerInfoTracker) EnsureProtoStats(proto protocol.ID) *DataStats
func (*PeerInfoTracker) Listen ¶
func (*PeerInfoTracker) Listen(network.Network, ma.Multiaddr)
Listen implements network.Notifiee.
func (*PeerInfoTracker) ListenClose ¶
func (*PeerInfoTracker) ListenClose(network.Network, ma.Multiaddr)
ListenClose implements network.Notifiee.
func (*PeerInfoTracker) Protocols ¶
func (t *PeerInfoTracker) Protocols() []protocol.ID
func (*PeerInfoTracker) RecordReceived ¶
func (*PeerInfoTracker) RecordSent ¶
func (*PeerInfoTracker) Start ¶
func (t *PeerInfoTracker) Start(p2pNet network.Network)
func (*PeerInfoTracker) Stop ¶
func (t *PeerInfoTracker) Stop()
type PeerRequestStats ¶
type PeerRequestStats struct {
// contains filtered or unexported fields
}
func (*PeerRequestStats) FailureCount ¶
func (ps *PeerRequestStats) FailureCount() int
func (*PeerRequestStats) Latency ¶
func (ps *PeerRequestStats) Latency() time.Duration
func (*PeerRequestStats) RequestDone ¶
func (ps *PeerRequestStats) RequestDone(took time.Duration, success bool)
func (*PeerRequestStats) SuccessCount ¶
func (ps *PeerRequestStats) SuccessCount() int
Click to show internal directories.
Click to hide internal directories.