Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func ExtractVersion(r io.Reader) (*semver.Version, error)
- func ReadFrame(r io.Reader) (uint64, error)
- func VersionAsBuffer() bytes.Buffer
- func WriteFrame(buf *bytes.Buffer, cs []byte) error
- func WriteFrameWithReserved(buf *bytes.Buffer, cs []byte, reserved uint64) error
- type Gossip
- func (g *Gossip) Process(m *bytes.Buffer) error
- func (g *Gossip) ProcessWithReserved(m *bytes.Buffer, reserved uint64) error
- func (g *Gossip) ReadFrame(src io.Reader) ([]byte, error)
- func (g *Gossip) ReadMessage(src io.Reader) ([]byte, error)
- func (g *Gossip) UnpackLength(r io.Reader) (uint64, error)
- type ServiceFlag
- type Version
Constants ¶
const ( // MaxFrameSize is set at 1375000 bytes. MaxFrameSize = uint64(1375000) // VersionLength is number of bytes the version uses. VersionLength = uint64(8) )
const VersionConstraintString = "~0.1.0"
VersionConstraintString represent the needed version.
Variables ¶
var CurrentProtocolVersion = semver.MustParse("0.1.0")
CurrentProtocolVersion indicates the protocol version used.
var NodeVer = &Version{
Major: 0,
Minor: 4,
Patch: 3,
}
NodeVer is the current node version. This is used only in the handshake, need to be removed.
var VersionConstraint, _ = semver.NewConstraint(VersionConstraintString)
VersionConstraint check incoming versions.
Functions ¶
func ExtractVersion ¶ added in v0.5.0
ExtractVersion extracts the version from io.Reader.
func ReadFrame ¶ added in v0.4.0
ReadFrame extract the bytes representing the size of the packet and thus read the amount of bytes specified by such prefix in little endianness.
func VersionAsBuffer ¶ added in v0.5.0
VersionAsBuffer returns protocol version encoded as BytesBuffer.
func WriteFrame ¶ added in v0.4.0
WriteFrame same as WriteFrameWithReserved but with reserved field fixed to 0.
Types ¶
type Gossip ¶ added in v0.4.0
type Gossip struct { }
Gossip is a preprocessor/reader for gossip messages.
func NewGossip ¶ added in v0.4.0
func NewGossip() *Gossip
NewGossip returns a gossip preprocessor with the specified magic.
func (*Gossip) Process ¶ added in v0.4.0
Process same as ProcessWithReserved but with reserved field fixed to 0.
func (*Gossip) ProcessWithReserved ¶ added in v0.6.0
ProcessWithReserved process a message that is passing through, by prepending magic and the message checksum, and finally by prepending the length. It allows to set reserved field.
func (*Gossip) ReadFrame ¶ added in v0.4.0
ReadFrame extract message from gossip frame, if no errors found.
func (*Gossip) ReadMessage ¶ added in v0.4.0
ReadMessage reads from the connection. TODO: Replace ReadMessage with ReadFrame.
type ServiceFlag ¶
type ServiceFlag uint64
ServiceFlag indicates the services provided by the Node.
const ( // FullNode indicates that a user is running the full node implementation of Dusk. FullNode ServiceFlag = 1 )