Documentation ¶
Index ¶
- type Peer
- func (p *Peer) Address() string
- func (p *Peer) AdvertisedProtocolVersion() uint32
- func (p *Peer) Connection() *netadapter.NetConnection
- func (p *Peer) FinishRequestingSelectedTip()
- func (p *Peer) ID() *id.ID
- func (p *Peer) IsOutbound() bool
- func (p *Peer) LastPingDuration() time.Duration
- func (p *Peer) RequestSelectedTipIfRequired()
- func (p *Peer) SelectedTipHash() *daghash.Hash
- func (p *Peer) SetPingIdle()
- func (p *Peer) SetPingPending(nonce uint64)
- func (p *Peer) SetSelectedTipHash(hash *daghash.Hash)
- func (p *Peer) StartIBD()
- func (p *Peer) String() string
- func (p *Peer) SubnetworkID() *subnetworkid.SubnetworkID
- func (p *Peer) TimeConnected() time.Duration
- func (p *Peer) TimeOffset() time.Duration
- func (p *Peer) UpdateFieldsFromMsgVersion(msg *appmessage.MsgVersion)
- func (p *Peer) UserAgent() string
- func (p *Peer) WaitForIBDStart()
- func (p *Peer) WaitForSelectedTipRequests()
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 (*Peer) AdvertisedProtocolVersion ¶
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) FinishRequestingSelectedTip ¶
func (p *Peer) FinishRequestingSelectedTip()
FinishRequestingSelectedTip finishes requesting the selected tip from this peer
func (*Peer) IsOutbound ¶
IsOutbound returns whether the peer is an outbound connection.
func (*Peer) LastPingDuration ¶
LastPingDuration returns the duration of the last ping to this peer
func (*Peer) RequestSelectedTipIfRequired ¶
func (p *Peer) RequestSelectedTipIfRequired()
RequestSelectedTipIfRequired notifies the peer that requesting a selected tip is required. This triggers the selected tip request flow.
func (*Peer) SelectedTipHash ¶
SelectedTipHash returns the selected tip of the peer.
func (*Peer) SetPingIdle ¶
func (p *Peer) SetPingIdle()
SetPingIdle sets the ping state of the peer to 'idle'
func (*Peer) SetPingPending ¶
SetPingPending sets the ping state of the peer to 'pending'
func (*Peer) SetSelectedTipHash ¶
SetSelectedTipHash sets the selected tip of the peer.
func (*Peer) SubnetworkID ¶
func (p *Peer) SubnetworkID() *subnetworkid.SubnetworkID
SubnetworkID returns the subnetwork the peer is associated with. It is nil in full nodes.
func (*Peer) TimeConnected ¶
TimeConnected returns the time since the connection to this been has been started.
func (*Peer) TimeOffset ¶
TimeOffset returns the peer's time offset.
func (*Peer) UpdateFieldsFromMsgVersion ¶
func (p *Peer) UpdateFieldsFromMsgVersion(msg *appmessage.MsgVersion)
UpdateFieldsFromMsgVersion updates the peer with the data from the version message.
func (*Peer) WaitForIBDStart ¶
func (p *Peer) WaitForIBDStart()
WaitForIBDStart blocks the current thread until IBD start is requested from this peer
func (*Peer) WaitForSelectedTipRequests ¶
func (p *Peer) WaitForSelectedTipRequests()
WaitForSelectedTipRequests blocks the current thread until a selected tip is requested from this peer