Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct { nonce.ID *node.Node Remaining uint64 HeaderPub, PayloadPub *pub.Key HeaderBytes, PayloadBytes pub.Bytes HeaderPrv, PayloadPrv *prv.Key Deadline time.Time }
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 ¶
NewSession creates a new Session.
Purchasing a session the seller returns a token, based on a requested data allocation.
func (*Session) AddBytes ¶
AddBytes adds to the Remaining counter, used when new data allowance has been purchased.
func (*Session) SubtractBytes ¶
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.