peer

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: 11 Imported by: 0

Documentation

Overview

Package peer provides a message type that provides the base information, identity key and relay rate for an Indra relay.

Index

Constants

View Source
const (
	Magic = "pead"
	Len   = ad.Len +
		slice.Uint32Len
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

func Splice

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

Splice serializes an Ad into a splice.Splice.

Types

type Ad struct {

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

	// RelayRate is the fee for forwarding packets, mSAT/Mb (1024^3 bytes).
	RelayRate uint32
}

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

func New

func New(id nonce.ID, key *crypto.Prv, relayRate uint32,
	expiry time.Time) (peerAd *Ad)

New creates a new Ad and signs it with the provided private key.

func (*Ad) Decode

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

Decode an Ad out of the next bytes of a splice.Splice.

func (*Ad) Encode

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

Encode an Ad into the next bytes of a splice.Splice.

func (*Ad) Len

func (x *Ad) Len() int

Len returns the length of the binary encoded Ad.

func (*Ad) Magic

func (x *Ad) Magic() string

Magic is the identifier indicating an Ad is encoded in the following bytes.

func (*Ad) Sign

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

func (*Ad) Splice

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

Splice serializes an Ad into a splice.Splice.

func (*Ad) SpliceNoSig

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

SpliceNoSig serializes the Ad but stops at the signature.

func (*Ad) Unwrap

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

Unwrap returns nil because there is no onion inside.

func (*Ad) Validate

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

Validate checks the signature matches the public key of the Ad.

Jump to

Keyboard shortcuts

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