Documentation ¶
Index ¶
- Variables
- func InfoFromAddrs(addrs []string) ([]*pstore.PeerInfo, error)
- type Peer
- func (p *Peer) AddConnection(conn inet.Conn, isWritable bool) (uint, error)
- func (p *Peer) Config() clienttypes.ConfigClient
- func (p *Peer) Disconnect() error
- func (p *Peer) GetBestNumber() *big.Int
- func (p *Peer) GetChain() (clienttypes.InterfaceChains, error)
- func (p *Peer) GetID() string
- func (p *Peer) GetNextID() uint
- func (p *Peer) GetPeerInfo() pstore.PeerInfo
- func (p *Peer) GetShortID() string
- func (p *Peer) IsActive() (bool, error)
- func (p *Peer) IsWritable() (bool, error)
- func (p *Peer) On(event peertypes.EventEnum, cb clienttypes.PeerEventCallback)
- func (p *Peer) Receive(stream inet.Stream) error
- func (p *Peer) Send(msg clienttypes.InterfaceMessage) (bool, error)
- func (p *Peer) SetBest(blockNumber *big.Int, hash []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoConfig ... ErrNoConfig = errors.New("no config") // ErrNoChain ... ErrNoChain = errors.New("no chain") )
Functions ¶
Types ¶
type Peer ¶
type Peer struct { // TODO: map?!? BestHash []byte BestNumber *big.Int // contains filtered or unexported fields }
Peer ...
func New ¶
func New(cfg *clienttypes.ConfigClient, chn clienttypes.InterfaceChains, pInfo pstore.PeerInfo) (*Peer, error)
New ...
func (*Peer) AddConnection ¶
AddConnection ...
func (*Peer) IsWritable ¶
IsWritable returns whether the peer is writable or not
func (*Peer) On ¶
func (p *Peer) On(event peertypes.EventEnum, cb clienttypes.PeerEventCallback)
On defines the event handlers
func (*Peer) Send ¶
func (p *Peer) Send(msg clienttypes.InterfaceMessage) (bool, error)
Send is used to send the peer a message
Click to show internal directories.
Click to hide internal directories.