Documentation ¶
Index ¶
- Constants
- func PastPeers() []string
- type BlockPool
- func (self *BlockPool) Add(b *types.Block, peer *Peer)
- func (self *BlockPool) AddHash(hash []byte, peer *Peer)
- func (self *BlockPool) AddNew(b *types.Block, peer *Peer)
- func (self *BlockPool) Blocks() (blocks types.Blocks)
- func (self *BlockPool) DistributeHashes()
- func (self *BlockPool) FetchHashes(peer *Peer) bool
- func (self *BlockPool) HasCommonHash(hash []byte) bool
- func (self *BlockPool) HasLatestHash() bool
- func (self *BlockPool) Len() int
- func (self *BlockPool) Remove(hash []byte)
- func (self *BlockPool) Reset()
- func (self *BlockPool) Start()
- func (self *BlockPool) Stop()
- type Caps
- type ChainSyncEvent
- type DiscReason
- type Ethereum
- func (s *Ethereum) AddPeer(conn net.Conn)
- func (self *Ethereum) BlacklistPeer(peer *Peer)
- func (s *Ethereum) BlockManager() *core.BlockManager
- func (s *Ethereum) BlockPool() *BlockPool
- func (s *Ethereum) Broadcast(msgType wire.MsgType, data []interface{})
- func (s *Ethereum) BroadcastMsg(msg *wire.Msg)
- func (s *Ethereum) ChainManager() *core.ChainManager
- func (s *Ethereum) ClientIdentity() wire.ClientIdentity
- func (s *Ethereum) ConnectToPeer(addr string) error
- func (self *Ethereum) Db() ethutil.Database
- func (s *Ethereum) EventMux() *event.TypeMux
- func (self *Ethereum) GetFilter(id int) *core.Filter
- func (s *Ethereum) HighestTDPeer() (td *big.Int)
- func (s *Ethereum) InOutPeers() []*Peer
- func (s *Ethereum) InboundPeers() []*Peer
- func (self *Ethereum) InstallFilter(filter *core.Filter) (id int)
- func (s *Ethereum) IsListening() bool
- func (s *Ethereum) IsMining() bool
- func (s *Ethereum) IsUpToDate() bool
- func (s *Ethereum) KeyManager() *crypto.KeyManager
- func (s *Ethereum) OutboundPeers() []*Peer
- func (s *Ethereum) PeerCount() int
- func (s *Ethereum) Peers() *list.List
- func (s *Ethereum) ProcessPeerList(addrs []string)
- func (s *Ethereum) PushPeer(peer *Peer)
- func (s *Ethereum) RemovePeer(p *Peer)
- func (s *Ethereum) Seed()
- func (s *Ethereum) ServerCaps() Caps
- func (s *Ethereum) Start(seed bool)
- func (s *Ethereum) Stop()
- func (s *Ethereum) TxPool() *core.TxPool
- func (self *Ethereum) UninstallFilter(id int)
- func (s *Ethereum) WaitForShutdown()
- type NAT
- type Peer
- func (self *Peer) Caps() *ethutil.Value
- func (self *Peer) Connect(addr string) (conn net.Conn, err error)
- func (p *Peer) Connected() *int32
- func (self *Peer) FetchBlocks(hashes [][]byte)
- func (self *Peer) FetchHashes() bool
- func (self *Peer) FetchingHashes() bool
- func (p *Peer) HandleInbound()
- func (p *Peer) HandleOutbound()
- func (p *Peer) Host() []byte
- func (p *Peer) Inbound() bool
- func (self *Peer) IsCap(cap string) bool
- func (p *Peer) LastPong() int64
- func (p *Peer) LastSend() time.Time
- func (p *Peer) PingTime() string
- func (p *Peer) Port() uint16
- func (p *Peer) QueueMessage(msg *wire.Msg)
- func (p *Peer) RlpData() []interface{}
- func (p *Peer) SetVersion(version string)
- func (p *Peer) Start()
- func (p *Peer) Stop()
- func (p *Peer) StopWithReason(reason DiscReason)
- func (p *Peer) String() string
- func (p *Peer) Version() string
- type PeerListEvent
Constants ¶
View Source
const ( // Current protocol version ProtocolVersion = 49 // Current P2P version P2PVersion = 2 // Ethereum network version NetVersion = 0 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockPool ¶
type BlockPool struct {
ChainLength, BlocksProcessed int
// contains filtered or unexported fields
}
func NewBlockPool ¶
func (*BlockPool) DistributeHashes ¶
func (self *BlockPool) DistributeHashes()
func (*BlockPool) FetchHashes ¶
func (*BlockPool) HasCommonHash ¶
func (*BlockPool) HasLatestHash ¶
type Caps ¶
type Caps byte
Peer capabilities
const ( CapPeerDiscTy Caps = 1 << iota CapTxTy CapChainTy CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy )
type ChainSyncEvent ¶
type ChainSyncEvent struct {
InSync bool
}
type DiscReason ¶
type DiscReason byte
const ( // Values are given explicitly instead of by iota because these values are // defined by the wire protocol spec; it is easier for humans to ensure // correctness when values are explicit. DiscRequested DiscReason = iota DiscReTcpSysErr DiscBadProto DiscBadPeer DiscTooManyPeers DiscConnDup DiscGenesisErr DiscProtoErr DiscQuitting )
func (DiscReason) String ¶
func (d DiscReason) String() string
type Ethereum ¶
type Ethereum struct { // Nonce Nonce uint64 Addr net.Addr Port string // Specifies the desired amount of maximum peers MaxPeers int Mining bool RpcServer *rpc.JsonRpcServer // contains filtered or unexported fields }
func New ¶
func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *crypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error)
func (*Ethereum) BlacklistPeer ¶
func (*Ethereum) BlockManager ¶
func (s *Ethereum) BlockManager() *core.BlockManager
func (*Ethereum) BroadcastMsg ¶
func (*Ethereum) ChainManager ¶
func (s *Ethereum) ChainManager() *core.ChainManager
func (*Ethereum) ClientIdentity ¶
func (s *Ethereum) ClientIdentity() wire.ClientIdentity
func (*Ethereum) ConnectToPeer ¶
func (*Ethereum) GetFilter ¶
GetFilter retrieves a filter installed using InstallFilter. The filter may not be modified.
func (*Ethereum) HighestTDPeer ¶
func (*Ethereum) InOutPeers ¶
func (*Ethereum) InboundPeers ¶
func (*Ethereum) InstallFilter ¶
InstallFilter adds filter for blockchain events. The filter's callbacks will run for matching blocks and messages. The filter should not be modified after it has been installed.
func (*Ethereum) IsListening ¶
func (*Ethereum) IsUpToDate ¶
func (*Ethereum) KeyManager ¶
func (s *Ethereum) KeyManager() *crypto.KeyManager
func (*Ethereum) OutboundPeers ¶
func (*Ethereum) ProcessPeerList ¶
func (*Ethereum) RemovePeer ¶
func (*Ethereum) ServerCaps ¶
func (*Ethereum) UninstallFilter ¶
func (*Ethereum) WaitForShutdown ¶
func (s *Ethereum) WaitForShutdown()
This function will wait for a shutdown and resumes main thread execution
type NAT ¶
type NAT interface { GetExternalAddress() (addr net.IP, err error) AddPortMapping(protocol string, externalPort, internalPort int, description string, timeout int) (mappedExternalPort int, err error) DeletePortMapping(protocol string, externalPort, internalPort int) (err error) }
protocol is either "udp" or "tcp"
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) FetchBlocks ¶
func (*Peer) FetchHashes ¶
func (*Peer) FetchingHashes ¶
func (*Peer) HandleInbound ¶
func (p *Peer) HandleInbound()
Inbound handler. Inbound messages are received here and passed to the appropriate methods
func (*Peer) HandleOutbound ¶
func (p *Peer) HandleOutbound()
Outbound message handler. Outbound messages are handled here
func (*Peer) QueueMessage ¶
Outputs any RLP encoded data to the peer
func (*Peer) StopWithReason ¶
func (p *Peer) StopWithReason(reason DiscReason)
type PeerListEvent ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
compression
|
|
Package event implements an event multiplexer.
|
Package event implements an event multiplexer. |
Package logger implements a multi-output leveled logger.
|
Package logger implements a multi-output leveled logger. |
Package rlp implements the RLP serialization format.
|
Package rlp implements the RLP serialization format. |
tests
|
|
Package wire provides low level access to the Ethereum network and allows you to broadcast data over the network.
|
Package wire provides low level access to the Ethereum network and allows you to broadcast data over the network. |
Click to show internal directories.
Click to hide internal directories.