peer

package
v0.0.0-...-f5f0bdb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoConfig ...
	ErrNoConfig = errors.New("no config")
	// ErrNoChain ...
	ErrNoChain = errors.New("no chain")
)

Functions

func InfoFromAddrs

func InfoFromAddrs(addrs []string) ([]*pstore.PeerInfo, error)

InfoFromAddrs creates a peer info array from address strings

Types

type Peer

type Peer struct {
	// TODO: map?!?
	BestHash   []byte
	BestNumber *big.Int
	// contains filtered or unexported fields
}

Peer ...

func New

New ...

func (*Peer) AddConnection

func (p *Peer) AddConnection(conn inet.Conn, isWritable bool) (uint, error)

AddConnection ...

func (*Peer) Config

func (p *Peer) Config() clienttypes.ConfigClient

Config returns the config

func (*Peer) Disconnect

func (p *Peer) Disconnect() error

Disconnect disconnects from the peer

func (*Peer) GetBestNumber

func (p *Peer) GetBestNumber() *big.Int

GetBestNumber ...

func (*Peer) GetChain

func (p *Peer) GetChain() (clienttypes.InterfaceChains, error)

GetChain ...

func (*Peer) GetID

func (p *Peer) GetID() string

GetID ...

func (*Peer) GetNextID

func (p *Peer) GetNextID() uint

GetNextID ...

func (*Peer) GetPeerInfo

func (p *Peer) GetPeerInfo() pstore.PeerInfo

GetPeerInfo ...

func (*Peer) GetShortID

func (p *Peer) GetShortID() string

GetShortID ...

func (*Peer) IsActive

func (p *Peer) IsActive() (bool, error)

IsActive returns whether the peer is active or not

func (*Peer) IsWritable

func (p *Peer) IsWritable() (bool, error)

IsWritable returns whether the peer is writable or not

func (*Peer) On

On defines the event handlers

func (*Peer) Receive

func (p *Peer) Receive(stream inet.Stream) error

Receive ...

func (*Peer) Send

func (p *Peer) Send(msg clienttypes.InterfaceMessage) (bool, error)

Send is used to send the peer a message

func (*Peer) SetBest

func (p *Peer) SetBest(blockNumber *big.Int, hash []byte) error

SetBest sets a new block

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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