peerinfo

package
v1.6.2-rc.0-nomain Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 (ds *DataStats) BytesReceived() int64

func (*DataStats) BytesSent

func (ds *DataStats) BytesSent() int64

func (*DataStats) RecordReceived

func (ds *DataStats) RecordReceived(n int64)

func (*DataStats) RecordSent

func (ds *DataStats) RecordSent(n int64)

func (*DataStats) RecvRate

func (ds *DataStats) RecvRate(which int) int64

func (*DataStats) SendRate

func (ds *DataStats) SendRate(which int) int64

func (*DataStats) Tick

func (ds *DataStats) Tick(which int)

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
}

func (*Info) Kind

func (i *Info) Kind(c network.Conn) Kind

func (*Info) SetKind

func (i *Info) SetKind(c network.Conn, k Kind)

type Kind

type Kind string
const (
	KindUknown            Kind = ""
	KindInbound           Kind = "inbound"
	KindOutbound          Kind = "outbound"
	KindHolePunchInbound  Kind = "hp_inbound"
	KindHolePunchOutbound Kind = "hp_outbound"
	KindHolePunchUnknown  Kind = "hp_unknown"
	KindRelayInbound      Kind = "relay_in"
	KindRelayOutbound     Kind = "relay_out"
)

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

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 (t *PeerInfoTracker) RecordReceived(n int64, proto protocol.ID, p peer.ID)

func (*PeerInfoTracker) RecordSent

func (t *PeerInfoTracker) RecordSent(n int64, proto protocol.ID, p peer.ID)

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

Directories

Path Synopsis
Package peerinfo is a generated GoMock package.
Package peerinfo is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL