load

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Overview

Package load provides a message type that provides information about the current load level of a node identified by its public key.

Index

Constants

View Source
const (
	Magic = "load"
	Len   = ad.Len + 1
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function for an Ad.

func Splice

func Splice(s *splice.Splice, id nonce.ID, key *crypto.Pub,
	load byte, expiry time.Time)

Splice the Ad into a splice.Splice.

Types

type Ad struct {

	// Embed ad.Ad for the common fields
	ad.Ad

	// Load is a value that represents utilisation as a value from 0 to 255.
	Load byte
}

Ad stores a specification for the fee rate and existence of a peer.

func New

func New(id nonce.ID, key *crypto.Prv, load byte,
	expiry time.Time) (loAd *Ad)

New creates a new Ad.

func (*Ad) Decode

func (x *Ad) Decode(s *splice.Splice) (e error)

Decode unpacks a binary encoded form of the Ad and populates itself.

func (*Ad) Encode

func (x *Ad) Encode(s *splice.Splice) (e error)

Encode the Ad into a splice.Splice for wire or storage.

func (*Ad) Len

func (x *Ad) Len() int

Len is the number of bytes required for the binary encoded form of an Ad.

func (*Ad) Magic

func (x *Ad) Magic() string

Magic is the identifying 4 byte string used to mark the beginning of a message and designate the type.

func (*Ad) Sign added in v0.1.20

func (x *Ad) Sign(prv *crypto.Prv) (e error)

func (*Ad) Splice

func (x *Ad) Splice(s *splice.Splice)

Splice the Ad into a splice.Splice.

func (*Ad) SpliceNoSig

func (x *Ad) SpliceNoSig(s *splice.Splice)

SpliceNoSig encodes the message but stops at the signature.

func (*Ad) Unwrap

func (x *Ad) Unwrap() interface{}

Unwrap returns nil because there is no onion inside an Ad.

func (*Ad) Validate

func (x *Ad) Validate() (valid bool)

Validate returns true if the signature matches the public key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL