peerinfo

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoOnce added in v0.13.0

func DoOnce(ctx context.Context, tcpNode host.Host, peerID peer.ID) (*pbv1.PeerInfo, time.Duration, bool, error)

DoOnce returns the peer info and RTT and true of the given peer, or false if the peer doesn't support the protocol, or an error.

func Protocols added in v0.13.0

func Protocols() []protocol.ID

Protocols returns the supported protocols of this package in order of precedence.

Types

type PeerInfo

type PeerInfo struct {
	// contains filtered or unexported fields
}

func New

func New(tcpNode host.Host, peers []peer.ID, version string, lockHash []byte, gitHash string,
	sendFunc p2p.SendReceiveFunc,
) *PeerInfo

New returns a new peer info protocol instance.

func NewForT

func NewForT(_ *testing.T, tcpNode host.Host, peers []peer.ID, version string, lockHash []byte, gitHash string,
	sendFunc p2p.SendReceiveFunc, registerHandler p2p.RegisterHandlerFunc,
	tickerProvider tickerProvider, nowFunc nowFunc, metricSubmitter metricSubmitter,
) *PeerInfo

NewForT returns a new peer info protocol instance for testing only.

func (*PeerInfo) Run

func (p *PeerInfo) Run(ctx context.Context)

Run runs the peer info protocol until the context is cancelled.

Directories

Path Synopsis
peerinfopb
v1

Jump to

Keyboard shortcuts

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