Documentation
¶
Index ¶
- func Listen(ln *enode.LocalNode) (*net.UDPConn, error)
- func LogMessageCount(count *MessageCount, ticker *time.Ticker)
- func ParseBootnodes(bootnodes string) ([]*enode.Node, error)
- func ParseNode(source string) (*enode.Node, error)
- func WriteNodesJSON(file string, nodes NodeSet) error
- type AccountRange
- type BlockBodies
- type BlockHeaders
- type ByteCodes
- type Conn
- type Disconnect
- type Disconnects
- type Error
- type GetAccountRange
- type GetBlockBodies
- type GetBlockHeaders
- type GetByteCodes
- type GetPooledTransactions
- type GetStorageRanges
- type GetTrieNodes
- type Hello
- type Message
- type MessageCount
- type NewBlock
- type NewBlockHashes
- type NewPooledTransactionHashes
- type NewPooledTransactionHashes66
- type NodeJSON
- type NodeSet
- type Ping
- type Pong
- type PooledTransactions
- type Status
- type StorageRanges
- type Transactions
- type TrieNodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogMessageCount ¶ added in v0.1.21
func LogMessageCount(count *MessageCount, ticker *time.Ticker)
LogMessageCount will log the message counts and reset them based on the ticker. This should be called as with a goroutine or it will block indefinitely.
func ParseBootnodes ¶
ParseBootnodes parses the bootnodes string and returns a node slice.
func WriteNodesJSON ¶
Types ¶
type AccountRange ¶
type AccountRange snap.AccountRangePacket
func (AccountRange) Code ¶
func (msg AccountRange) Code() int
func (AccountRange) ReqID ¶
func (msg AccountRange) ReqID() uint64
type BlockBodies ¶
type BlockBodies eth.BlockBodiesPacket66
BlockBodies is the network packet for block content distribution.
func (BlockBodies) Code ¶
func (msg BlockBodies) Code() int
func (BlockBodies) ReqID ¶
func (msg BlockBodies) ReqID() uint64
type BlockHeaders ¶
type BlockHeaders eth.BlockHeadersPacket66
func (BlockHeaders) Code ¶
func (msg BlockHeaders) Code() int
func (BlockHeaders) ReqID ¶
func (msg BlockHeaders) ReqID() uint64
type ByteCodes ¶
type ByteCodes snap.ByteCodesPacket
type Conn ¶
Conn represents an individual connection with a peer
func Dial ¶
Dial attempts to Dial the given node and perform a handshake, returning the created Conn if successful.
func (*Conn) Peer ¶
Peer performs both the protocol handshake and the status message exchange with the node in order to Peer with it.
func (*Conn) ReadAndServe ¶ added in v0.1.21
func (c *Conn) ReadAndServe(db database.Database, count *MessageCount) error
ReadAndServe reads messages from peers and writes it to a database.
type Disconnect ¶
type Disconnect struct {
Reason p2p.DiscReason
}
Disconnect is the RLP structure for a disconnect message.
func (Disconnect) Code ¶
func (msg Disconnect) Code() int
func (Disconnect) ReqID ¶
func (msg Disconnect) ReqID() uint64
type Disconnects ¶
type Disconnects []p2p.DiscReason
Disconnects is the RLP structure for disconnect messages.
func (Disconnects) Code ¶
func (msg Disconnects) Code() int
func (Disconnects) ReqID ¶
func (msg Disconnects) ReqID() uint64
type GetAccountRange ¶
type GetAccountRange snap.GetAccountRangePacket
GetAccountRange represents an account range query.
func (GetAccountRange) Code ¶
func (msg GetAccountRange) Code() int
func (GetAccountRange) ReqID ¶
func (msg GetAccountRange) ReqID() uint64
type GetBlockBodies ¶
type GetBlockBodies eth.GetBlockBodiesPacket66
GetBlockBodies represents a GetBlockBodies request
func (GetBlockBodies) Code ¶
func (msg GetBlockBodies) Code() int
func (GetBlockBodies) ReqID ¶
func (msg GetBlockBodies) ReqID() uint64
type GetBlockHeaders ¶
type GetBlockHeaders eth.GetBlockHeadersPacket66
GetBlockHeaders represents a block header query.
func (GetBlockHeaders) Code ¶
func (msg GetBlockHeaders) Code() int
func (GetBlockHeaders) ReqID ¶
func (msg GetBlockHeaders) ReqID() uint64
type GetByteCodes ¶
type GetByteCodes snap.GetByteCodesPacket
func (GetByteCodes) Code ¶
func (msg GetByteCodes) Code() int
func (GetByteCodes) ReqID ¶
func (msg GetByteCodes) ReqID() uint64
type GetPooledTransactions ¶
type GetPooledTransactions eth.GetPooledTransactionsPacket66
func (GetPooledTransactions) Code ¶
func (msg GetPooledTransactions) Code() int
func (GetPooledTransactions) ReqID ¶
func (msg GetPooledTransactions) ReqID() uint64
type GetStorageRanges ¶
type GetStorageRanges snap.GetStorageRangesPacket
func (GetStorageRanges) Code ¶
func (msg GetStorageRanges) Code() int
func (GetStorageRanges) ReqID ¶
func (msg GetStorageRanges) ReqID() uint64
type GetTrieNodes ¶
type GetTrieNodes snap.GetTrieNodesPacket
func (GetTrieNodes) Code ¶
func (msg GetTrieNodes) Code() int
func (GetTrieNodes) ReqID ¶
func (msg GetTrieNodes) ReqID() uint64
type Hello ¶
type Hello struct {
Version uint64
Name string
Caps []p2p.Cap
ListenPort uint64
ID []byte // secp256k1 public key
// Ignore additional fields (for forward compatibility).
Rest []rlp.RawValue `rlp:"tail"`
}
Hello is the RLP structure of the protocol handshake.
type MessageCount ¶ added in v0.1.21
type MessageCount struct {
BlockHeaders int32 `json:",omitempty"`
BlockBodies int32 `json:",omitempty"`
Blocks int32 `json:",omitempty"`
BlockHashes int32 `json:",omitempty"`
BlockHeaderRequests int32 `json:",omitempty"`
BlockBodiesRequests int32 `json:",omitempty"`
Transactions int32 `json:",omitempty"`
TransactionHashes int32 `json:",omitempty"`
TransactionRequests int32 `json:",omitempty"`
Pings int32 `json:",omitempty"`
Errors int32 `json:",omitempty"`
Disconnects int32 `json:",omitempty"`
}
MessageCount is used to help the outer goroutine to receive summary of the number and type of messages that were sent. This is used for distributed logging. It can be used to count the different types of messages received across all peer connections to provide a summary.
type NewBlock ¶
type NewBlock eth.NewBlockPacket
NewBlock is the network packet for the block propagation message.
type NewBlockHashes ¶
type NewBlockHashes eth.NewBlockHashesPacket
NewBlockHashes is the network packet for the block announcements.
func (NewBlockHashes) Code ¶
func (msg NewBlockHashes) Code() int
func (NewBlockHashes) ReqID ¶
func (msg NewBlockHashes) ReqID() uint64
type NewPooledTransactionHashes ¶ added in v0.1.21
NewPooledTransactionHashes is the network packet for the tx hash propagation message.
func (NewPooledTransactionHashes) Code ¶ added in v0.1.21
func (msg NewPooledTransactionHashes) Code() int
func (NewPooledTransactionHashes) ReqID ¶ added in v0.1.21
func (msg NewPooledTransactionHashes) ReqID() uint64
type NewPooledTransactionHashes66 ¶ added in v0.1.21
NewPooledTransactionHashes66 is the network packet for the tx hash propagation message.
func (NewPooledTransactionHashes66) Code ¶ added in v0.1.21
func (msg NewPooledTransactionHashes66) Code() int
func (NewPooledTransactionHashes66) ReqID ¶ added in v0.1.21
func (msg NewPooledTransactionHashes66) ReqID() uint64
type NodeJSON ¶
type NodeJSON struct {
Seq uint64 `json:"seq"`
N *enode.Node `json:"record"`
// The score tracks how many liveness checks were performed. It is incremented by one
// every time the node passes a check, and halved every time it doesn't.
Score int `json:"score,omitempty"`
// These two track the time of last successful contact.
FirstResponse time.Time `json:"firstResponse,omitempty"`
LastResponse time.Time `json:"lastResponse,omitempty"`
// This one tracks the time of our last attempt to contact the node.
LastCheck time.Time `json:"lastCheck,omitempty"`
}
type NodeSet ¶
NodeSet is the nodes.json file format. It holds a set of node records as a JSON object.
func LoadNodesJSON ¶
type PooledTransactions ¶
type PooledTransactions eth.PooledTransactionsPacket66
func (PooledTransactions) Code ¶
func (msg PooledTransactions) Code() int
func (PooledTransactions) ReqID ¶
func (msg PooledTransactions) ReqID() uint64
type Status ¶
type Status eth.StatusPacket
Status is the network packet for the status message for eth/64 and later.
type StorageRanges ¶
type StorageRanges snap.StorageRangesPacket
func (StorageRanges) Code ¶
func (msg StorageRanges) Code() int
func (StorageRanges) ReqID ¶
func (msg StorageRanges) ReqID() uint64
type Transactions ¶
type Transactions eth.TransactionsPacket
func (Transactions) Code ¶
func (msg Transactions) Code() int
func (Transactions) ReqID ¶
func (msg Transactions) ReqID() uint64