peer

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: ISC Imports: 9 Imported by: 0

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

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

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