Documentation
¶
Index ¶
- func EncodeOnion(on types.Onion) (b slice.Bytes)
- func Gen3Nonces() (n [3]nonce.IV)
- func GenCiphers(prvs [3]*prv.Key, pubs [3]*pub.Key) (ciphers [3]sha256.Hash)
- func GenPingNonces() (n [4]nonce.IV)
- func PeelOnion(b slice.Bytes, c *slice.Cursor) (on types.Onion, e error)
- type IndraNet
- type OnionSkins
- func Ping(id nonce.ID, client *node.Node, hop [3]*node.Node, set *signer.KeySet) OnionSkins
- func SendExit(payload slice.Bytes, port uint16, client *node.Node, hop [5]*node.Node, ...) OnionSkins
- func SendKeys(id nonce.ID, hdr, pld *prv.Key, client *node.Node, hop [5]*node.Node, ...) OnionSkins
- func SendPurchase(n nonce.ID, nBytes uint64, client *node.Node, hop [5]*node.Node, ...) OnionSkins
- func (o OnionSkins) Assemble() (on types.Onion)
- func (o OnionSkins) Cipher(hdr, pld *prv.Key) OnionSkins
- func (o OnionSkins) Confirmation(id nonce.ID) OnionSkins
- func (o OnionSkins) Delay(d time.Duration) OnionSkins
- func (o OnionSkins) Exit(port uint16, prvs [3]*prv.Key, pubs [3]*pub.Key, nonces [3]nonce.IV, ...) OnionSkins
- func (o OnionSkins) Forward(addr *netip.AddrPort) OnionSkins
- func (o OnionSkins) OnionSkin(to *pub.Key, from *prv.Key, n nonce.IV) OnionSkins
- func (o OnionSkins) Purchase(id nonce.ID, nBytes uint64, prvs [3]*prv.Key, pubs [3]*pub.Key, n [3]nonce.IV) OnionSkins
- func (o OnionSkins) Response(hash sha256.Hash, res slice.Bytes) OnionSkins
- func (o OnionSkins) Reverse(ip *netip.AddrPort) OnionSkins
- func (o OnionSkins) Session(hdr, pld *pub.Key) OnionSkins
- func (o OnionSkins) Token(tok sha256.Hash) OnionSkins
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gen3Nonces ¶
func GenPingNonces ¶
Types ¶
type OnionSkins ¶
func Ping ¶
Ping is a message which checks the liveness of relays by ensuring they are correctly relaying messages. Pending pings are stored in a table with the last hop as the key to narrow the number of elements to search through to find the matching cipher and reveal the contained ID inside it.
The pending ping records keep the identifiers of the three nodes that were in a ping onion and when the Confirmation is correctly received these nodes get an increment of their liveness score. By using this scheme, when nodes are offline their scores will fall to zero after a time whereas live nodes will have steadily increasing scores from successful pings.
func SendExit ¶
func SendExit(payload slice.Bytes, port uint16, client *node.Node, hop [5]*node.Node, sess [3]*session.Session, set *signer.KeySet) OnionSkins
SendExit constructs a message containing an arbitrary payload to a node (3rd hop) with a set of 3 ciphers derived from the hidden PayloadPub of the return hops that are layered progressively after the Exit message.
The Exit node forwards the packet it receives to the local port specified in the Exit message, and then uses the ciphers to encrypt the reply with the three ciphers provided, which don't enable it to decrypt the header, only to encrypt the payload.
The response is encrypted with the given layers, the ciphers are already given in reverse order, so they are decoded in given order to create the correct payload encryption to match the PayloadPub combined with the header's given public From key.
The header remains a constant size and each node in the Reverse trims off their section at the top, moves the next layer header to the top and pads the remainder with noise, so it always looks like the first hop.
func SendKeys ¶
func SendKeys(id nonce.ID, hdr, pld *prv.Key, client *node.Node, hop [5]*node.Node, set *signer.KeySet) OnionSkins
SendKeys provides a pair of private keys that will be used to generate the Purchase header bytes and to generate the ciphers provided in the Purchase message to encrypt the Session that is returned.
The OnionSkin key, its cloaked public key counterpart used in the To field of the Purchase message preformed header bytes, but the Ciphers provided in the Purchase message, for encrypting the Session to be returned, uses the Payload key, along with the public key found in the encrypted layer of the header for the Reverse relay.
This message's last layer is a Confirmation, which allows the client to know that the key was successfully delivered to the Reverse relays that will be used in the Purchase.
func SendPurchase ¶
func SendPurchase(n nonce.ID, nBytes uint64, client *node.Node, hop [5]*node.Node, sess [3]*session.Session, set *signer.KeySet) OnionSkins
SendPurchase delivers a request for keys for a relaying session with a given router (in this case, hop 2). It is almost identical to an Exit except the payload is always just a 64-bit unsigned integer.
The response, which will be two public keys that identify the session and form the basis of the cloaked "To" keys, is encrypted with the given layers, the ciphers are already given in reverse order, so they are decoded in given order to create the correct payload encryption to match the PayloadPub combined with the header's given public From key.
The header remains a constant size and each node in the Reverse trims off their section at the top, moves the next layer header to the top and pads the remainder with noise, so it always looks like the first hop, indistinguishable.
func (OnionSkins) Assemble ¶
func (o OnionSkins) Assemble() (on types.Onion)
Assemble inserts the slice of OnionSkin s inside each other so the first then contains the second, second contains the third, and so on, and then returns the first onion, on which you can then call Encode and generate the wire message form of the onion.
func (OnionSkins) Cipher ¶
func (o OnionSkins) Cipher(hdr, pld *prv.Key) OnionSkins
func (OnionSkins) Confirmation ¶
func (o OnionSkins) Confirmation(id nonce.ID) OnionSkins
func (OnionSkins) Delay ¶
func (o OnionSkins) Delay(d time.Duration) OnionSkins
func (OnionSkins) Forward ¶
func (o OnionSkins) Forward(addr *netip.AddrPort) OnionSkins
func (OnionSkins) OnionSkin ¶
func (o OnionSkins) OnionSkin(to *pub.Key, from *prv.Key, n nonce.IV) OnionSkins
func (OnionSkins) Response ¶
func (o OnionSkins) Response(hash sha256.Hash, res slice.Bytes) OnionSkins
func (OnionSkins) Reverse ¶
func (o OnionSkins) Reverse(ip *netip.AddrPort) OnionSkins
func (OnionSkins) Session ¶
func (o OnionSkins) Session(hdr, pld *pub.Key) OnionSkins
func (OnionSkins) Token ¶
func (o OnionSkins) Token(tok sha256.Hash) OnionSkins