Documentation ¶
Overview ¶
Code generated by fastssz. DO NOT EDIT. Hash: 26a61b12807ff78c64a029acdd5bcb580dfe35b7bfbf8bf04ceebae1a3d5cac1 Version: 0.1.3
Index ¶
- Constants
- Variables
- func CollectPortalMetrics(refresh time.Duration, networks []string, dataDir string)
- type Accept
- func (a *Accept) GetTree() (*ssz.Node, error)
- func (a *Accept) HashTreeRoot() ([32]byte, error)
- func (a *Accept) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (a *Accept) MarshalSSZ() ([]byte, error)
- func (a *Accept) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (a *Accept) SizeSSZ() (size int)
- func (a *Accept) UnmarshalSSZ(buf []byte) error
- type ClientTag
- type ConnectionId
- func (c *ConnectionId) GetTree() (*ssz.Node, error)
- func (c *ConnectionId) HashTreeRoot() ([32]byte, error)
- func (c *ConnectionId) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (c *ConnectionId) MarshalSSZ() ([]byte, error)
- func (c *ConnectionId) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *ConnectionId) SizeSSZ() (size int)
- func (c *ConnectionId) UnmarshalSSZ(buf []byte) error
- type Content
- func (c *Content) GetTree() (*ssz.Node, error)
- func (c *Content) HashTreeRoot() ([32]byte, error)
- func (c *Content) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (c *Content) MarshalSSZ() ([]byte, error)
- func (c *Content) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *Content) SizeSSZ() (size int)
- func (c *Content) UnmarshalSSZ(buf []byte) error
- type ContentElement
- type ContentEntry
- type ContentInfo
- type ContentInfoResp
- type ContentKV
- type DiscV5API
- func (d *DiscV5API) AddEnr(enr string) (bool, error)
- func (d *DiscV5API) DeleteEnr(nodeId string) (bool, error)
- func (d *DiscV5API) FindNodes(enr string, distances []uint) ([]string, error)
- func (d *DiscV5API) GetEnr(nodeId string) (bool, error)
- func (d *DiscV5API) LookupEnr(nodeId string) (string, error)
- func (d *DiscV5API) NodeInfo() *NodeInfo
- func (d *DiscV5API) Ping(enr string) (*DiscV5PongResp, error)
- func (d *DiscV5API) RecursiveFindNodes(nodeId string) ([]string, error)
- func (d *DiscV5API) RoutingTableInfo() *RoutingTableInfo
- func (d *DiscV5API) TalkReq(enr string, protocol string, payload string) (string, error)
- type DiscV5PongResp
- type Enrs
- func (e *Enrs) GetTree() (*ssz.Node, error)
- func (e *Enrs) HashTreeRoot() ([32]byte, error)
- func (e *Enrs) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (e *Enrs) MarshalSSZ() ([]byte, error)
- func (e *Enrs) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (e *Enrs) SizeSSZ() (size int)
- func (e *Enrs) UnmarshalSSZ(buf []byte) error
- type EnrsResp
- type FindContent
- func (f *FindContent) GetTree() (*ssz.Node, error)
- func (f *FindContent) HashTreeRoot() ([32]byte, error)
- func (f *FindContent) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (f *FindContent) MarshalSSZ() ([]byte, error)
- func (f *FindContent) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (f *FindContent) SizeSSZ() (size int)
- func (f *FindContent) UnmarshalSSZ(buf []byte) error
- type FindNodes
- func (f *FindNodes) GetTree() (*ssz.Node, error)
- func (f *FindNodes) HashTreeRoot() ([32]byte, error)
- func (f *FindNodes) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (f *FindNodes) MarshalSSZ() ([]byte, error)
- func (f *FindNodes) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (f *FindNodes) SizeSSZ() (size int)
- func (f *FindNodes) UnmarshalSSZ(buf []byte) error
- type NodeInfo
- type NodeMetadata
- type Nodes
- func (n *Nodes) GetTree() (*ssz.Node, error)
- func (n *Nodes) HashTreeRoot() ([32]byte, error)
- func (n *Nodes) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (n *Nodes) MarshalSSZ() ([]byte, error)
- func (n *Nodes) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (n *Nodes) SizeSSZ() (size int)
- func (n *Nodes) UnmarshalSSZ(buf []byte) error
- type Offer
- func (o *Offer) GetTree() (*ssz.Node, error)
- func (o *Offer) HashTreeRoot() ([32]byte, error)
- func (o *Offer) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (o *Offer) MarshalSSZ() ([]byte, error)
- func (o *Offer) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (o *Offer) SizeSSZ() (size int)
- func (o *Offer) UnmarshalSSZ(buf []byte) error
- type OfferRequest
- type OfferRequestWithNode
- type PersistOfferRequest
- type Ping
- func (p *Ping) GetTree() (*ssz.Node, error)
- func (p *Ping) HashTreeRoot() ([32]byte, error)
- func (p *Ping) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *Ping) MarshalSSZ() ([]byte, error)
- func (p *Ping) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *Ping) SizeSSZ() (size int)
- func (p *Ping) UnmarshalSSZ(buf []byte) error
- type PingPongCustomData
- func (p *PingPongCustomData) GetTree() (*ssz.Node, error)
- func (p *PingPongCustomData) HashTreeRoot() ([32]byte, error)
- func (p *PingPongCustomData) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *PingPongCustomData) MarshalSSZ() ([]byte, error)
- func (p *PingPongCustomData) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *PingPongCustomData) SizeSSZ() (size int)
- func (p *PingPongCustomData) UnmarshalSSZ(buf []byte) error
- type Pong
- func (p *Pong) GetTree() (*ssz.Node, error)
- func (p *Pong) HashTreeRoot() ([32]byte, error)
- func (p *Pong) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *Pong) MarshalSSZ() ([]byte, error)
- func (p *Pong) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *Pong) SizeSSZ() (size int)
- func (p *Pong) UnmarshalSSZ(buf []byte) error
- type PortalPongResp
- type PortalProtocol
- func (p *PortalProtocol) AddEnr(n *enode.Node)
- func (p *PortalProtocol) ContentLookup(contentKey, contentId []byte) ([]byte, bool, error)
- func (p *PortalProtocol) Distance(a, b enode.ID) enode.ID
- func (p *PortalProtocol) Get(contentKey []byte, contentId []byte) ([]byte, error)
- func (p *PortalProtocol) GetContent() chan *ContentElement
- func (p *PortalProtocol) Gossip(srcNodeId *enode.ID, contentKeys [][]byte, content [][]byte) (int, error)
- func (p *PortalProtocol) InRange(contentId []byte) bool
- func (p *PortalProtocol) Lookup(target enode.ID) []*enode.Node
- func (p *PortalProtocol) LookupRandom() []*enode.Node
- func (p *PortalProtocol) LookupSelf() []*enode.Node
- func (p *PortalProtocol) Ping(node *enode.Node) (uint64, error)
- func (p *PortalProtocol) Put(contentKey []byte, contentId []byte, content []byte) error
- func (p *PortalProtocol) Radius() *uint256.Int
- func (p *PortalProtocol) RequestENR(n *enode.Node) (*enode.Node, error)
- func (p *PortalProtocol) Resolve(n *enode.Node) *enode.Node
- func (p *PortalProtocol) ResolveNodeId(id enode.ID) *enode.Node
- func (p *PortalProtocol) RoutingTableInfo() [][]string
- func (p *PortalProtocol) Self() *enode.Node
- func (p *PortalProtocol) Start() error
- func (p *PortalProtocol) Stop()
- func (p *PortalProtocol) ToContentId(contentKey []byte) []byte
- func (p *PortalProtocol) TraceContentLookup(contentKey, contentId []byte) (*TraceContentResult, error)
- type PortalProtocolAPI
- func (p *PortalProtocolAPI) AddEnr(enr string) (bool, error)
- func (p *PortalProtocolAPI) AddEnrs(enrs []string) bool
- func (p *PortalProtocolAPI) DeleteEnr(nodeId string) (bool, error)
- func (p *PortalProtocolAPI) FindContent(enr string, contentKey string) (interface{}, error)
- func (p *PortalProtocolAPI) FindNodes(enr string, distances []uint) ([]string, error)
- func (p *PortalProtocolAPI) GetEnr(nodeId string) (string, error)
- func (p *PortalProtocolAPI) Gossip(contentKeyHex, contentHex string) (int, error)
- func (p *PortalProtocolAPI) LocalContent(contentKeyHex string) (string, error)
- func (p *PortalProtocolAPI) LookupEnr(nodeId string) (string, error)
- func (p *PortalProtocolAPI) NodeInfo() *NodeInfo
- func (p *PortalProtocolAPI) Offer(enr string, contentItems [][2]string) (string, error)
- func (p *PortalProtocolAPI) Ping(enr string) (*PortalPongResp, error)
- func (p *PortalProtocolAPI) RecursiveFindContent(contentKeyHex string) (*ContentInfo, error)
- func (p *PortalProtocolAPI) RecursiveFindNodes(nodeId string) ([]string, error)
- func (p *PortalProtocolAPI) RoutingTableInfo() *RoutingTableInfo
- func (p *PortalProtocolAPI) Store(contentKeyHex string, contextHex string) (bool, error)
- func (p *PortalProtocolAPI) TraceRecursiveFindContent(contentKeyHex string) (*TraceContentResult, error)
- type PortalProtocolConfig
- type PortalProtocolOption
- type PortalStorageMetrics
- type PortalUtp
- func (p *PortalUtp) Accept(ctx context.Context) (*utp.Conn, error)
- func (p *PortalUtp) AcceptWithCid(ctx context.Context, nodeId enode.ID, cid *libutp.ConnId) (*utp.Conn, error)
- func (p *PortalUtp) Dial(ctx context.Context, dest *enode.Node) (net.Conn, error)
- func (p *PortalUtp) DialWithCid(ctx context.Context, dest *enode.Node, connId uint16) (net.Conn, error)
- func (p *PortalUtp) Start() error
- func (p *PortalUtp) Stop()
- type ProtocolId
- type RespByNode
- type RoutingTableInfo
- type Trace
- type TraceContentResult
- type TransientOfferRequest
Constants ¶
const ( TransientOfferRequestKind byte = 0x01 PersistOfferRequestKind byte = 0x02 )
const ( PING byte = 0x00 PONG byte = 0x01 FINDNODES byte = 0x02 NODES byte = 0x03 FINDCONTENT byte = 0x04 CONTENT byte = 0x05 OFFER byte = 0x06 ACCEPT byte = 0x07 )
Message codes for the portal protocol.
const ( ContentConnIdSelector byte = 0x00 ContentRawSelector byte = 0x01 ContentEnrsSelector byte = 0x02 )
Content selectors for the portal protocol.
const ( ContentKeysLimit = 64 // OfferMessageOverhead overhead of content message is a result of 1byte for kind enum, and // 4 bytes for offset in ssz serialization OfferMessageOverhead = 5 // PerContentKeyOverhead each key in ContentKeysList has uint32 offset which results in 4 bytes per // key overhead when serialized PerContentKeyOverhead = 4 )
Variables ¶
var ContentNotFound = storage.ErrContentNotFound
var ErrEmptyResp = errors.New("empty resp")
var ErrNilContentKey = errors.New("content key cannot be nil")
var MaxDistance = hexutil.MustDecode("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
Functions ¶
Types ¶
type Accept ¶
type Accept struct { ConnectionId []byte `ssz-size:"2"` ContentKeys []byte `ssz:"bitlist" ssz-max:"64"` }
Response messages for the portal protocol.
func (*Accept) HashTreeRoot ¶
HashTreeRoot ssz hashes the Accept object
func (*Accept) HashTreeRootWith ¶
func (a *Accept) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Accept object with a hasher
func (*Accept) MarshalSSZ ¶
MarshalSSZ ssz marshals the Accept object
func (*Accept) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Accept object to a target array
func (*Accept) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Accept object
type ConnectionId ¶
type ConnectionId struct {
Id []byte `ssz-size:"2"`
}
Response messages for the portal protocol.
func (*ConnectionId) GetTree ¶
func (c *ConnectionId) GetTree() (*ssz.Node, error)
GetTree ssz hashes the ConnectionId object
func (*ConnectionId) HashTreeRoot ¶
func (c *ConnectionId) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the ConnectionId object
func (*ConnectionId) HashTreeRootWith ¶
func (c *ConnectionId) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the ConnectionId object with a hasher
func (*ConnectionId) MarshalSSZ ¶
func (c *ConnectionId) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the ConnectionId object
func (*ConnectionId) MarshalSSZTo ¶
func (c *ConnectionId) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the ConnectionId object to a target array
func (*ConnectionId) SizeSSZ ¶
func (c *ConnectionId) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the ConnectionId object
func (*ConnectionId) UnmarshalSSZ ¶
func (c *ConnectionId) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the ConnectionId object
type Content ¶
type Content struct {
Content []byte `ssz-max:"2048"`
}
Response messages for the portal protocol.
func (*Content) HashTreeRoot ¶
HashTreeRoot ssz hashes the Content object
func (*Content) HashTreeRootWith ¶
func (c *Content) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Content object with a hasher
func (*Content) MarshalSSZ ¶
MarshalSSZ ssz marshals the Content object
func (*Content) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Content object to a target array
func (*Content) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Content object
type ContentElement ¶
type ContentEntry ¶
type ContentInfo ¶
type ContentInfoResp ¶
type DiscV5API ¶
func NewDiscV5API ¶
func (*DiscV5API) RecursiveFindNodes ¶
func (*DiscV5API) RoutingTableInfo ¶
func (d *DiscV5API) RoutingTableInfo() *RoutingTableInfo
type DiscV5PongResp ¶
type Enrs ¶
type Enrs struct {
Enrs [][]byte `ssz-max:"32,2048"`
}
Response messages for the portal protocol.
func (*Enrs) HashTreeRoot ¶
HashTreeRoot ssz hashes the Enrs object
func (*Enrs) HashTreeRootWith ¶
func (e *Enrs) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Enrs object with a hasher
func (*Enrs) MarshalSSZ ¶
MarshalSSZ ssz marshals the Enrs object
func (*Enrs) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Enrs object to a target array
func (*Enrs) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Enrs object
type FindContent ¶
type FindContent struct {
ContentKey []byte `ssz-max:"2048"`
}
Request messages for the portal protocol.
func (*FindContent) GetTree ¶
func (f *FindContent) GetTree() (*ssz.Node, error)
GetTree ssz hashes the FindContent object
func (*FindContent) HashTreeRoot ¶
func (f *FindContent) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the FindContent object
func (*FindContent) HashTreeRootWith ¶
func (f *FindContent) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the FindContent object with a hasher
func (*FindContent) MarshalSSZ ¶
func (f *FindContent) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the FindContent object
func (*FindContent) MarshalSSZTo ¶
func (f *FindContent) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the FindContent object to a target array
func (*FindContent) SizeSSZ ¶
func (f *FindContent) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the FindContent object
func (*FindContent) UnmarshalSSZ ¶
func (f *FindContent) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the FindContent object
type FindNodes ¶
type FindNodes struct {
Distances [][2]byte `ssz-max:"256,2" ssz-size:"?,2"`
}
Request messages for the portal protocol.
func (*FindNodes) HashTreeRoot ¶
HashTreeRoot ssz hashes the FindNodes object
func (*FindNodes) HashTreeRootWith ¶
func (f *FindNodes) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the FindNodes object with a hasher
func (*FindNodes) MarshalSSZ ¶
MarshalSSZ ssz marshals the FindNodes object
func (*FindNodes) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the FindNodes object to a target array
func (*FindNodes) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the FindNodes object
type NodeMetadata ¶
type Nodes ¶
Response messages for the portal protocol.
func (*Nodes) HashTreeRoot ¶
HashTreeRoot ssz hashes the Nodes object
func (*Nodes) HashTreeRootWith ¶
func (n *Nodes) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Nodes object with a hasher
func (*Nodes) MarshalSSZ ¶
MarshalSSZ ssz marshals the Nodes object
func (*Nodes) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Nodes object to a target array
func (*Nodes) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Nodes object
type Offer ¶
type Offer struct {
ContentKeys [][]byte `ssz-max:"64,2048"`
}
Request messages for the portal protocol.
func (*Offer) HashTreeRoot ¶
HashTreeRoot ssz hashes the Offer object
func (*Offer) HashTreeRootWith ¶
func (o *Offer) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Offer object with a hasher
func (*Offer) MarshalSSZ ¶
MarshalSSZ ssz marshals the Offer object
func (*Offer) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Offer object to a target array
func (*Offer) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Offer object
type OfferRequest ¶
type OfferRequest struct { Kind byte Request interface{} }
type OfferRequestWithNode ¶
type OfferRequestWithNode struct { Request *OfferRequest Node *enode.Node }
type PersistOfferRequest ¶
type PersistOfferRequest struct {
ContentKeys [][]byte
}
type Ping ¶
Request messages for the portal protocol.
func (*Ping) HashTreeRoot ¶
HashTreeRoot ssz hashes the Ping object
func (*Ping) HashTreeRootWith ¶
func (p *Ping) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Ping object with a hasher
func (*Ping) MarshalSSZ ¶
MarshalSSZ ssz marshals the Ping object
func (*Ping) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Ping object to a target array
func (*Ping) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Ping object
type PingPongCustomData ¶
type PingPongCustomData struct {
Radius []byte `ssz-size:"32"`
}
Request messages for the portal protocol.
func (*PingPongCustomData) GetTree ¶
func (p *PingPongCustomData) GetTree() (*ssz.Node, error)
GetTree ssz hashes the PingPongCustomData object
func (*PingPongCustomData) HashTreeRoot ¶
func (p *PingPongCustomData) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the PingPongCustomData object
func (*PingPongCustomData) HashTreeRootWith ¶
func (p *PingPongCustomData) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the PingPongCustomData object with a hasher
func (*PingPongCustomData) MarshalSSZ ¶
func (p *PingPongCustomData) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the PingPongCustomData object
func (*PingPongCustomData) MarshalSSZTo ¶
func (p *PingPongCustomData) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the PingPongCustomData object to a target array
func (*PingPongCustomData) SizeSSZ ¶
func (p *PingPongCustomData) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the PingPongCustomData object
func (*PingPongCustomData) UnmarshalSSZ ¶
func (p *PingPongCustomData) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the PingPongCustomData object
type Pong ¶
Response messages for the portal protocol.
func (*Pong) HashTreeRoot ¶
HashTreeRoot ssz hashes the Pong object
func (*Pong) HashTreeRootWith ¶
func (p *Pong) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the Pong object with a hasher
func (*Pong) MarshalSSZ ¶
MarshalSSZ ssz marshals the Pong object
func (*Pong) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Pong object to a target array
func (*Pong) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Pong object
type PortalPongResp ¶
type PortalProtocol ¶
type PortalProtocol struct { DiscV5 *discover.UDPv5 Log log.Logger PrivateKey *ecdsa.PrivateKey NetRestrict *netutil.Netlist BootstrapNodes []*enode.Node Utp *PortalUtp NAT nat.Interface // contains filtered or unexported fields }
func NewPortalProtocol ¶
func NewPortalProtocol(config *PortalProtocolConfig, protocolId ProtocolId, privateKey *ecdsa.PrivateKey, conn discover.UDPConn, localNode *enode.LocalNode, discV5 *discover.UDPv5, utp *PortalUtp, storage storage.ContentStorage, contentQueue chan *ContentElement, opts ...PortalProtocolOption) (*PortalProtocol, error)
func (*PortalProtocol) AddEnr ¶
func (p *PortalProtocol) AddEnr(n *enode.Node)
func (*PortalProtocol) ContentLookup ¶
func (p *PortalProtocol) ContentLookup(contentKey, contentId []byte) ([]byte, bool, error)
func (*PortalProtocol) Get ¶
func (p *PortalProtocol) Get(contentKey []byte, contentId []byte) ([]byte, error)
func (*PortalProtocol) GetContent ¶
func (p *PortalProtocol) GetContent() chan *ContentElement
func (*PortalProtocol) InRange ¶
func (p *PortalProtocol) InRange(contentId []byte) bool
func (*PortalProtocol) Lookup ¶
func (p *PortalProtocol) Lookup(target enode.ID) []*enode.Node
Lookup performs a recursive lookup for the given target. It returns the closest nodes to target.
func (*PortalProtocol) LookupRandom ¶
func (p *PortalProtocol) LookupRandom() []*enode.Node
LookupRandom looks up a random target. This is needed to satisfy the transport interface.
func (*PortalProtocol) LookupSelf ¶
func (p *PortalProtocol) LookupSelf() []*enode.Node
LookupSelf looks up our own node ID. This is needed to satisfy the transport interface.
func (*PortalProtocol) Put ¶
func (p *PortalProtocol) Put(contentKey []byte, contentId []byte, content []byte) error
func (*PortalProtocol) Radius ¶
func (p *PortalProtocol) Radius() *uint256.Int
func (*PortalProtocol) RequestENR ¶
func (*PortalProtocol) Resolve ¶
func (p *PortalProtocol) Resolve(n *enode.Node) *enode.Node
Resolve searches for a specific Node with the given ID and tries to get the most recent version of the Node record for it. It returns n if the Node could not be resolved.
func (*PortalProtocol) ResolveNodeId ¶
func (p *PortalProtocol) ResolveNodeId(id enode.ID) *enode.Node
ResolveNodeId searches for a specific Node with the given ID. It returns nil if the nodeId could not be resolved.
func (*PortalProtocol) RoutingTableInfo ¶
func (p *PortalProtocol) RoutingTableInfo() [][]string
func (*PortalProtocol) Self ¶
func (p *PortalProtocol) Self() *enode.Node
func (*PortalProtocol) Start ¶
func (p *PortalProtocol) Start() error
func (*PortalProtocol) Stop ¶
func (p *PortalProtocol) Stop()
func (*PortalProtocol) ToContentId ¶
func (p *PortalProtocol) ToContentId(contentKey []byte) []byte
func (*PortalProtocol) TraceContentLookup ¶
func (p *PortalProtocol) TraceContentLookup(contentKey, contentId []byte) (*TraceContentResult, error)
type PortalProtocolAPI ¶
type PortalProtocolAPI struct {
// contains filtered or unexported fields
}
func NewPortalAPI ¶
func NewPortalAPI(portalProtocol *PortalProtocol) *PortalProtocolAPI
func (*PortalProtocolAPI) AddEnrs ¶
func (p *PortalProtocolAPI) AddEnrs(enrs []string) bool
func (*PortalProtocolAPI) DeleteEnr ¶
func (p *PortalProtocolAPI) DeleteEnr(nodeId string) (bool, error)
func (*PortalProtocolAPI) FindContent ¶
func (p *PortalProtocolAPI) FindContent(enr string, contentKey string) (interface{}, error)
func (*PortalProtocolAPI) FindNodes ¶
func (p *PortalProtocolAPI) FindNodes(enr string, distances []uint) ([]string, error)
func (*PortalProtocolAPI) GetEnr ¶
func (p *PortalProtocolAPI) GetEnr(nodeId string) (string, error)
func (*PortalProtocolAPI) Gossip ¶
func (p *PortalProtocolAPI) Gossip(contentKeyHex, contentHex string) (int, error)
func (*PortalProtocolAPI) LocalContent ¶
func (p *PortalProtocolAPI) LocalContent(contentKeyHex string) (string, error)
func (*PortalProtocolAPI) LookupEnr ¶
func (p *PortalProtocolAPI) LookupEnr(nodeId string) (string, error)
func (*PortalProtocolAPI) NodeInfo ¶
func (p *PortalProtocolAPI) NodeInfo() *NodeInfo
func (*PortalProtocolAPI) Offer ¶
func (p *PortalProtocolAPI) Offer(enr string, contentItems [][2]string) (string, error)
func (*PortalProtocolAPI) Ping ¶
func (p *PortalProtocolAPI) Ping(enr string) (*PortalPongResp, error)
func (*PortalProtocolAPI) RecursiveFindContent ¶
func (p *PortalProtocolAPI) RecursiveFindContent(contentKeyHex string) (*ContentInfo, error)
func (*PortalProtocolAPI) RecursiveFindNodes ¶
func (p *PortalProtocolAPI) RecursiveFindNodes(nodeId string) ([]string, error)
func (*PortalProtocolAPI) RoutingTableInfo ¶
func (p *PortalProtocolAPI) RoutingTableInfo() *RoutingTableInfo
func (*PortalProtocolAPI) Store ¶
func (p *PortalProtocolAPI) Store(contentKeyHex string, contextHex string) (bool, error)
func (*PortalProtocolAPI) TraceRecursiveFindContent ¶
func (p *PortalProtocolAPI) TraceRecursiveFindContent(contentKeyHex string) (*TraceContentResult, error)
type PortalProtocolConfig ¶
type PortalProtocolConfig struct { BootstrapNodes []*enode.Node ListenAddr string NetRestrict *netutil.Netlist NodeRadius *uint256.Int RadiusCacheSize int NodeDBPath string NAT nat.Interface // contains filtered or unexported fields }
func DefaultPortalProtocolConfig ¶
func DefaultPortalProtocolConfig() *PortalProtocolConfig
type PortalProtocolOption ¶
type PortalProtocolOption func(p *PortalProtocol)
type PortalStorageMetrics ¶
type PortalStorageMetrics struct { RadiusRatio metrics.GaugeFloat64 EntriesCount metrics.Gauge ContentStorageUsage metrics.Gauge }
func NewPortalStorageMetrics ¶
func NewPortalStorageMetrics(network string, db *sql.DB) (*PortalStorageMetrics, error)
type PortalUtp ¶
type PortalUtp struct { ListenAddr string // contains filtered or unexported fields }
func NewPortalUtp ¶
func (*PortalUtp) AcceptWithCid ¶
func (*PortalUtp) DialWithCid ¶
type ProtocolId ¶
type ProtocolId []byte
var ( State ProtocolId = []byte{0x50, 0x0A} History ProtocolId = []byte{0x50, 0x0B} Beacon ProtocolId = []byte{0x50, 0x0C} CanonicalIndices ProtocolId = []byte{0x50, 0x0D} VerkleState ProtocolId = []byte{0x50, 0x0E} TransactionGossip ProtocolId = []byte{0x50, 0x0F} Utp ProtocolId = []byte{0x75, 0x74, 0x70} )
func (ProtocolId) Name ¶
func (p ProtocolId) Name() string
type RespByNode ¶
type RoutingTableInfo ¶
type Trace ¶
type Trace struct { Origin string `json:"origin"` // local node id TargetId string `json:"targetId"` // target content id ReceivedFrom string `json:"receivedFrom"` // the node id of which content from Responses map[string]RespByNode `json:"responses"` // the node id and there response nodeIds Metadata map[string]*NodeMetadata `json:"metadata"` // node id and there metadata object StartedAtMs int `json:"startedAtMs"` // timestamp of the beginning of this request in milliseconds Cancelled []string `json:"cancelled"` // the node ids which are send but cancelled }
type TraceContentResult ¶
type TransientOfferRequest ¶
type TransientOfferRequest struct {
Contents []*ContentEntry
}