peer

package
v0.0.0-...-9098a98 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package peer manages the peers of the node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages known remote peers.

func NewManager

func NewManager(ps []string, networkID string, addr string, nodeID string, maxPeers int) *Manager

func (*Manager) AddPeerAddr

func (pm *Manager) AddPeerAddr(addr string)

Add new peer with network addr.

func (*Manager) GetLiveClients

func (pm *Manager) GetLiveClients() []rpcpb.NodeClient

Get a list of rpc clients from live peers.

func (*Manager) GetMetadata

func (pm *Manager) GetMetadata() metadata.MD

Get the metadata of the node.

func (*Manager) Start

func (pm *Manager) Start()

func (*Manager) Stop

func (pm *Manager) Stop()

Stop the peer manager.

type Peer

type Peer struct {
	// peer network address (ip:port)
	Addr string
	// NodeID of the peer (public key)
	NodeID string
	// the role of the peer
	Role string
	// connection time
	ConnTime int64
	// contains filtered or unexported fields
}

Peer represents the overall information about the remote peer.

func (*Peer) Close

func (p *Peer) Close()

close the underlying connection

func (Peer) String

func (p Peer) String() string

The string representation of the peer is its ip:port address.

Jump to

Keyboard shortcuts

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