p2p

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HealthyPeerState a healthy peer
	HealthyPeerState peerState = iota
	// BannedPeerState a banned peer
	BannedPeerState
	// DefunctPeerState a banned peer
	DefunctPeerState
)
View Source
const (
	// NoneReasonForBan not banned
	NoneReasonForBan reasonForBan = iota
	// BadBlockReasonForBan banned for sending a bad block
	BadBlockReasonForBan
	// BadCompactBlockReasonForBan banned for sending a bad compact block
	BadCompactBlockReasonForBan
	// BadBlockHeaderReasonForBan banned for sending a bad block header
	BadBlockHeaderReasonForBan
	// BadTxHashSetReasonForBan banned for sending a bad txhashset
	BadTxHashSetReasonForBan
	// ManualBanReasonForBan banned manualy
	ManualBanReasonForBan
	// FraudHeightReasonForBan banned for fraud height
	FraudHeightReasonForBan
	// BadHanshakeReasonForBan banned for sending a bad handshake
	BadHanshakeReasonForBan
)
View Source
const (
	// InboundConnectionDirection is an inbound connection
	InboundConnectionDirection connectionDirection = iota
	// OutboundConnectionDirection is an outbound connection
	OutboundConnectionDirection
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Bits uint32 `json:"bits"`
}

Capabilities are options for what type of interaction a peer supports

type PeerData

type PeerData struct {
	// Network address of the peer.
	Addr string `json:"addr"`
	// What capabilities the peer advertises. Unknown until a successful
	// connection.
	Capabilities Capabilities `json:"capabilities"`
	// The peer user agent.
	UserAgent string `json:"user_agent"`
	// State the peer has been detected with.
	Flags peerState `json:"flags"`
	// The time the peer was last banned
	LastBanned int64 `json:"last_banned"`
	// The reason for the ban
	Banreason reasonForBan `json:"ban_reason"`
	// Time when we last connected to this peer.
	LastConnected int64 `json:"last_connected"`
}

PeerData is the data stored for any given peer we've encountered.

type PeerInfoDisplay

type PeerInfoDisplay struct {
	Capabilities    Capabilities        `json:"capabilities"`
	UserAgent       string              `json:"user_agent"`
	Version         uint32              `json:"version"`
	Addr            string              `json:"addr"`
	Direction       connectionDirection `json:"direction"`
	TotalDifficulty uint64              `json:"total_difficulty"`
	Height          uint64              `json:"height"`
}

PeerInfoDisplay is a flatten out PeerInfo and nested PeerLiveInfo (taking a read lock on it) so we can serialize/deserialize the data for the API and the TUI.

Jump to

Keyboard shortcuts

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