Documentation ¶
Index ¶
- Constants
- func HandleClient(backend Backend, peer *Peer) error
- func HandleServer(backend Backend, peer *Peer) error
- func MakeProtocolsClient(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol
- func MakeProtocolsServer(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol
- type Backend
- type BlockPrivateDataPacket
- type Handler
- type Peer
- func (p *Peer) AsyncSendNewBlock(block *types.Block, td *big.Int, blockPrivateData *qlight.BlockPrivateData)
- func (p *Peer) Close()
- func (p *Peer) ID() string
- func (p *Peer) KnownBlock(hash common.Hash) bool
- func (p *Peer) Log() log.Logger
- func (p *Peer) PeriodicAuthCheck()
- func (p *Peer) QLightHandshake(server bool, psi string, token string) error
- func (p *Peer) QLightPSI() string
- func (p *Peer) QLightServer() bool
- func (p *Peer) QLightToken() string
- func (p *Peer) SendBlockPrivateData(data []qlight.BlockPrivateData) error
- func (p *Peer) SendNewAuthToken(token string) error
- func (p *Peer) SendNewBlock(block *types.Block, td *big.Int) error
- func (p *Peer) Version() uint
Constants ¶
const ( QLightStatusMsg = 0x11 QLightTokenUpdateMsg = 0x12 QLightNewBlockPrivateDataMsg = 0x13 )
const ProtocolName = "qlight"
const QLIGHT65 = 65
const QLightProtocolLength = 20
Variables ¶
This section is empty.
Functions ¶
func HandleClient ¶
Handle is invoked whenever an `eth` connection is made that successfully passes the protocol handshake. This method will keep processing messages until the connection is torn down.
func HandleServer ¶
func MakeProtocolsClient ¶
MakeProtocols constructs the P2P protocol definitions for `eth`.
Types ¶
type Backend ¶
type Backend interface { eth.Backend // 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. RunQPeer(peer *Peer, handler Handler) error // Handle is a callback to be invoked when a data packet is received from // the remote peer. Only packets not consumed by the protocol handler will // be forwarded to the backend. QHandle(peer *Peer, packet eth.Packet) error }
Backend defines the data retrieval methods to serve remote requests and the callback methods to invoke on remote deliveries.
type BlockPrivateDataPacket ¶
type BlockPrivateDataPacket []qlight.BlockPrivateData
func (*BlockPrivateDataPacket) Kind ¶
func (*BlockPrivateDataPacket) Kind() byte
func (*BlockPrivateDataPacket) Name ¶
func (*BlockPrivateDataPacket) Name() string
type Handler ¶
Handler is a callback to invoke from an outside runner after the boilerplate exchanges have passed.
type Peer ¶
type Peer struct { *p2p.Peer // The embedded P2P package peer EthPeer *eth.Peer QLightPeriodicAuthFunc func() error // contains filtered or unexported fields }
Peer is a collection of relevant information we have about a `snap` peer.
func (*Peer) AsyncSendNewBlock ¶
func (p *Peer) AsyncSendNewBlock(block *types.Block, td *big.Int, blockPrivateData *qlight.BlockPrivateData)
AsyncSendNewBlock queues an entire block for propagation to a remote peer. If the peer's broadcast queue is full, the event is silently dropped.
func (*Peer) KnownBlock ¶
KnownBlock returns whether peer is known to already have a block.
func (*Peer) PeriodicAuthCheck ¶
func (p *Peer) PeriodicAuthCheck()
func (*Peer) QLightHandshake ¶
func (*Peer) QLightServer ¶
func (*Peer) QLightToken ¶
func (*Peer) SendBlockPrivateData ¶
func (p *Peer) SendBlockPrivateData(data []qlight.BlockPrivateData) error