Documentation
¶
Index ¶
Constants ¶
const ( // MaxCapabilities is the maximum number of capabilities per payload. MaxCapabilities = 32 // MaxDataSize is the maximum size of capability payload. MaxDataSize = 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archival ¶ added in v0.108.0
type Archival struct{}
Archival represents an archival node that stores all blocks.
func (*Archival) DecodeBinary ¶ added in v0.108.0
DecodeBinary implements io.Serializable.
func (*Archival) EncodeBinary ¶ added in v0.108.0
EncodeBinary implements io.Serializable.
type Capabilities ¶
type Capabilities []Capability
Capabilities is a list of Capability.
func (*Capabilities) DecodeBinary ¶
func (cs *Capabilities) DecodeBinary(br *io.BinReader)
DecodeBinary implements io.Serializable.
func (*Capabilities) EncodeBinary ¶
func (cs *Capabilities) EncodeBinary(br *io.BinWriter)
EncodeBinary implements io.Serializable.
func (*Capabilities) IsArchivalNode ¶ added in v0.110.0
func (cs *Capabilities) IsArchivalNode() bool
IsArchivalNode denotes whether the node has Archival capability.
type Capability ¶
type Capability struct {
Type Type
Data io.Serializable
}
Capability describes a network service available for the node.
func (*Capability) DecodeBinary ¶
func (c *Capability) DecodeBinary(br *io.BinReader)
DecodeBinary implements io.Serializable.
func (*Capability) EncodeBinary ¶
func (c *Capability) EncodeBinary(bw *io.BinWriter)
EncodeBinary implements io.Serializable.
type DisableCompression ¶ added in v0.109.0
type DisableCompression struct{}
DisableCompression represents the node that doesn't compress any P2P payloads.
func (*DisableCompression) DecodeBinary ¶ added in v0.109.0
func (d *DisableCompression) DecodeBinary(br *io.BinReader)
DecodeBinary implements io.Serializable.
func (*DisableCompression) EncodeBinary ¶ added in v0.109.0
func (d *DisableCompression) EncodeBinary(bw *io.BinWriter)
EncodeBinary implements io.Serializable.
type Node ¶
type Node struct {
StartHeight uint32
}
Node represents full node capability with a start height.
func (*Node) DecodeBinary ¶
DecodeBinary implements io.Serializable.
func (*Node) EncodeBinary ¶
EncodeBinary implements io.Serializable.
type Server ¶
type Server struct {
// Port is the port this server is listening on.
Port uint16
}
Server represents TCP or WS server capability with a port.
func (*Server) DecodeBinary ¶
DecodeBinary implements io.Serializable.
func (*Server) EncodeBinary ¶
EncodeBinary implements io.Serializable.
type Type ¶
type Type byte
Type represents node capability type.
const ( // TCPServer represents TCP node capability type. TCPServer Type = 0x01 // WSServer represents WebSocket node capability type. WSServer Type = 0x02 // DisableCompressionNode represents node capability that disables P2P // payloads compression. DisableCompressionNode Type = 0x03 // FullNode represents a node that has complete current state. FullNode Type = 0x10 // ArchivalNode represents a node that stores full block history. // These nodes can be used for P2P synchronization from genesis // (FullNode can cut the tail and may not respond to requests for // old (wrt MaxTraceableBlocks) blocks). ArchivalNode Type = 0x11 // 0xf0-0xff are reserved for private experiments. ReservedFirst Type = 0xf0 ReservedLast Type = 0xff )
type Unknown ¶ added in v0.108.0
type Unknown []byte
Unknown represents an unknown capability with some data. Other nodes can decode it even if they can't interpret it. This is not expected to be used for sending data directly (proper new types should be used), but it allows for easier protocol extensibility (old nodes won't reject new capabilities).
func (*Unknown) DecodeBinary ¶ added in v0.108.0
DecodeBinary implements io.Serializable.
func (*Unknown) EncodeBinary ¶ added in v0.108.0
EncodeBinary implements io.Serializable.