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 GenNonces(count int) (n []nonce.IV)
- func GenPingNonces() (n [4]nonce.IV)
- func PeelOnion(b slice.Bytes, c *slice.Cursor) (on types.Onion, e error)
- type IndraNet
- type 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) 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 5 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 []*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 keys were successfully delivered.
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