Documentation ¶
Overview ¶
Package sessions defines some key data structures relating to the data for sessions, imported by sess package for reading and writing session and circuit metadata.
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.
type Data ¶
type Data struct { // ID is the internal reference used by other data structures referring to this // one. ID nonce.ID // Node is the node.Node that is providing the relaying service. Node *node.Node // Remaining is the current balance on the session. Remaining lnwire.MilliSatoshi // Header and Payload are the two key sets used for data relayed for this // session. Header keys are embedded in the 3 layer RoutingHeader, and Payload // keys are only used to derive the secrets used with the given public sender key // that enables the Exit and Hidden Service to encrypt replies that then get // unwrapped successively on the return path. Header, Payload *crypto.Keys // Preimage is essentially the hash of the bytes of the Header and Payload keys. // This enables the relay to associate a payment with a session key pair and thus // to be able to account the client's usage. Preimage sha256.Hash // Hop is the position at which this session is used, private and secret to the // client. Sessions are prescribed to be used at a given position only, in order // to prevent any cross correlations being visible. 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 ¶
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.