Documentation ¶
Index ¶
- Constants
- Variables
- func Handle(backend Backend, peer *Peer) error
- func MakeProtocols(backend Backend, dnsdisc enode.Iterator) []p2p.Protocol
- type Backend
- type DiffCapPacket
- type DiffLayersPacket
- type FullDiffLayersPacket
- type GetDiffLayersPacket
- type Handler
- type NodeInfo
- type Packet
- type Peer
- func (p *Peer) AsyncSendDiffLayer(diffLayers []rlp.RawValue)
- func (p *Peer) Close()
- func (p *Peer) DiffSync() bool
- func (p *Peer) Handshake(diffSync bool) error
- func (p *Peer) ID() string
- func (p *Peer) Log() log.Logger
- func (p *Peer) RequestDiffLayers(hashes []common.Hash) error
- func (p *Peer) SendDiffLayers(diffs []rlp.RawValue) error
- func (p *Peer) Version() uint
- type Tracker
Constants ¶
const ( DiffCapMsg = 0x00 GetDiffLayerMsg = 0x01 DiffLayerMsg = 0x02 FullDiffLayerMsg = 0x03 )
const (
Diff1 = 1
)
Constants to match up protocol versions and messages
const ProtocolName = "diff"
ProtocolName is the official short name of the `diff` protocol used during devp2p capability negotiation.
Variables ¶
var ProtocolVersions = []uint{Diff1}
ProtocolVersions are the supported versions of the `diff` protocol (first is primary).
Functions ¶
Types ¶
type Backend ¶
type Backend interface { // Chain retrieves the blockchain object to serve data. Chain() *core.BlockChain // RunPeer is invoked when a peer joins on the `eth` protocol. The handler // should do any peer maintenance work, handshakes and validations. If all // is passed, control should be given back to the `handler` to process the // inbound messages going forward. RunPeer(peer *Peer, handler Handler) error PeerInfo(id enode.ID) interface{} Handle(peer *Peer, packet Packet) error }
type DiffCapPacket ¶
func (*DiffCapPacket) Kind ¶
func (*DiffCapPacket) Kind() byte
func (*DiffCapPacket) Name ¶
func (*DiffCapPacket) Name() string
type DiffLayersPacket ¶
func (*DiffLayersPacket) Kind ¶
func (*DiffLayersPacket) Kind() byte
func (*DiffLayersPacket) Name ¶
func (*DiffLayersPacket) Name() string
type FullDiffLayersPacket ¶
type FullDiffLayersPacket struct { RequestId uint64 DiffLayersPacket }
func (*FullDiffLayersPacket) Kind ¶
func (*FullDiffLayersPacket) Kind() byte
func (*FullDiffLayersPacket) Name ¶
func (*FullDiffLayersPacket) Name() string
type GetDiffLayersPacket ¶
func (*GetDiffLayersPacket) Kind ¶
func (*GetDiffLayersPacket) Kind() byte
func (*GetDiffLayersPacket) Name ¶
func (*GetDiffLayersPacket) Name() string
type Handler ¶
Handler is a callback to invoke from an outside runner after the boilerplate exchanges have passed.
type NodeInfo ¶
type NodeInfo struct{}
NodeInfo represents a short summary of the `diff` sub-protocol metadata known about the host peer.
type Packet ¶
type Packet interface { Name() string // Name returns a string corresponding to the message type. Kind() byte // Kind returns the message type. }
Packet represents a p2p message in the `diff` protocol.
type Peer ¶
type Peer struct { *p2p.Peer // The embedded P2P package peer // contains filtered or unexported fields }
Peer is a collection of relevant information we have about a `diff` peer.
func (*Peer) AsyncSendDiffLayer ¶
func (*Peer) Close ¶
func (p *Peer) Close()
Close signals the broadcast goroutine to terminate. Only ever call this if you created the peer yourself via NewPeer. Otherwise let whoever created it clean it up!
func (*Peer) RequestDiffLayers ¶
RequestDiffLayers fetches a batch of diff layers corresponding to the hashes specified.