Starting on defining onion message formal layout

This commit is contained in:
David Vennik
2022-12-05 07:22:37 +01:00
parent 3bef3bafef
commit 01ba16f0e2
4 changed files with 14 additions and 15 deletions

View File

@@ -26,14 +26,14 @@ type Circuit struct {
Exit int
}
func (c *Circuit) GenerateOnion(exit []byte, messages [][]byte) (msg []byte,
e error) {
if len(messages) != len(c.Hops) {
e = fmt.Errorf("mismatch of message count, %d messages, %d hops",
len(messages), len(c.Hops))
return
}
// EncodeOnion uses a Circuit to create an onion message. An onion message
// consists of a series of layers containing the IP address to forward the
// attached payload and at the Exit hop there is an arbitrary blob of data.
//
// When there is additional hops after the Exit, these hops are interpreted to
// mean to expect a response to pass from the Exit hop and these layers contain
// a compound cipher for the remainder of the path.
func (c *Circuit) EncodeOnion(message []byte) (msg []byte, e error) {
return
}

View File

@@ -195,9 +195,8 @@ func Decode(d []byte, from *pub.Key, to *prv.Key) (f *Packet, e error) {
}
// This decrypts the rest of the packet, which is encrypted for
// security.
ciph.Encipher(blk, nonc, d[SigEnd:])
// Trim off the nonce and recipient fingerprint, which is now encrypted.
data := d[SigEnd:]
ciph.Encipher(blk, nonc, data)
var seq slice.Size16
var length slice.Size32
seq, data = slice.Cut(data, slice.Uint16Len)

View File

@@ -67,7 +67,7 @@ type ExitMsg struct {
// dead relays can be eliminated by the ones that are known and responding.
//
// In a standard path diagnostic onion, one of these contains another, which
// contains another message, the last one informing the node of the node that
// contains another message, the last one informing the client of the node that
// succeeded in the path trace.
//
// The last layer of the onion contains the public key of the hop this

View File

@@ -13,11 +13,11 @@ var (
// GitRef is the gitref, as in refs/heads/branchname.
GitRef = "refs/heads/main"
// ParentGitCommit is the commit hash of the parent HEAD.
ParentGitCommit = "f04afa67f0979c474b46e0467c5986fa39b494c2"
ParentGitCommit = "332f068fef9d0f50bdc8c1f96ce7b7b7ec2eca21"
// BuildTime stores the time when the current binary was built.
BuildTime = "2022-12-03T16:03:18+01:00"
BuildTime = "2022-12-05T07:22:37+01:00"
// SemVer lists the (latest) git tag on the build.
SemVer = "v0.0.145"
SemVer = "v0.0.146"
// PathBase is the path base returned from runtime caller.
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
// Major is the major number from the tag.
@@ -25,7 +25,7 @@ var (
// Minor is the minor number from the tag.
Minor = 0
// Patch is the patch version number from the tag.
Patch = 145
Patch = 146
)
// Version returns a pretty printed version information string.