poker

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: GPL-3.0, LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIdMismatch
	ErrGenesisBlockMismatch
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrSuspendedPeer
)
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message

Variables

View Source
var ProtocolLengths = []uint64{0x100}

Number of implemented message corresponding to different protocol versions.

View Source
var ProtocolName = "poker"

Official short name of the protocol used during capability negotiation.

View Source
var ProtocolVersions = []uint{poker1}

Supported versions of the eth protocol (first is primary).

Functions

This section is empty.

Types

type Peer

type Peer struct {
	ID string

	*p2p.Peer
	RW p2p.MsgReadWriter
	// contains filtered or unexported fields
}

func NewPeer

func NewPeer(version int, p *p2p.Peer, rw p2p.MsgReadWriter) *Peer

func (*Peer) Handshake

func (p *Peer) Handshake(network uint64) error

Handshake executes the eth protocol handshake, negotiating version number, network IDs, difficulties, head and genesis blocks.

func (*Peer) Info

func (p *Peer) Info() *PeerInfo

Info gathers and returns a collection of metadata known about a peer.

func (*Peer) SendMsg

func (p *Peer) SendMsg(msgcode uint64, data interface{}) error

func (*Peer) String

func (p *Peer) String() string

String implements fmt.Stringer.

type PeerInfo

type PeerInfo struct {
	Version int `json:"version"`
}

PeerInfo represents a short summary of the Ethereum sub-protocol metadata known about a connected peer.

type PeerSet

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

peerSet represents the collection of active peers currently participating in the Ethereum sub-protocol.

func NewPeerSet

func NewPeerSet() *PeerSet

newPeerSet creates a new peer set to track the active participants.

func (*PeerSet) CenterPeer

func (ps *PeerSet) CenterPeer() *Peer

Peer retrieves the registered peer with the given id.

func (*PeerSet) Close

func (ps *PeerSet) Close()

Close disconnects all peers. No new peers can be registered after Close has returned.

func (*PeerSet) Len

func (ps *PeerSet) Len() int

Len returns if the current number of peers in the set.

func (*PeerSet) Peer

func (ps *PeerSet) Peer(id string) *Peer

Peer retrieves the registered peer with the given id.

func (*PeerSet) Register

func (ps *PeerSet) Register(p *Peer) error

Register injects a new peer into the working set, or returns an error if the peer is already known.

func (*PeerSet) Unregister

func (ps *PeerSet) Unregister(id string) error

Unregister removes a remote peer from the active set, disabling any further actions to/from that particular entity.

type Poker

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

func New

func New(ni uint64, stack *node.Node) (*Poker, error)

New creates a new Inter object

func (*Poker) APIs

func (s *Poker) APIs() []rpc.API

APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*Poker) Protocols

func (s *Poker) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start.

func (*Poker) Start

func (s *Poker) Start(srvr *p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Ethereum protocol implementation.

func (*Poker) Stop

func (s *Poker) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Ethereum protocol.

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(networkId uint64, node *node.Node) (*ProtocolManager, error)

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

Jump to

Keyboard shortcuts

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