peer

package
v0.12.18-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: ISC Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

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

Peer holds data about a peer.

func New

func New(connection *netadapter.NetConnection) *Peer

New returns a new Peer

func (*Peer) Address

func (p *Peer) Address() string

Address returns the address associated with this connection

func (*Peer) AdvertisedProtocolVersion

func (p *Peer) AdvertisedProtocolVersion() uint32

AdvertisedProtocolVersion returns the peer's advertised protocol version.

func (*Peer) Connection

func (p *Peer) Connection() *netadapter.NetConnection

Connection returns the NetConnection associated with this peer

func (*Peer) IBDRequestChannel added in v0.11.10

func (p *Peer) IBDRequestChannel() chan *externalapi.DomainBlock

IBDRequestChannel returns the channel used in order to communicate an IBD request between peer flows

func (*Peer) ID

func (p *Peer) ID() *id.ID

ID returns the peer ID.

func (*Peer) IsOutbound

func (p *Peer) IsOutbound() bool

IsOutbound returns whether the peer is an outbound connection.

func (*Peer) LastPingDuration

func (p *Peer) LastPingDuration() time.Duration

LastPingDuration returns the duration of the last ping to this peer

func (*Peer) ProtocolVersion added in v0.11.10

func (p *Peer) ProtocolVersion() uint32

ProtocolVersion returns the protocol version which is used when communicating with the peer.

func (*Peer) SetPingIdle

func (p *Peer) SetPingIdle()

SetPingIdle sets the ping state of the peer to 'idle'

func (*Peer) SetPingPending

func (p *Peer) SetPingPending(nonce uint64)

SetPingPending sets the ping state of the peer to 'pending'

func (*Peer) String

func (p *Peer) String() string

func (*Peer) SubnetworkID

func (p *Peer) SubnetworkID() *externalapi.DomainSubnetworkID

SubnetworkID returns the subnetwork the peer is associated with. It is nil in full nodes.

func (*Peer) TimeConnected

func (p *Peer) TimeConnected() time.Duration

TimeConnected returns the time since the connection to this been has been started.

func (*Peer) TimeOffset

func (p *Peer) TimeOffset() time.Duration

TimeOffset returns the peer's time offset.

func (*Peer) UpdateFieldsFromMsgVersion

func (p *Peer) UpdateFieldsFromMsgVersion(msg *appmessage.MsgVersion, maxProtocolVersion uint32)

UpdateFieldsFromMsgVersion updates the peer with the data from the version message.

func (*Peer) UserAgent

func (p *Peer) UserAgent() string

UserAgent returns the peer's user agent.

Jump to

Keyboard shortcuts

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