sessions

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circuit

type Circuit [5]*Data

A Circuit is the generic fixed-length path used for most messages.

func (Circuit) String

func (c Circuit) String() (o string)

type Data

type Data struct {
	ID              nonce.ID
	Node            *node.Node
	Remaining       lnwire.MilliSatoshi
	Header, Payload *crypto.Keys
	Preimage        sha256.Hash
	Hop             byte
}

A Data keeps track of a connection session. It specifically maintains the account of available bandwidth allocation before it needs to be recharged with new credit, and the current state of the encryption.

func NewSessionData

func NewSessionData(
	id nonce.ID,
	node *node.Node,
	rem lnwire.MilliSatoshi,
	hdr, pld *crypto.Keys,
	hop byte,
) (s *Data)

NewSessionData creates a new Data, generating cached public key bytes and preimage.

func (*Data) DecSats

func (s *Data) DecSats(sats lnwire.MilliSatoshi, sender bool,
	typ string) bool

DecSats reduces the amount Remaining, if the requested amount would put the total below zero it returns false, signalling that new data allowance needs to be purchased before any further messages can be sent.

func (*Data) IncSats

func (s *Data) IncSats(sats lnwire.MilliSatoshi, sender bool, typ string)

IncSats adds to the Remaining counter, used when new data allowance has been purchased.

func (*Data) String

func (s *Data) String() string

type Sessions

type Sessions []*Data

Sessions are arbitrary length lists of Data.

Jump to

Keyboard shortcuts

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