From a08ce64437b6c970d5fad4e6d1dab8b0a702d971 Mon Sep 17 00:00:00 2001 From: David Vennik Date: Thu, 29 Dec 2022 08:07:49 +0000 Subject: [PATCH 1/5] fixing workflow command --- .github/workflows/go.yml | 2 +- version.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8a0d95fb..4844f72f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -22,7 +22,7 @@ jobs: go-version: 1.19 - name: Build - run: go release -v ./... + run: go build -v ./... - name: Test run: go test -v ./... diff --git a/version.go b/version.go index f5de0cfc..794c196d 100644 --- a/version.go +++ b/version.go @@ -8,21 +8,21 @@ var ( // URL is the git URL for the repository. URL = "github.com/Indra-Labs/indra" // GitRef is the gitref, as in refs/heads/branchname. - GitRef = "refs/heads/ind-bootstrap" + GitRef = "refs/heads/main" // ParentGitCommit is the commit hash of the parent HEAD. - ParentGitCommit = "2dc3027cf28b04b52b8bca3839a96267122f8b92" + ParentGitCommit = "090ea9584cb7987911cccd390e5470e966938378" // BuildTime stores the time when the current binary was built. - BuildTime = "2022-12-29T02:49:15Z" - // SemVer lists the (latest) git tag on the release. - SemVer = "v0.0.255" + BuildTime = "2022-12-29T08:07:49Z" + // SemVer lists the (latest) git tag on the build. + SemVer = "v0.0.256" // PathBase is the path base returned from runtime caller. - PathBase = "/home/lyo/Seafile/Git/indra-labs/indra/" + PathBase = "/home/loki/src/github.com/Indra-Labs/indra/" // Major is the major number from the tag. Major = 0 // Minor is the minor number from the tag. Minor = 0 // Patch is the patch version number from the tag. - Patch = 255 + Patch = 256 ) // Version returns a pretty printed version information string. From dd440bbac6f075e4c404b6bc9fc2c863ccfe6857 Mon Sep 17 00:00:00 2001 From: David Vennik Date: Thu, 29 Dec 2022 09:14:38 +0000 Subject: [PATCH 2/5] fixed some names to be more concise --- pkg/client/client.go | 120 +++++++++--------- pkg/client/client_test.go | 1 - pkg/wire/cipher/cipher.go | 4 - pkg/wire/codec.go | 12 +- pkg/wire/codec_test.go | 16 +-- .../{confirmation => confirm}/confirmation.go | 2 +- pkg/wire/layers.go | 8 +- pkg/wire/onion_test.go | 12 +- pkg/wire/{reply => reverse}/reply.go | 2 +- version.go | 10 +- 10 files changed, 92 insertions(+), 95 deletions(-) rename pkg/wire/{confirmation => confirm}/confirmation.go (98%) rename pkg/wire/{reply => reverse}/reply.go (99%) diff --git a/pkg/client/client.go b/pkg/client/client.go index 9f028a32..90580791 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -17,15 +17,15 @@ import ( "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire" "github.com/Indra-Labs/indra/pkg/wire/cipher" - "github.com/Indra-Labs/indra/pkg/wire/confirmation" + "github.com/Indra-Labs/indra/pkg/wire/confirm" "github.com/Indra-Labs/indra/pkg/wire/delay" "github.com/Indra-Labs/indra/pkg/wire/exit" "github.com/Indra-Labs/indra/pkg/wire/forward" "github.com/Indra-Labs/indra/pkg/wire/layer" "github.com/Indra-Labs/indra/pkg/wire/noop" "github.com/Indra-Labs/indra/pkg/wire/purchase" - "github.com/Indra-Labs/indra/pkg/wire/reply" "github.com/Indra-Labs/indra/pkg/wire/response" + "github.com/Indra-Labs/indra/pkg/wire/reverse" "github.com/Indra-Labs/indra/pkg/wire/session" "github.com/Indra-Labs/indra/pkg/wire/token" log2 "github.com/cybriq/proc/pkg/log" @@ -69,66 +69,66 @@ func New(tpt ifc.Transport, hdrPrv *prv.Key, no *node.Node, } // Start a single thread of the Client. -func (c *Client) Start() { +func (cl *Client) Start() { out: for { - if c.runner() { + if cl.runner() { break out } } } -func (c *Client) runner() (out bool) { +func (cl *Client) runner() (out bool) { select { - case <-c.C.Wait(): - c.Cleanup() + case <-cl.C.Wait(): + cl.Cleanup() out = true break - case b := <-c.Node.Receive(): + case b := <-cl.Node.Receive(): // process received message var onion types.Onion var e error - cur := slice.NewCursor() - if onion, e = wire.PeelOnion(b, cur); check(e) { + c := slice.NewCursor() + if onion, e = wire.PeelOnion(b, c); check(e) { break } switch on := onion.(type) { case *cipher.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.cipher(on, b, cur) - case *confirmation.OnionSkin: + cl.cipher(on, b, c) + case *confirm.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.confirmation(on, b, cur) + cl.confirm(on, b, c) case *delay.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.delay(on, b, cur) + cl.delay(on, b, c) case *exit.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.exit(on, b, cur) + cl.exit(on, b, c) case *forward.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.forward(on, b, cur) + cl.forward(on, b, c) case *layer.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.layer(on, b, cur) + cl.layer(on, b, c) case *noop.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.noop(on, b, cur) + cl.noop(on, b, c) case *purchase.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.purchase(on, b, cur) - case *reply.OnionSkin: + cl.purchase(on, b, c) + case *reverse.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.reply(on, b, cur) + cl.reply(on, b, c) case *response.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.response(on, b, cur) + cl.response(on, b, c) case *session.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.session(on, b, cur) + cl.session(on, b, c) case *token.OnionSkin: log.I.Ln(reflect.TypeOf(on)) - c.token(on, b, cur) + cl.token(on, b, c) default: log.I.S("unrecognised packet", b) } @@ -136,91 +136,93 @@ func (c *Client) runner() (out bool) { return false } -func (c *Client) cipher(on *cipher.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) cipher(on *cipher.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // This either is in a forward only SendKeys message or we are the buyer // and these are our session keys. } -func (c *Client) confirmation(on *confirmation.OnionSkin, b slice.Bytes, - cur *slice.Cursor) { +func (cl *Client) confirm(on *confirm.OnionSkin, b slice.Bytes, + c *slice.Cursor) { // This will be an 8 byte nonce that confirms a message passed, ping and // cipher onions return these, as they are pure forward messages that // send a message one way and the confirmation is the acknowledgement. log.I.S(on) } -func (c *Client) delay(on *delay.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) delay(on *delay.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // this is a message to hold the message in the buffer until a duration // elapses. The accounting for the remainder of the message adds a // factor to the effective byte consumption in accordance with the time // to be stored. } -func (c *Client) exit(on *exit.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) exit(on *exit.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // payload is forwarded to a local port and the response is forwarded // back with a reply header. } -func (c *Client) forward(on *forward.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) forward(on *forward.OnionSkin, b slice.Bytes, c *slice.Cursor) { // forward the whole buffer received onwards. Usually there will be a // layer.OnionSkin under this which will be unwrapped by the receiver. - if on.AddrPort.String() == c.Node.AddrPort.String() { + if on.AddrPort.String() == cl.Node.AddrPort.String() { // it is for us, we want to unwrap the next // part. - log.I.Ln("processing new message") - c.Node.Send(b[*cur:]) + log.I.Ln("processing new message", *c) + b = append(b[*c:], slice.NoisePad(int(*c))...) + cl.Node.Send(b) } else { // we need to forward this message onion. log.I.Ln("forwarding") - c.Send(on.AddrPort, b) + cl.Send(on.AddrPort, b) } } -func (c *Client) layer(on *layer.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) layer(on *layer.OnionSkin, b slice.Bytes, c *slice.Cursor) { // this is probably an encrypted layer for us. log.I.Ln("decrypting onion skin") - // log.I.S(on, b[*cur:].ToBytes()) - rcv := c.ReceiveCache.FindCloaked(on.Cloak) + // log.I.S(on, b[*c:].ToBytes()) + rcv := cl.ReceiveCache.FindCloaked(on.Cloak) if rcv == nil { log.I.Ln("no matching key found from cloaked key") return } - on.Decrypt(rcv.Key, b, cur) - log.I.S(b[*cur:].ToBytes()) - c.Node.Send(b[*cur:]) + on.Decrypt(rcv.Key, b, c) + b = append(b[*c:], slice.NoisePad(int(*c))...) + log.I.S(b.ToBytes()) + cl.Node.Send(b) } -func (c *Client) noop(on *noop.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) noop(on *noop.OnionSkin, b slice.Bytes, c *slice.Cursor) { // this won't happen normally } -func (c *Client) purchase(on *purchase.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) purchase(on *purchase.OnionSkin, b slice.Bytes, c *slice.Cursor) { // Create a new Session. s := &Session{} - c.Mutex.Lock() + cl.Mutex.Lock() s.Deadline = time.Now().Add(DefaultDeadline) - c.Sessions = append(c.Sessions, s) - c.Mutex.Unlock() + cl.Sessions = append(cl.Sessions, s) + cl.Mutex.Unlock() } -func (c *Client) reply(on *reply.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) reply(on *reverse.OnionSkin, b slice.Bytes, c *slice.Cursor) { // Reply means another OnionSkin is coming and the payload encryption // uses the Payload key. - if on.AddrPort.String() == c.Node.AddrPort.String() { + if on.AddrPort.String() == cl.Node.AddrPort.String() { // it is for us, we want to unwrap the next part. - c.Node.Send(b) + cl.Node.Send(b) } else { // we need to forward this message onion. - c.Send(on.AddrPort, b) + cl.Send(on.AddrPort, b) } } -func (c *Client) response(on *response.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) response(on *response.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // Response is a payload from an exit message. } -func (c *Client) session(s *session.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) session(s *session.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // Session is returned from a Purchase message in the reply layers. // // Session has a nonce.ID that is given in the last layer of a LN sphinx @@ -229,26 +231,26 @@ func (c *Client) session(s *session.OnionSkin, b slice.Bytes, cur *slice.Cursor) // nonce, so long as it has not yet expired. } -func (c *Client) token(t *token.OnionSkin, b slice.Bytes, cur *slice.Cursor) { +func (cl *Client) token(t *token.OnionSkin, b slice.Bytes, cur *slice.Cursor) { // not really sure if we are using these. return } -func (c *Client) Cleanup() { +func (cl *Client) Cleanup() { // Do cleanup stuff before shutdown. } -func (c *Client) Shutdown() { - c.C.Q() +func (cl *Client) Shutdown() { + cl.C.Q() } -func (c *Client) Send(addr *netip.AddrPort, b slice.Bytes) { +func (cl *Client) Send(addr *netip.AddrPort, b slice.Bytes) { // first search if we already have the node available with connection // open. as := addr.String() - for i := range c.Nodes { - if as == c.Nodes[i].Addr { - c.Nodes[i].Transport.Send(b) + for i := range cl.Nodes { + if as == cl.Nodes[i].Addr { + cl.Nodes[i].Transport.Send(b) return } } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 65f901f5..1f1a471a 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -38,7 +38,6 @@ func TestPing(t *testing.T) { } pldPub := pub.Derive(pldPrv) addr := slice.GenerateRandomAddrPortIPv4() - log.I.S(addr) nodes[i], _ = node.New(addr, hdrPub, pldPub, hdrPrv, pldPrv, transports[i]) if clients[i], e = New(transports[i], hdrPrv, nodes[i], nil); check(e) { t.Error(e) diff --git a/pkg/wire/cipher/cipher.go b/pkg/wire/cipher/cipher.go index 123f0007..22cebd91 100644 --- a/pkg/wire/cipher/cipher.go +++ b/pkg/wire/cipher/cipher.go @@ -23,10 +23,6 @@ var ( // // After ~10 seconds these can be purged from the cache as they are otherwise a // DoS vector buffer flooding. -// -// The Decode function wipes the original message data for security as the -// private keys inside it are no longer needed and any secret should only have -// one storage, so it doesn't appear in any GC later. type OnionSkin struct { Header, Payload *pub.Key types.Onion diff --git a/pkg/wire/codec.go b/pkg/wire/codec.go index b0f04240..047e5d6e 100644 --- a/pkg/wire/codec.go +++ b/pkg/wire/codec.go @@ -7,15 +7,15 @@ import ( "github.com/Indra-Labs/indra/pkg/slice" "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire/cipher" - "github.com/Indra-Labs/indra/pkg/wire/confirmation" + "github.com/Indra-Labs/indra/pkg/wire/confirm" "github.com/Indra-Labs/indra/pkg/wire/delay" "github.com/Indra-Labs/indra/pkg/wire/exit" "github.com/Indra-Labs/indra/pkg/wire/forward" "github.com/Indra-Labs/indra/pkg/wire/layer" "github.com/Indra-Labs/indra/pkg/wire/magicbytes" "github.com/Indra-Labs/indra/pkg/wire/purchase" - "github.com/Indra-Labs/indra/pkg/wire/reply" "github.com/Indra-Labs/indra/pkg/wire/response" + "github.com/Indra-Labs/indra/pkg/wire/reverse" "github.com/Indra-Labs/indra/pkg/wire/session" "github.com/Indra-Labs/indra/pkg/wire/token" log2 "github.com/cybriq/proc/pkg/log" @@ -42,8 +42,8 @@ func PeelOnion(b slice.Bytes, c *slice.Cursor) (on types.Onion, e error) { return } on = o - case confirmation.MagicString: - o := &confirmation.OnionSkin{} + case confirm.MagicString: + o := &confirm.OnionSkin{} if e = o.Decode(b, c); check(e) { return } @@ -78,8 +78,8 @@ func PeelOnion(b slice.Bytes, c *slice.Cursor) (on types.Onion, e error) { return } on = o - case reply.MagicString: - o := &reply.OnionSkin{} + case reverse.MagicString: + o := &reverse.OnionSkin{} if e = o.Decode(b, c); check(e) { return } diff --git a/pkg/wire/codec_test.go b/pkg/wire/codec_test.go index 660912dd..973e37b5 100644 --- a/pkg/wire/codec_test.go +++ b/pkg/wire/codec_test.go @@ -17,14 +17,14 @@ import ( "github.com/Indra-Labs/indra/pkg/testutils" "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire/cipher" - "github.com/Indra-Labs/indra/pkg/wire/confirmation" + "github.com/Indra-Labs/indra/pkg/wire/confirm" "github.com/Indra-Labs/indra/pkg/wire/delay" "github.com/Indra-Labs/indra/pkg/wire/exit" "github.com/Indra-Labs/indra/pkg/wire/forward" "github.com/Indra-Labs/indra/pkg/wire/layer" "github.com/Indra-Labs/indra/pkg/wire/purchase" - "github.com/Indra-Labs/indra/pkg/wire/reply" "github.com/Indra-Labs/indra/pkg/wire/response" + "github.com/Indra-Labs/indra/pkg/wire/reverse" "github.com/Indra-Labs/indra/pkg/wire/session" "github.com/Indra-Labs/indra/pkg/wire/token" log2 "github.com/cybriq/proc/pkg/log" @@ -73,9 +73,9 @@ func TestOnionSkins_Confirmation(t *testing.T) { if oncn, e = PeelOnion(onb, c); check(e) { t.FailNow() } - var cf *confirmation.OnionSkin + var cf *confirm.OnionSkin var ok bool - if cf, ok = oncn.(*confirmation.OnionSkin); !ok { + if cf, ok = oncn.(*confirm.OnionSkin); !ok { t.Error("did not unwrap expected type") t.FailNow() } @@ -226,8 +226,8 @@ func TestOnionSkins_Layer(t *testing.T) { t.Error(e) t.FailNow() } - oc := &confirmation.OnionSkin{} - if oc, ok = onc.(*confirmation.OnionSkin); !ok { + oc := &confirm.OnionSkin{} + if oc, ok = onc.(*confirm.OnionSkin); !ok { t.Error("did not unwrap expected type") t.FailNow() } @@ -300,8 +300,8 @@ func TestOnionSkins_Reply(t *testing.T) { if onf, e = PeelOnion(onb, c); check(e) { t.FailNow() } - var cf *reply.OnionSkin - if cf, ok = onf.(*reply.OnionSkin); !ok { + var cf *reverse.OnionSkin + if cf, ok = onf.(*reverse.OnionSkin); !ok { t.Error("did not unwrap expected type", reflect.TypeOf(onf)) t.FailNow() } diff --git a/pkg/wire/confirmation/confirmation.go b/pkg/wire/confirm/confirmation.go similarity index 98% rename from pkg/wire/confirmation/confirmation.go rename to pkg/wire/confirm/confirmation.go index bc0edb57..cd34cd1d 100644 --- a/pkg/wire/confirmation/confirmation.go +++ b/pkg/wire/confirm/confirmation.go @@ -1,4 +1,4 @@ -package confirmation +package confirm import ( "fmt" diff --git a/pkg/wire/layers.go b/pkg/wire/layers.go index b8b34d63..639cc5cc 100644 --- a/pkg/wire/layers.go +++ b/pkg/wire/layers.go @@ -13,15 +13,15 @@ import ( "github.com/Indra-Labs/indra/pkg/slice" "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire/cipher" - "github.com/Indra-Labs/indra/pkg/wire/confirmation" + "github.com/Indra-Labs/indra/pkg/wire/confirm" "github.com/Indra-Labs/indra/pkg/wire/delay" "github.com/Indra-Labs/indra/pkg/wire/exit" "github.com/Indra-Labs/indra/pkg/wire/forward" "github.com/Indra-Labs/indra/pkg/wire/layer" "github.com/Indra-Labs/indra/pkg/wire/noop" "github.com/Indra-Labs/indra/pkg/wire/purchase" - "github.com/Indra-Labs/indra/pkg/wire/reply" "github.com/Indra-Labs/indra/pkg/wire/response" + "github.com/Indra-Labs/indra/pkg/wire/reverse" "github.com/Indra-Labs/indra/pkg/wire/session" "github.com/Indra-Labs/indra/pkg/wire/token" ) @@ -46,7 +46,7 @@ func (o OnionSkins) Cipher(hdr, pld *pub.Key) OnionSkins { } func (o OnionSkins) Confirmation(id nonce.ID) OnionSkins { - return append(o, &confirmation.OnionSkin{ID: id}) + return append(o, &confirm.OnionSkin{ID: id}) } func (o OnionSkins) Delay(d time.Duration) OnionSkins { @@ -86,7 +86,7 @@ func (o OnionSkins) Purchase(nBytes uint64, prvs [3]*prv.Key, }) } func (o OnionSkins) Reply(ip *netip.AddrPort) OnionSkins { - return append(o, &reply.OnionSkin{AddrPort: ip, Onion: os}) + return append(o, &reverse.OnionSkin{AddrPort: ip, Onion: os}) } func (o OnionSkins) Response(res slice.Bytes) OnionSkins { rs := response.OnionSkin(res) diff --git a/pkg/wire/onion_test.go b/pkg/wire/onion_test.go index ba36434f..215187a3 100644 --- a/pkg/wire/onion_test.go +++ b/pkg/wire/onion_test.go @@ -14,12 +14,12 @@ import ( "github.com/Indra-Labs/indra/pkg/testutils" "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire/cipher" - "github.com/Indra-Labs/indra/pkg/wire/confirmation" + "github.com/Indra-Labs/indra/pkg/wire/confirm" "github.com/Indra-Labs/indra/pkg/wire/exit" "github.com/Indra-Labs/indra/pkg/wire/forward" "github.com/Indra-Labs/indra/pkg/wire/layer" "github.com/Indra-Labs/indra/pkg/wire/purchase" - "github.com/Indra-Labs/indra/pkg/wire/reply" + "github.com/Indra-Labs/indra/pkg/wire/reverse" log2 "github.com/cybriq/proc/pkg/log" ) @@ -54,7 +54,7 @@ func PeelOnionSkin(t *testing.T, b slice.Bytes, } func PeelConfirmation(t *testing.T, b slice.Bytes, - c *slice.Cursor) (cn *confirmation.OnionSkin) { + c *slice.Cursor) (cn *confirm.OnionSkin) { var ok bool var e error @@ -62,7 +62,7 @@ func PeelConfirmation(t *testing.T, b slice.Bytes, if on, e = PeelOnion(b, c); check(e) { t.Error(e) } - if cn, ok = on.(*confirmation.OnionSkin); !ok { + if cn, ok = on.(*confirm.OnionSkin); !ok { t.Error("did not unwrap expected type", reflect.TypeOf(on)) } return @@ -84,7 +84,7 @@ func PeelPurchase(t *testing.T, b slice.Bytes, } func PeelReply(t *testing.T, b slice.Bytes, - c *slice.Cursor) (rp *reply.OnionSkin) { + c *slice.Cursor) (rp *reverse.OnionSkin) { var ok bool var e error @@ -92,7 +92,7 @@ func PeelReply(t *testing.T, b slice.Bytes, if on, e = PeelOnion(b, c); check(e) { t.Error(e) } - if rp, ok = on.(*reply.OnionSkin); !ok { + if rp, ok = on.(*reverse.OnionSkin); !ok { t.Error("did not unwrap expected type", reflect.TypeOf(on)) } return diff --git a/pkg/wire/reply/reply.go b/pkg/wire/reverse/reply.go similarity index 99% rename from pkg/wire/reply/reply.go rename to pkg/wire/reverse/reply.go index 02964c88..a5e07bd5 100644 --- a/pkg/wire/reply/reply.go +++ b/pkg/wire/reverse/reply.go @@ -1,4 +1,4 @@ -package reply +package reverse import ( "net" diff --git a/version.go b/version.go index 794c196d..272bbcbe 100644 --- a/version.go +++ b/version.go @@ -10,11 +10,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 = "090ea9584cb7987911cccd390e5470e966938378" + ParentGitCommit = "ed542f0b9ced648125640f1f8c4f5f4fe55cd677" // BuildTime stores the time when the current binary was built. - BuildTime = "2022-12-29T08:07:49Z" - // SemVer lists the (latest) git tag on the build. - SemVer = "v0.0.256" + BuildTime = "2022-12-29T09:14:38Z" + // SemVer lists the (latest) git tag on the release. + SemVer = "v0.0.257" // 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. @@ -22,7 +22,7 @@ var ( // Minor is the minor number from the tag. Minor = 0 // Patch is the patch version number from the tag. - Patch = 256 + Patch = 257 ) // Version returns a pretty printed version information string. From aa9ea1d2b81c6725def150c087c09259b8d63f2b Mon Sep 17 00:00:00 2001 From: David Vennik Date: Thu, 29 Dec 2022 09:56:47 +0000 Subject: [PATCH 3/5] Ping test now terminates on completion or waits and fails --- pkg/client/client.go | 61 +++++++++++++++++++++++++++------------ pkg/client/client_test.go | 23 +++++++++++++-- version.go | 8 ++--- 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 90580791..d6cb8dae 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -13,6 +13,7 @@ import ( "github.com/Indra-Labs/indra/pkg/key/pub" "github.com/Indra-Labs/indra/pkg/key/signer" "github.com/Indra-Labs/indra/pkg/node" + "github.com/Indra-Labs/indra/pkg/nonce" "github.com/Indra-Labs/indra/pkg/slice" "github.com/Indra-Labs/indra/pkg/types" "github.com/Indra-Labs/indra/pkg/wire" @@ -47,10 +48,19 @@ type Client struct { *address.ReceiveCache Circuits Sessions + Confirms sync.Mutex *signer.KeySet qu.C } +type ConfirmHook func(cf *confirm.OnionSkin) + +type ConfirmCallback struct { + nonce.ID + Hook ConfirmHook +} + +type Confirms []ConfirmCallback func New(tpt ifc.Transport, hdrPrv *prv.Key, no *node.Node, nodes node.Nodes) (c *Client, e error) { @@ -94,40 +104,40 @@ func (cl *Client) runner() (out bool) { } switch on := onion.(type) { case *cipher.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.cipher(on, b, c) case *confirm.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.confirm(on, b, c) case *delay.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.delay(on, b, c) case *exit.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.exit(on, b, c) case *forward.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.forward(on, b, c) case *layer.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.layer(on, b, c) case *noop.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.noop(on, b, c) case *purchase.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.purchase(on, b, c) case *reverse.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.reply(on, b, c) case *response.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.response(on, b, c) case *session.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.session(on, b, c) case *token.OnionSkin: - log.I.Ln(reflect.TypeOf(on)) + log.T.Ln(reflect.TypeOf(on)) cl.token(on, b, c) default: log.I.S("unrecognised packet", b) @@ -146,7 +156,13 @@ func (cl *Client) confirm(on *confirm.OnionSkin, b slice.Bytes, // This will be an 8 byte nonce that confirms a message passed, ping and // cipher onions return these, as they are pure forward messages that // send a message one way and the confirmation is the acknowledgement. - log.I.S(on) + // log.I.S(on) + for i := range cl.Confirms { + // log.I.S(cl.Confirms[i].ID, on.ID) + if on.ID == cl.Confirms[i].ID { + cl.Confirms[i].Hook(on) + } + } } func (cl *Client) delay(on *delay.OnionSkin, b slice.Bytes, cur *slice.Cursor) { @@ -167,28 +183,28 @@ func (cl *Client) forward(on *forward.OnionSkin, b slice.Bytes, c *slice.Cursor) if on.AddrPort.String() == cl.Node.AddrPort.String() { // it is for us, we want to unwrap the next // part. - log.I.Ln("processing new message", *c) + log.T.Ln("processing new message", *c) b = append(b[*c:], slice.NoisePad(int(*c))...) cl.Node.Send(b) } else { // we need to forward this message onion. - log.I.Ln("forwarding") + log.T.Ln("forwarding") cl.Send(on.AddrPort, b) } } func (cl *Client) layer(on *layer.OnionSkin, b slice.Bytes, c *slice.Cursor) { // this is probably an encrypted layer for us. - log.I.Ln("decrypting onion skin") + log.T.Ln("decrypting onion skin") // log.I.S(on, b[*c:].ToBytes()) rcv := cl.ReceiveCache.FindCloaked(on.Cloak) if rcv == nil { - log.I.Ln("no matching key found from cloaked key") + log.T.Ln("no matching key found from cloaked key") return } on.Decrypt(rcv.Key, b, c) b = append(b[*c:], slice.NoisePad(int(*c))...) - log.I.S(b.ToBytes()) + log.T.S(b.ToBytes()) cl.Node.Send(b) } @@ -236,6 +252,15 @@ func (cl *Client) token(t *token.OnionSkin, b slice.Bytes, cur *slice.Cursor) { return } +func (cl *Client) RegisterConfirmation(id nonce.ID, hook ConfirmHook) { + cl.Mutex.Lock() + cl.Confirms = append(cl.Confirms, ConfirmCallback{ + ID: id, + Hook: hook, + }) + cl.Mutex.Unlock() +} + func (cl *Client) Cleanup() { // Do cleanup stuff before shutdown. } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 1f1a471a..ac660f59 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -13,11 +13,14 @@ import ( "github.com/Indra-Labs/indra/pkg/slice" "github.com/Indra-Labs/indra/pkg/transport" "github.com/Indra-Labs/indra/pkg/wire" + "github.com/Indra-Labs/indra/pkg/wire/confirm" log2 "github.com/cybriq/proc/pkg/log" + "github.com/cybriq/qu" ) func TestPing(t *testing.T) { log2.CodeLoc = true + // log2.SetLogLevel(log2.Trace) var clients [4]*Client var nodes [4]*node.Node var transports [4]ifc.Transport @@ -69,15 +72,29 @@ func TestPing(t *testing.T) { hop[i] = clients[0].Nodes[i] } os := wire.Ping(pn, clients[0].Node, hop, ks) - log.I.S(os) + // log.I.S(os) + quit := qu.T() + log.I.S("sending ping with ID", os[len(os)-1].(*confirm.OnionSkin)) + clients[0].RegisterConfirmation( + os[len(os)-1].(*confirm.OnionSkin).ID, + func(cf *confirm.OnionSkin) { + log.I.S("received ping confirmation ID", cf) + quit.Q() + }, + ) o := os.Assemble() b := wire.EncodeOnion(o) - // log.I.S(b.ToBytes()) hop[0].Send(b) - time.Sleep(time.Second * 5) + go func() { + time.Sleep(time.Second * 2) + quit.Q() + t.Error("ping got stuck") + }() + <-quit.Wait() for _, v := range clients { v.Shutdown() } + } // diff --git a/version.go b/version.go index 272bbcbe..d7e682be 100644 --- a/version.go +++ b/version.go @@ -10,11 +10,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 = "ed542f0b9ced648125640f1f8c4f5f4fe55cd677" + ParentGitCommit = "00b39b876b26ec360bd3557c579bb174c36a426b" // BuildTime stores the time when the current binary was built. - BuildTime = "2022-12-29T09:14:38Z" + BuildTime = "2022-12-29T09:56:47Z" // SemVer lists the (latest) git tag on the release. - SemVer = "v0.0.257" + SemVer = "v0.0.258" // 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. @@ -22,7 +22,7 @@ var ( // Minor is the minor number from the tag. Minor = 0 // Patch is the patch version number from the tag. - Patch = 257 + Patch = 258 ) // Version returns a pretty printed version information string. From 390063192f54d4e7cac3212242d5af982271363e Mon Sep 17 00:00:00 2001 From: David Vennik Date: Thu, 29 Dec 2022 12:02:30 +0000 Subject: [PATCH 4/5] Made confirms standalone with own mutex --- pkg/client/client.go | 56 +++++++++++++------------- pkg/client/client_test.go | 1 - pkg/node/node.go | 26 ++++++------ pkg/wire/confirm/confirms.go | 77 ++++++++++++++++++++++++++++++++++++ pkg/wire/onion_test.go | 44 ++++++++++----------- version.go | 8 ++-- 6 files changed, 144 insertions(+), 68 deletions(-) create mode 100644 pkg/wire/confirm/confirms.go diff --git a/pkg/client/client.go b/pkg/client/client.go index d6cb8dae..b38a61ed 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -31,6 +31,7 @@ import ( "github.com/Indra-Labs/indra/pkg/wire/token" log2 "github.com/cybriq/proc/pkg/log" "github.com/cybriq/qu" + "go.uber.org/atomic" ) const DefaultDeadline = 10 * time.Minute @@ -48,27 +49,21 @@ type Client struct { *address.ReceiveCache Circuits Sessions - Confirms + *confirm.Confirms sync.Mutex *signer.KeySet + atomic.Bool qu.C } -type ConfirmHook func(cf *confirm.OnionSkin) - -type ConfirmCallback struct { - nonce.ID - Hook ConfirmHook -} - -type Confirms []ConfirmCallback func New(tpt ifc.Transport, hdrPrv *prv.Key, no *node.Node, nodes node.Nodes) (c *Client, e error) { no.Transport = tpt - no.HeaderPriv = hdrPrv + no.HeaderPrv = hdrPrv no.HeaderPub = pub.Derive(hdrPrv) c = &Client{ + Confirms: confirm.NewConfirms(), Node: no, Nodes: nodes, ReceiveCache: address.NewReceiveCache(), @@ -143,7 +138,7 @@ func (cl *Client) runner() (out bool) { log.I.S("unrecognised packet", b) } } - return false + return } func (cl *Client) cipher(on *cipher.OnionSkin, b slice.Bytes, cur *slice.Cursor) { @@ -153,16 +148,25 @@ func (cl *Client) cipher(on *cipher.OnionSkin, b slice.Bytes, cur *slice.Cursor) func (cl *Client) confirm(on *confirm.OnionSkin, b slice.Bytes, c *slice.Cursor) { - // This will be an 8 byte nonce that confirms a message passed, ping and - // cipher onions return these, as they are pure forward messages that - // send a message one way and the confirmation is the acknowledgement. - // log.I.S(on) - for i := range cl.Confirms { - // log.I.S(cl.Confirms[i].ID, on.ID) - if on.ID == cl.Confirms[i].ID { - cl.Confirms[i].Hook(on) + // When a confirm arrives check if it is registered for and run + // the hook that was registered with it. + cl.Confirms.Lock() + for i := range (*cl).Cnf { + if on.ID == (*cl).Cnf[i].ID { + (*cl).Cnf[i].Hook(on) } } + cl.Confirms.Unlock() +} + +func (cl *Client) RegisterConfirmation(id nonce.ID, hook confirm.Hook) { + cl.Confirms.Lock() + cl.Cnf = append((*cl).Cnf, confirm.Callback{ + ID: id, + Time: time.Now(), + Hook: hook, + }) + cl.Confirms.Unlock() } func (cl *Client) delay(on *delay.OnionSkin, b slice.Bytes, cur *slice.Cursor) { @@ -252,20 +256,16 @@ func (cl *Client) token(t *token.OnionSkin, b slice.Bytes, cur *slice.Cursor) { return } -func (cl *Client) RegisterConfirmation(id nonce.ID, hook ConfirmHook) { - cl.Mutex.Lock() - cl.Confirms = append(cl.Confirms, ConfirmCallback{ - ID: id, - Hook: hook, - }) - cl.Mutex.Unlock() -} - func (cl *Client) Cleanup() { // Do cleanup stuff before shutdown. } func (cl *Client) Shutdown() { + if cl.Bool.Load() { + return + } + log.I.Ln("shutting down client", cl.Node.AddrPort.String()) + cl.Bool.Store(true) cl.C.Q() } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index ac660f59..2d7dd4c1 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -94,7 +94,6 @@ func TestPing(t *testing.T) { for _, v := range clients { v.Shutdown() } - } // diff --git a/pkg/node/node.go b/pkg/node/node.go index 6bc63c5d..2ec6d2ed 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -25,28 +25,28 @@ var ( // except when the netip.AddrPort is known via the packet sender address. type Node struct { nonce.ID - Addr string - AddrPort *netip.AddrPort - HeaderPub, PayloadPub *pub.Key - HeaderPriv, PayloadPriv *prv.Key + Addr string + AddrPort *netip.AddrPort + HeaderPub, PayloadPub *pub.Key + HeaderPrv, PayloadPrv *prv.Key ifc.Transport } // New creates a new Node. netip.AddrPort is optional if the counterparty is not // in direct connection. -func New(addr *netip.AddrPort, hdr, pld *pub.Key, hdrPriv, pldPriv *prv.Key, +func New(addr *netip.AddrPort, hdr, pld *pub.Key, hdrPrv, pldPrv *prv.Key, tpt ifc.Transport) (n *Node, id nonce.ID) { id = nonce.NewID() n = &Node{ - ID: id, - Addr: addr.String(), - AddrPort: addr, - Transport: tpt, - HeaderPub: hdr, - PayloadPub: pld, - HeaderPriv: hdrPriv, - PayloadPriv: pldPriv, + ID: id, + Addr: addr.String(), + AddrPort: addr, + Transport: tpt, + HeaderPub: hdr, + PayloadPub: pld, + HeaderPrv: hdrPrv, + PayloadPrv: pldPrv, } return } diff --git a/pkg/wire/confirm/confirms.go b/pkg/wire/confirm/confirms.go new file mode 100644 index 00000000..d1caac82 --- /dev/null +++ b/pkg/wire/confirm/confirms.go @@ -0,0 +1,77 @@ +package confirm + +import ( + "sync" + "time" + + "github.com/Indra-Labs/indra/pkg/nonce" +) + +type Hook func(cf *OnionSkin) + +type Callback struct { + nonce.ID + time.Time + Onion *OnionSkin + Hook Hook +} + +type Confirms struct { + sync.Mutex + Cnf []Callback +} + +func NewConfirms() *Confirms { + cn := Confirms{ + Cnf: make([]Callback, 0), + } + return &cn +} + +func (cn *Confirms) Add(cb *Callback) { + cn.Lock() + (*cn).Cnf = append((*cn).Cnf, *cb) + cn.Unlock() +} + +func (cn *Confirms) Confirm(id nonce.ID) bool { + cn.Lock() + defer cn.Unlock() + for i := range (*cn).Cnf { + if id == (*cn).Cnf[i].ID { + (*cn).Cnf[i].Hook((*cn).Cnf[i].Onion) + // delete Callback. + end := i + 1 + // if this is the last one, the end is the last one + // also. + if end > len((*cn).Cnf)-1 { + end = len((*cn).Cnf) - 1 + } + (*cn).Cnf = append((*cn).Cnf[:i], (*cn).Cnf[end:]...) + return true + } + } + return false +} + +// Flush clears out entries older than timePast. +func (cn *Confirms) Flush(timePast time.Time) { + cn.Lock() + defer cn.Unlock() + var foundCount int + for i := range (*cn).Cnf { + if (*cn).Cnf[i].Time.Before(timePast) { + foundCount++ + } + } + if foundCount > 0 { + cnNew := NewConfirms() + for i := range (*cn).Cnf { + if !(*cn).Cnf[i].Time.Before(timePast) { + (*cnNew).Cnf = append((*cnNew).Cnf, + (*cn).Cnf[i]) + } + } + (*cn).Cnf = (*cnNew).Cnf + } +} diff --git a/pkg/wire/onion_test.go b/pkg/wire/onion_test.go index 215187a3..8e9d4ed8 100644 --- a/pkg/wire/onion_test.go +++ b/pkg/wire/onion_test.go @@ -151,7 +151,7 @@ func TestPing(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[0].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPrv, b, c) // Forward(hop[1].AddrPort). f1 := PeelForward(t, b, c) @@ -162,7 +162,7 @@ func TestPing(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[1].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPrv, b, c) // Forward(hop[2].AddrPort). f2 := PeelForward(t, b, c) @@ -173,7 +173,7 @@ func TestPing(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[2].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPrv, b, c) // Forward(client.AddrPort). f3 := PeelForward(t, b, c) @@ -184,7 +184,7 @@ func TestPing(t *testing.T) { } // OnionSkin(address.FromPubKey(client.HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(client.HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(client.HeaderPrv, b, c) // Confirmation(id). co := PeelConfirmation(t, b, c) @@ -232,7 +232,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[0].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPrv, b, c) // Forward(hop[1].AddrPort). f1 := PeelForward(t, b, c) @@ -243,7 +243,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[1].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPrv, b, c) // Forward(hop[2].AddrPort). f2 := PeelForward(t, b, c) @@ -254,7 +254,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[2].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPrv, b, c) // Cipher(hdr, pld). var onc types.Onion @@ -285,7 +285,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[3].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPrv, b, c) // Forward(hop[4].AddrPort). f4 := PeelForward(t, b, c) @@ -296,7 +296,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[4].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPrv, b, c) // Forward(client.AddrPort). f5 := PeelForward(t, b, c) @@ -307,7 +307,7 @@ func TestSendKeys(t *testing.T) { } // OnionSkin(address.FromPubKey(client.HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(client.HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(client.HeaderPrv, b, c) // Confirmation(id). co := PeelConfirmation(t, b, c) @@ -355,7 +355,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[0].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPrv, b, c) // Forward(hop[1].AddrPort). f1 := PeelForward(t, b, c) @@ -366,7 +366,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[1].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPrv, b, c) // Forward(hop[2].AddrPort). f2 := PeelForward(t, b, c) @@ -377,7 +377,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[2].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPrv, b, c) // Purchase(nBytes, prvs, pubs). pr := PeelPurchase(t, b, c) @@ -394,7 +394,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[3].HeaderPub), replies[0]). - PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPrv, b, c) // Reply(hop[4].AddrPort). rp2 := PeelReply(t, b, c) @@ -404,7 +404,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[4].HeaderPub), replies[1]). - PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPrv, b, c) // Reply(client.AddrPort). rp3 := PeelReply(t, b, c) @@ -414,7 +414,7 @@ func TestSendPurchase(t *testing.T) { } // OnionSkin(address.FromPubKey(client.HeaderPub), replies[2]). - PeelOnionSkin(t, b, c).Decrypt(client.HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(client.HeaderPrv, b, c) } @@ -454,7 +454,7 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[0].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[0].HeaderPrv, b, c) // Forward(hop[1].AddrPort). f1 := PeelForward(t, b, c) @@ -465,7 +465,7 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[1].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[1].HeaderPrv, b, c) // Forward(hop[2].AddrPort). f2 := PeelForward(t, b, c) @@ -476,7 +476,7 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[2].HeaderPub), set.Next()). - PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[2].HeaderPrv, b, c) // Exit(port, prvs, pubs, payload). pr := PeelExit(t, b, c) @@ -498,7 +498,7 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[3].HeaderPub), replies[0]). - PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[3].HeaderPrv, b, c) // Reply(hop[4].AddrPort). rp2 := PeelReply(t, b, c) @@ -508,7 +508,7 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(hop[4].HeaderPub), replies[1]). - PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(hop[4].HeaderPrv, b, c) // Reply(client.AddrPort). rp3 := PeelReply(t, b, c) @@ -518,6 +518,6 @@ func TestSendExit(t *testing.T) { } // OnionSkin(address.FromPubKey(client.HeaderPub), replies[2]). - PeelOnionSkin(t, b, c).Decrypt(client.HeaderPriv, b, c) + PeelOnionSkin(t, b, c).Decrypt(client.HeaderPrv, b, c) } diff --git a/version.go b/version.go index d7e682be..da527548 100644 --- a/version.go +++ b/version.go @@ -10,11 +10,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 = "00b39b876b26ec360bd3557c579bb174c36a426b" + ParentGitCommit = "cd62009a5db7dd18f53b311af756a005b732cf20" // BuildTime stores the time when the current binary was built. - BuildTime = "2022-12-29T09:56:47Z" + BuildTime = "2022-12-29T12:02:30Z" // SemVer lists the (latest) git tag on the release. - SemVer = "v0.0.258" + SemVer = "v0.0.259" // 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. @@ -22,7 +22,7 @@ var ( // Minor is the minor number from the tag. Minor = 0 // Patch is the patch version number from the tag. - Patch = 258 + Patch = 259 ) // Version returns a pretty printed version information string. From 893ca306c295b2115386fe3ba0af440eb674a38b Mon Sep 17 00:00:00 2001 From: David Vennik Date: Thu, 29 Dec 2022 12:06:37 +0000 Subject: [PATCH 5/5] Bumping due to basic server and client implementations underway --- version.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.go b/version.go index da527548..64c6b404 100644 --- a/version.go +++ b/version.go @@ -8,11 +8,11 @@ var ( // URL is the git URL for the repository. URL = "github.com/Indra-Labs/indra" // GitRef is the gitref, as in refs/heads/branchname. - GitRef = "refs/heads/main" + GitRef = "refs/heads/protocol" // ParentGitCommit is the commit hash of the parent HEAD. - ParentGitCommit = "cd62009a5db7dd18f53b311af756a005b732cf20" + ParentGitCommit = "83a692da2d96ef804e799e802d6815b07aa66c77" // BuildTime stores the time when the current binary was built. - BuildTime = "2022-12-29T12:02:30Z" + BuildTime = "2022-12-29T12:06:37Z" // SemVer lists the (latest) git tag on the release. SemVer = "v0.0.259" // PathBase is the path base returned from runtime caller.