Documentation
¶
Overview ¶
eth protocol block bodies https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockbodies-0x06
eth protocol block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockheaders-0x04
eth protocol block receipts https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockreceipts-0x06
RLPx disconnect https://github.com/ethereum/devp2p/blob/master/rlpx.md#disconnect-0x01
eth protocol get get block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getblockbodies-0x05
eth protocol get get block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getblockheaders-0x03
eth protocol get get block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getblockheaders-0x03
eth protocol get get block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getblockreceipts-0x05
RLPx hello https://github.com/ethereum/devp2p/blob/master/rlpx.md#hello-0x00
eth protocol new pooled transaction hashes https://github.com/ethereum/devp2p/blob/master/caps/eth.md#newpooledtransactionhashes-0x08
RLPx ping https://github.com/ethereum/devp2p/blob/master/rlpx.md#ping-0x02
RLPx pong https://github.com/ethereum/devp2p/blob/master/rlpx.md#pong-0x03
eth protocol get get block headers https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getblockheaders-0x03
eth protocol block receipts https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockreceipts-0x06
eth protocol status https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00
eth protocol transactions https://github.com/ethereum/devp2p/blob/master/caps/eth.md#transactions-0x02
Index ¶
- Constants
- func SupportedEthCaps() []p2p.Cap
- type BlockBodies
- type BlockHeaders
- type BlockRangeUpdate
- type BodyProvider
- type Client
- func (c *Client) GetPooledTransactions(ctx context.Context, hashes []common.Hash) (*PooledTransactions, error)
- func (c *Client) OnDisconnect(ctx context.Context, ...)
- func (c *Client) OnHello(ctx context.Context, handler func(ctx context.Context, status *Hello) error)
- func (c *Client) OnNewPooledTransactionHashes(ctx context.Context, ...)
- func (c *Client) OnStatus(ctx context.Context, handler func(ctx context.Context, status Status) error)
- func (c *Client) OnTransactions(ctx context.Context, ...)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop(ctx context.Context) error
- func (c *Client) Transactions(ctx context.Context, transactions *Transactions) error
- type Disconnect
- type GetBlockBodies
- type GetBlockHeaders
- type GetPooledTransactions
- type GetReceipts
- type GetReceipts70
- type GetReceipts70Packet
- type GetReceiptsMessage
- type HeaderProvider
- type Hello
- type NewPooledTransactionHashes
- type Option
- type Ping
- type Pong
- type PooledTransactions
- type ReceiptProvider
- type ReceiptRequest
- type Receipts
- type Receipts69
- type Receipts70
- type Receipts70Packet
- type Status
- type Status68
- func (msg *Status68) Code() int
- func (msg *Status68) GetForkIDHash() []byte
- func (msg *Status68) GetForkIDNext() uint64
- func (msg *Status68) GetGenesis() []byte
- func (msg *Status68) GetHead() []byte
- func (msg *Status68) GetNetworkID() uint64
- func (msg *Status68) GetProtocolVersion() uint32
- func (msg *Status68) ReqID() uint64
- type Status68Packet
- type Status69
- func (msg *Status69) Code() int
- func (msg *Status69) GetForkIDHash() []byte
- func (msg *Status69) GetForkIDNext() uint64
- func (msg *Status69) GetGenesis() []byte
- func (msg *Status69) GetHead() []byte
- func (msg *Status69) GetNetworkID() uint64
- func (msg *Status69) GetProtocolVersion() uint32
- func (msg *Status69) ReqID() uint64
- type StatusProvider
- type Transactions
Constants ¶
const ( HelloCode = 0x00 P2PProtocolVersion = 5 ETHCapName = "eth" )
const (
BlockBodiesCode = RLPXOffset + eth.BlockBodiesMsg
)
const (
BlockHeadersCode = RLPXOffset + eth.BlockHeadersMsg
)
const (
BlockRangeUpdateCode = RLPXOffset + eth.BlockRangeUpdateMsg
)
const (
DisconnectCode = 0x01
)
const (
GetBlockBodiesCode = RLPXOffset + eth.GetBlockBodiesMsg
)
const (
GetBlockHeadersCode = RLPXOffset + eth.GetBlockHeadersMsg
)
const (
GetPooledTransactionsCode = RLPXOffset + eth.GetPooledTransactionsMsg
)
const (
GetReceiptsCode = RLPXOffset + eth.GetReceiptsMsg
)
const (
NewPooledTransactionHashesCode = RLPXOffset + eth.NewPooledTransactionHashesMsg
)
const (
PingCode = 0x02
)
const (
PongCode = 0x03
)
const (
PooledTransactionsCode = RLPXOffset + eth.PooledTransactionsMsg
)
const (
RLPXOffset = 0x10 // https://github.com/ethereum/devp2p/blob/master/rlpx.md#message-id-based-multiplexing
)
const (
ReceiptsCode = RLPXOffset + eth.ReceiptsMsg
)
const (
StatusCode = RLPXOffset + eth.StatusMsg
)
const (
TransactionsCode = RLPXOffset + eth.TransactionsMsg
)
Variables ¶
This section is empty.
Functions ¶
func SupportedEthCaps ¶
Types ¶
type BlockBodies ¶
type BlockBodies eth.BlockBodiesPacket
func (*BlockBodies) Code ¶
func (msg *BlockBodies) Code() int
func (*BlockBodies) ReqID ¶
func (msg *BlockBodies) ReqID() uint64
type BlockHeaders ¶
type BlockHeaders eth.BlockHeadersPacket
func (*BlockHeaders) Code ¶
func (msg *BlockHeaders) Code() int
func (*BlockHeaders) ReqID ¶
func (msg *BlockHeaders) ReqID() uint64
type BlockRangeUpdate ¶
type BlockRangeUpdate eth.BlockRangeUpdatePacket
func (*BlockRangeUpdate) Code ¶
func (msg *BlockRangeUpdate) Code() int
type BodyProvider ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetPooledTransactions ¶
func (*Client) OnDisconnect ¶
func (*Client) OnNewPooledTransactionHashes ¶
func (*Client) OnTransactions ¶
func (*Client) Transactions ¶
func (c *Client) Transactions(ctx context.Context, transactions *Transactions) error
type Disconnect ¶
type Disconnect struct {
Reason p2p.DiscReason
}
func (*Disconnect) Code ¶
func (h *Disconnect) Code() int
func (*Disconnect) ReqID ¶
func (h *Disconnect) ReqID() uint64
type GetBlockBodies ¶
type GetBlockBodies eth.GetBlockBodiesPacket
func (*GetBlockBodies) Code ¶
func (msg *GetBlockBodies) Code() int
func (*GetBlockBodies) ReqID ¶
func (msg *GetBlockBodies) ReqID() uint64
type GetBlockHeaders ¶
type GetBlockHeaders eth.GetBlockHeadersPacket
func (*GetBlockHeaders) Code ¶
func (msg *GetBlockHeaders) Code() int
func (*GetBlockHeaders) ReqID ¶
func (msg *GetBlockHeaders) ReqID() uint64
type GetPooledTransactions ¶
type GetPooledTransactions eth.GetPooledTransactionsPacket
func (*GetPooledTransactions) Code ¶
func (msg *GetPooledTransactions) Code() int
func (*GetPooledTransactions) ReqID ¶
func (msg *GetPooledTransactions) ReqID() uint64
type GetReceipts ¶
type GetReceipts eth.GetReceiptsPacket
func (*GetReceipts) Code ¶
func (msg *GetReceipts) Code() int
func (*GetReceipts) ReceiptRequest ¶
func (msg *GetReceipts) ReceiptRequest() ReceiptRequest
func (*GetReceipts) ReqID ¶
func (msg *GetReceipts) ReqID() uint64
type GetReceipts70 ¶
type GetReceipts70 struct {
GetReceipts70Packet
}
func (*GetReceipts70) Code ¶
func (msg *GetReceipts70) Code() int
func (*GetReceipts70) ReceiptRequest ¶
func (msg *GetReceipts70) ReceiptRequest() ReceiptRequest
func (*GetReceipts70) ReqID ¶
func (msg *GetReceipts70) ReqID() uint64
type GetReceipts70Packet ¶
type GetReceipts70Packet struct {
RequestId uint64
FirstBlockReceiptIndex uint64
eth.GetReceiptsRequest
}
type GetReceiptsMessage ¶
type GetReceiptsMessage interface {
Code() int
ReqID() uint64
ReceiptRequest() ReceiptRequest
}
type HeaderProvider ¶
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"`
}
https://github.com/ethereum/go-ethereum/blob/master/cmd/devp2p/internal/ethtest/types.go
func (*Hello) ETHProtocolVersion ¶
type NewPooledTransactionHashes ¶
type NewPooledTransactionHashes eth.NewPooledTransactionHashesPacket
func (*NewPooledTransactionHashes) Code ¶
func (msg *NewPooledTransactionHashes) Code() int
func (*NewPooledTransactionHashes) ReqID ¶
func (msg *NewPooledTransactionHashes) ReqID() uint64
type Option ¶
type Option func(*Client)
func WithBodyProvider ¶
func WithBodyProvider(provider BodyProvider) Option
func WithHeaderProvider ¶
func WithHeaderProvider(provider HeaderProvider) Option
func WithPrivateKey ¶
func WithPrivateKey(privateKey *ecdsa.PrivateKey) Option
func WithReceiptProvider ¶
func WithReceiptProvider(provider ReceiptProvider) Option
func WithStatusProvider ¶
func WithStatusProvider(provider StatusProvider) Option
type PooledTransactions ¶
type PooledTransactions eth.PooledTransactionsPacket
func (*PooledTransactions) Code ¶
func (msg *PooledTransactions) Code() int
func (*PooledTransactions) ReqID ¶
func (msg *PooledTransactions) ReqID() uint64
type ReceiptProvider ¶
type ReceiptProvider func(ctx context.Context, request ReceiptRequest) ([]*eth.ReceiptList, error)
type ReceiptRequest ¶
type Receipts69 ¶
type Receipts69 struct {
eth.ReceiptsPacket
}
func (*Receipts69) Code ¶
func (msg *Receipts69) Code() int
func (*Receipts69) ReqID ¶
func (msg *Receipts69) ReqID() uint64
type Receipts70 ¶
type Receipts70 struct {
Receipts70Packet
}
func (*Receipts70) Code ¶
func (msg *Receipts70) Code() int
func (*Receipts70) ReqID ¶
func (msg *Receipts70) ReqID() uint64
type Receipts70Packet ¶
type Status ¶
type Status interface {
Code() int
ReqID() uint64
GetProtocolVersion() uint32
GetGenesis() []byte
GetHead() []byte
GetNetworkID() uint64
GetForkIDHash() []byte
GetForkIDNext() uint64
}
Status is a wrapper interface for the StatusPacket.
type Status68 ¶
type Status68 struct {
Status68Packet
}
func (*Status68) GetForkIDHash ¶
func (*Status68) GetForkIDNext ¶
func (*Status68) GetGenesis ¶
func (*Status68) GetNetworkID ¶
func (*Status68) GetProtocolVersion ¶
type Status68Packet ¶
type Status69 ¶
type Status69 struct {
eth.StatusPacket
}
func (*Status69) GetForkIDHash ¶
func (*Status69) GetForkIDNext ¶
func (*Status69) GetGenesis ¶
func (*Status69) GetNetworkID ¶
func (*Status69) GetProtocolVersion ¶
type StatusProvider ¶
type Transactions ¶
type Transactions eth.TransactionsPacket
func (*Transactions) Code ¶
func (msg *Transactions) Code() int
func (*Transactions) ReqID ¶
func (msg *Transactions) ReqID() uint64
Source Files
¶
- client.go
- message_block_bodies.go
- message_block_headers.go
- message_block_range_update.go
- message_disconnect.go
- message_get_block_bodies.go
- message_get_block_headers.go
- message_get_pooled_transactions.go
- message_get_receipts.go
- message_hello.go
- message_new_pooled_transaction_hashes.go
- message_ping.go
- message_pong.go
- message_pooled_transactions.go
- message_receipts.go
- message_status.go
- message_transactions.go
- options.go
- publish.go