Documentation ¶
Index ¶
- type Circuit
- type PaymentChan
- type Payments
- func (n *Payments) AddPendingPayment(np *payment.Payment)
- func (n *Payments) AddSession(s *Session)
- func (n *Payments) DeletePendingPayment(preimage sha256.Hash)
- func (n *Payments) DeleteSession(id nonce.ID)
- func (n *Payments) FindPendingPayment(id nonce.ID) (pp *payment.Payment)
- func (n *Payments) FindPendingPreimage(pi sha256.Hash) (pp *payment.Payment)
- func (n *Payments) FindSession(id nonce.ID) *Session
- func (n *Payments) GetSessionByIndex(i int) (s *Session)
- func (n *Payments) GetSessionsAtHop(hop byte) (s Sessions)
- func (n *Payments) IterateSessions(fn func(s *Session) bool)
- type PendingPayments
- type Session
- type Sessions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentChan ¶
type Payments ¶
type Payments struct { Sessions Sessions PaymentChan sync.Mutex // contains filtered or unexported fields }
func NewPayments ¶
func NewPayments() *Payments
func (*Payments) AddPendingPayment ¶
func (*Payments) AddSession ¶
func (*Payments) DeletePendingPayment ¶
func (*Payments) DeleteSession ¶
func (*Payments) FindPendingPayment ¶
func (*Payments) FindPendingPreimage ¶
func (*Payments) GetSessionByIndex ¶
func (*Payments) GetSessionsAtHop ¶
func (*Payments) IterateSessions ¶
type PendingPayments ¶
func (PendingPayments) Add ¶
func (p PendingPayments) Add(np *payment.Payment) (pp PendingPayments)
func (PendingPayments) Delete ¶
func (p PendingPayments) Delete(preimage sha256.Hash) (pp PendingPayments)
func (PendingPayments) FindPreimage ¶
func (p PendingPayments) FindPreimage(pi sha256.Hash) (pp *payment.Payment)
type Session ¶
type Session struct { ID nonce.ID *identity.Peer Remaining lnwire.MilliSatoshi HeaderPrv, PayloadPrv *prv.Key HeaderPub, PayloadPub *pub.Key HeaderBytes, PayloadBytes pub.Bytes Preimage sha256.Hash Hop byte }
A Session 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 NewSession ¶
func NewSession( id nonce.ID, node *identity.Peer, rem lnwire.MilliSatoshi, hdrPrv *prv.Key, pldPrv *prv.Key, hop byte, ) (s *Session)
NewSession creates a new Session.
Purchasing a session the seller returns a token, based on a requested data allocation.
func (*Session) AddBytes ¶
func (s *Session) AddBytes(b lnwire.MilliSatoshi)
AddBytes adds to the Remaining counter, used when new data allowance has been purchased.
func (*Session) SubtractBytes ¶
func (s *Session) SubtractBytes(b lnwire.MilliSatoshi) bool
SubtractBytes 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.