peer

package
v0.0.0-...-297edb8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package peer maintains the peer related information such as the set of known peers and their status.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	Host string
}

Peer represents information about a Node in the network.

func New

func New(host string) Peer

New constructs a new info value.

func (Peer) Match

func (p Peer) Match(host string) bool

Match validates if the specified host matches this node.

type PeerSet

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

PeerSet represents the data representation to maintain a set of known peers.

func NewPeerSet

func NewPeerSet() *PeerSet

NewPeerSet constructs a new info set to manage node peer information.

func (*PeerSet) Add

func (ps *PeerSet) Add(peer Peer) bool

Add adds a new node to the set.

func (*PeerSet) Copy

func (ps *PeerSet) Copy(host string) []Peer

Copy returns a list of the known peers.

func (*PeerSet) Remove

func (ps *PeerSet) Remove(peer Peer)

Remove removes a peer node from the set.

type PeerStatus

type PeerStatus struct {
	LatestBlockHash   string `json:"latest_block_hash"`
	LatestBlockNumber uint64 `json:"latest_block_number"`
	KnownPeers        []Peer `json:"known_peers"`
}

PeerStatus represents information about the status of any given peer.

Jump to

Keyboard shortcuts

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