diff --git a/cmd/buidl/main.go b/cmd/buidl/main.go index f58f7d3f..da85fb66 100644 --- a/cmd/buidl/main.go +++ b/cmd/buidl/main.go @@ -12,7 +12,7 @@ import ( "time" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/storer" diff --git a/cmd/bumper/main.go b/cmd/bumper/main.go index c249c24a..929de427 100644 --- a/cmd/bumper/main.go +++ b/cmd/bumper/main.go @@ -17,7 +17,7 @@ import ( "time" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/storer" diff --git a/cmd/docker/release/main.go b/cmd/docker/release/main.go index 58023f0c..36d2bde9 100644 --- a/cmd/docker/release/main.go +++ b/cmd/docker/release/main.go @@ -2,16 +2,18 @@ package main import ( "context" + "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/app" - "github.com/indra-labs/indra/pkg/cmds" "github.com/indra-labs/indra/pkg/docker" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/opts/toggle" + "github.com/indra-labs/indra/pkg/proc/app" + "github.com/indra-labs/indra/pkg/proc/cmds" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/toggle" + "os" "time" ) @@ -76,7 +78,7 @@ var buildConfigurations = []docker.BuildConfiguration{ PullParent: false, }, }, - //docker.BuildConfiguration{ + // docker.BuildConfiguration{ // Name: defaultRepositoryName + "/" + "lnd", // ContextFilePath: "/tmp/lnd.tar", // BuildOpts: types.ImageBuildOptions{ @@ -98,8 +100,8 @@ var buildConfigurations = []docker.BuildConfiguration{ // ForceRemove: true, // PullParent: true, // }, - //}, - //docker.BuildConfiguration{ + // }, + // docker.BuildConfiguration{ // Name: defaultRepositoryName + "/" + "indra", // ContextFilePath: "/tmp/indra-" + indra.SemVer + ".tar", // BuildOpts: types.ImageBuildOptions{ @@ -114,7 +116,7 @@ var buildConfigurations = []docker.BuildConfiguration{ // ForceRemove: true, // PullParent: true, // }, - //}, + // }, } var commands = &cmds.Command{ diff --git a/cmd/gimport/main.go b/cmd/gimport/main.go index 3327dcfa..e2e94027 100644 --- a/cmd/gimport/main.go +++ b/cmd/gimport/main.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "gopkg.in/src-d/go-git.v4" ) diff --git a/cmd/indra/main.go b/cmd/indra/main.go index 0f51f7af..f7f7af38 100644 --- a/cmd/indra/main.go +++ b/cmd/indra/main.go @@ -5,14 +5,14 @@ import ( "os" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/app" "github.com/indra-labs/indra/pkg/cfg" - "github.com/indra-labs/indra/pkg/cmds" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/list" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/opts/text" + "github.com/indra-labs/indra/pkg/proc/app" + "github.com/indra-labs/indra/pkg/proc/cmds" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/list" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/text" "github.com/indra-labs/indra/pkg/server" "github.com/libp2p/go-libp2p/core/crypto" "github.com/multiformats/go-multiaddr" diff --git a/pkg/cfg/params.go b/pkg/cfg/params.go index 4bd5afec..2a543196 100644 --- a/pkg/cfg/params.go +++ b/pkg/cfg/params.go @@ -2,8 +2,8 @@ package cfg import ( "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" "github.com/indra-labs/indra/pkg/node" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/multiformats/go-multiaddr" ) diff --git a/pkg/client/client.go b/pkg/client/client.go index fbdac42d..c279f231 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -8,16 +8,16 @@ import ( "github.com/cybriq/qu" "github.com/davecgh/go-spew/spew" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/ifc" - "github.com/indra-labs/indra/pkg/key/cloak" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/key/signer" - log2 "github.com/indra-labs/indra/pkg/log" + "github.com/indra-labs/indra/pkg/crypto/key/cloak" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/signer" + "github.com/indra-labs/indra/pkg/crypto/nonce" "github.com/indra-labs/indra/pkg/node" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/traffic" + "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/layer" "github.com/indra-labs/indra/pkg/wire/response" @@ -46,7 +46,7 @@ type Client struct { qu.C } -func NewClient(tpt ifc.Transport, hdrPrv *prv.Key, no *node.Node, +func NewClient(tpt types.Transport, hdrPrv *prv.Key, no *node.Node, nodes node.Nodes) (c *Client, e error) { no.Transport = tpt diff --git a/pkg/client/oniontypes_test.go b/pkg/client/oniontypes_test.go index 9b24c268..ea020acd 100644 --- a/pkg/client/oniontypes_test.go +++ b/pkg/client/oniontypes_test.go @@ -5,16 +5,16 @@ import ( "time" "github.com/cybriq/qu" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/nonce" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/onion" "github.com/indra-labs/indra/pkg/payment" "github.com/indra-labs/indra/pkg/service" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" "github.com/indra-labs/indra/pkg/tests" "github.com/indra-labs/indra/pkg/traffic" "github.com/indra-labs/indra/pkg/transport" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/session" ) diff --git a/pkg/client/runner.go b/pkg/client/runner.go index 8696ba75..8d826a2d 100644 --- a/pkg/client/runner.go +++ b/pkg/client/runner.go @@ -6,13 +6,13 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/indra-labs/indra/pkg/ciph" - "github.com/indra-labs/indra/pkg/nonce" + "github.com/indra-labs/indra/pkg/crypto/ciph" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/onion" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" "github.com/indra-labs/indra/pkg/traffic" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/balance" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/delay" diff --git a/pkg/client/utils_test.go b/pkg/client/utils_test.go index 44ca3f7d..bea91178 100644 --- a/pkg/client/utils_test.go +++ b/pkg/client/utils_test.go @@ -3,14 +3,14 @@ package client import ( "math" - "github.com/indra-labs/indra/pkg/ifc" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" "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/traffic" "github.com/indra-labs/indra/pkg/transport" + "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" ) func CreateNMockCircuits(inclSessions bool, @@ -19,7 +19,7 @@ func CreateNMockCircuits(inclSessions bool, nTotal := 1 + nCircuits*5 cl = make([]*Client, nTotal) nodes := make([]*node.Node, nTotal) - transports := make([]ifc.Transport, nTotal) + transports := make([]types.Transport, nTotal) sessions := make(traffic.Sessions, nTotal-1) for i := range transports { transports[i] = transport.NewSim(nTotal) diff --git a/pkg/ciph/cipher.go b/pkg/crypto/ciph/cipher.go similarity index 82% rename from pkg/ciph/cipher.go rename to pkg/crypto/ciph/cipher.go index 661b3ddd..c858bb75 100644 --- a/pkg/ciph/cipher.go +++ b/pkg/crypto/ciph/cipher.go @@ -10,12 +10,12 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/ecdh" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/ecdh" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/cloak/cloaked.go b/pkg/crypto/key/cloak/cloaked.go similarity index 92% rename from pkg/key/cloak/cloaked.go rename to pkg/crypto/key/cloak/cloaked.go index 40132761..53ee7ef7 100644 --- a/pkg/key/cloak/cloaked.go +++ b/pkg/crypto/key/cloak/cloaked.go @@ -6,9 +6,9 @@ import ( "crypto/rand" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/cloak/cloaked_test.go b/pkg/crypto/key/cloak/cloaked_test.go similarity index 86% rename from pkg/key/cloak/cloaked_test.go rename to pkg/crypto/key/cloak/cloaked_test.go index ed02e3a8..9ad96240 100644 --- a/pkg/key/cloak/cloaked_test.go +++ b/pkg/crypto/key/cloak/cloaked_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" ) func TestAddress(t *testing.T) { diff --git a/pkg/key/ecdh/ecdh.go b/pkg/crypto/key/ecdh/ecdh.go similarity index 80% rename from pkg/key/ecdh/ecdh.go rename to pkg/crypto/key/ecdh/ecdh.go index e366b354..499eb4f3 100644 --- a/pkg/key/ecdh/ecdh.go +++ b/pkg/crypto/key/ecdh/ecdh.go @@ -5,9 +5,9 @@ package ecdh import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" ) // Compute computes an Elliptic Curve Diffie-Hellman shared secret that can be diff --git a/pkg/key/prv/private.go b/pkg/crypto/key/prv/private.go similarity index 96% rename from pkg/key/prv/private.go rename to pkg/crypto/key/prv/private.go index eaf8e2b2..5ff9d71f 100644 --- a/pkg/key/prv/private.go +++ b/pkg/crypto/key/prv/private.go @@ -5,7 +5,7 @@ package prv import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/pub/public.go b/pkg/crypto/key/pub/public.go similarity index 94% rename from pkg/key/pub/public.go rename to pkg/crypto/key/pub/public.go index 10505b9e..a07badd5 100644 --- a/pkg/key/pub/public.go +++ b/pkg/crypto/key/pub/public.go @@ -8,8 +8,8 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/prv" - log2 "github.com/indra-labs/indra/pkg/log" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/sig/signature.go b/pkg/crypto/key/sig/signature.go similarity index 88% rename from pkg/key/sig/signature.go rename to pkg/crypto/key/sig/signature.go index 1d26bec7..a3d6b000 100644 --- a/pkg/key/sig/signature.go +++ b/pkg/crypto/key/sig/signature.go @@ -8,10 +8,10 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/sig/signature_test.go b/pkg/crypto/key/sig/signature_test.go similarity index 89% rename from pkg/key/sig/signature_test.go rename to pkg/crypto/key/sig/signature_test.go index e19b4e37..da282c36 100644 --- a/pkg/key/sig/signature_test.go +++ b/pkg/crypto/key/sig/signature_test.go @@ -6,9 +6,9 @@ import ( mrand "math/rand" "testing" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" ) func TestSignRecover(t *testing.T) { diff --git a/pkg/key/signer/signer.go b/pkg/crypto/key/signer/signer.go similarity index 91% rename from pkg/key/signer/signer.go rename to pkg/crypto/key/signer/signer.go index c06c0c5b..8a6616a2 100644 --- a/pkg/key/signer/signer.go +++ b/pkg/crypto/key/signer/signer.go @@ -7,8 +7,8 @@ import ( "sync" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/prv" - log2 "github.com/indra-labs/indra/pkg/log" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/key/signer/signer_test.go b/pkg/crypto/key/signer/signer_test.go similarity index 90% rename from pkg/key/signer/signer_test.go rename to pkg/crypto/key/signer/signer_test.go index 5d6e1ca8..e110a6c4 100644 --- a/pkg/key/signer/signer_test.go +++ b/pkg/crypto/key/signer/signer_test.go @@ -4,9 +4,9 @@ import ( "crypto/rand" "testing" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/key/sig" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/sig" + "github.com/indra-labs/indra/pkg/crypto/sha256" ) // this just really demonstrates how the keys generated are not linkable. diff --git a/pkg/nonce/id.go b/pkg/crypto/nonce/id.go similarity index 91% rename from pkg/nonce/id.go rename to pkg/crypto/nonce/id.go index 6c36a20b..a53e0dbd 100644 --- a/pkg/nonce/id.go +++ b/pkg/crypto/nonce/id.go @@ -3,7 +3,7 @@ package nonce import ( "crypto/rand" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/sha256" ) const IDLen = 8 diff --git a/pkg/nonce/nonce.go b/pkg/crypto/nonce/nonce.go similarity index 91% rename from pkg/nonce/nonce.go rename to pkg/crypto/nonce/nonce.go index 447d20c1..06cc804e 100644 --- a/pkg/nonce/nonce.go +++ b/pkg/crypto/nonce/nonce.go @@ -8,7 +8,7 @@ import ( "crypto/rand" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/sha256/sha256.go b/pkg/crypto/sha256/sha256.go similarity index 95% rename from pkg/sha256/sha256.go rename to pkg/crypto/sha256/sha256.go index 52b8bcd4..fb5b5add 100644 --- a/pkg/sha256/sha256.go +++ b/pkg/crypto/sha256/sha256.go @@ -5,7 +5,7 @@ package sha256 import ( "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/minio/sha256-simd" ) diff --git a/pkg/sha256/sha256_test.go b/pkg/crypto/sha256/sha256_test.go similarity index 100% rename from pkg/sha256/sha256_test.go rename to pkg/crypto/sha256/sha256_test.go diff --git a/pkg/docker/builder.go b/pkg/docker/builder.go index 238306a6..23836854 100644 --- a/pkg/docker/builder.go +++ b/pkg/docker/builder.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/jsonmessage" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/moby/term" ) diff --git a/pkg/identity/identity.go b/pkg/identity/identity.go index c8043ea2..f3db089e 100644 --- a/pkg/identity/identity.go +++ b/pkg/identity/identity.go @@ -3,9 +3,9 @@ package identity import ( "net/netip" - "github.com/indra-labs/indra/pkg/ifc" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/types" ) type Peer struct { @@ -13,5 +13,5 @@ type Peer struct { IdentityPub *pub.Key IdentityBytes pub.Bytes IdentityPrv *prv.Key - ifc.Transport + types.Transport } diff --git a/pkg/interrupt/interrupt.go b/pkg/interrupt/interrupt.go index d4dc5711..6f8b4372 100644 --- a/pkg/interrupt/interrupt.go +++ b/pkg/interrupt/interrupt.go @@ -10,7 +10,7 @@ import ( "syscall" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "go.uber.org/atomic" "github.com/kardianos/osext" diff --git a/pkg/node/node.go b/pkg/node/node.go index dd5925f4..5717e1fb 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -8,15 +8,15 @@ import ( "time" "github.com/indra-labs/indra" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" "github.com/indra-labs/indra/pkg/identity" - "github.com/indra-labs/indra/pkg/ifc" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/service" - "github.com/indra-labs/indra/pkg/slice" "github.com/indra-labs/indra/pkg/traffic" + "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" ) var ( @@ -42,7 +42,7 @@ type Node struct { // in direct connection. Also, the idPrv node private key can be nil, as only // the node embedded in a client and not the peer node list has one available. func New(addr *netip.AddrPort, idPub *pub.Key, idPrv *prv.Key, - tpt ifc.Transport) (n *Node, id nonce.ID) { + tpt types.Transport) (n *Node, id nonce.ID) { id = nonce.NewID() n = &Node{ diff --git a/pkg/onion/codec.go b/pkg/onion/codec.go index 4454aafa..c50cdef4 100644 --- a/pkg/onion/codec.go +++ b/pkg/onion/codec.go @@ -5,14 +5,14 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/ecdh" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/key/ecdh" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/delay" "github.com/indra-labs/indra/pkg/wire/exit" diff --git a/pkg/onion/codec_test.go b/pkg/onion/codec_test.go index 5d4b9006..41ec3be7 100644 --- a/pkg/onion/codec_test.go +++ b/pkg/onion/codec_test.go @@ -8,13 +8,13 @@ import ( "testing" "time" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/tests" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/delay" "github.com/indra-labs/indra/pkg/wire/exit" diff --git a/pkg/onion/layers.go b/pkg/onion/layers.go index cc9d403d..a163f88a 100644 --- a/pkg/onion/layers.go +++ b/pkg/onion/layers.go @@ -4,14 +4,14 @@ import ( "net/netip" "time" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/lnd/lnwire" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" "github.com/indra-labs/indra/pkg/traffic" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/balance" "github.com/indra-labs/indra/pkg/wire/confirm" "github.com/indra-labs/indra/pkg/wire/delay" diff --git a/pkg/onion/onion.go b/pkg/onion/onion.go index 1cc8fdb3..8ab2c14b 100644 --- a/pkg/onion/onion.go +++ b/pkg/onion/onion.go @@ -1,12 +1,12 @@ package onion import ( - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/key/signer" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/key/signer" + "github.com/indra-labs/indra/pkg/crypto/nonce" "github.com/indra-labs/indra/pkg/traffic" + "github.com/indra-labs/indra/pkg/util/slice" ) // Ping is a message which checks the liveness of relays by ensuring they are diff --git a/pkg/p2p/introducer/bootstrap.go b/pkg/p2p/introducer/bootstrap.go index a1933466..006e36da 100644 --- a/pkg/p2p/introducer/bootstrap.go +++ b/pkg/p2p/introducer/bootstrap.go @@ -3,14 +3,15 @@ package introducer import ( "context" "errors" + "sync" + "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" dht "github.com/libp2p/go-libp2p-kad-dht" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" "github.com/multiformats/go-multiaddr" - "sync" ) var ( @@ -71,7 +72,7 @@ func Bootstrap(ctx context.Context, host host.Host, seeds []multiaddr.Multiaddr) dht.BootstrapPeers(bootstrapPeers...), dht.DisableValues(), dht.DisableProviders(), - //dht.Validator(), + // dht.Validator(), } if kadht, err = dht.New(ctx, h, options...); check(err) { diff --git a/pkg/packet/packet.go b/pkg/packet/packet.go index d7152493..bd83a223 100644 --- a/pkg/packet/packet.go +++ b/pkg/packet/packet.go @@ -10,13 +10,13 @@ import ( "time" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/ciph" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/ciph" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/util/slice" ) var ( diff --git a/pkg/packet/packet_test.go b/pkg/packet/packet_test.go index 49449c2b..9116f952 100644 --- a/pkg/packet/packet_test.go +++ b/pkg/packet/packet_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/tests" ) diff --git a/pkg/packet/segment.go b/pkg/packet/segment.go index c67735a6..1d4cdace 100644 --- a/pkg/packet/segment.go +++ b/pkg/packet/segment.go @@ -5,8 +5,8 @@ import ( "fmt" "sort" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/sha256" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/templexxx/reedsolomon" ) diff --git a/pkg/packet/segment_test.go b/pkg/packet/segment_test.go index 7958b3b5..ac57e672 100644 --- a/pkg/packet/segment_test.go +++ b/pkg/packet/segment_test.go @@ -5,9 +5,9 @@ import ( "math/rand" "testing" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/tests" ) diff --git a/pkg/payment/payment.go b/pkg/payment/payment.go index 553b6da8..3209f0ae 100644 --- a/pkg/payment/payment.go +++ b/pkg/payment/payment.go @@ -1,9 +1,9 @@ package payment import ( + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/lnd/lnwire" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" ) type Payment struct { diff --git a/pkg/app/app.go b/pkg/proc/app/app.go similarity index 71% rename from pkg/app/app.go rename to pkg/proc/app/app.go index f24b386c..865a5037 100644 --- a/pkg/app/app.go +++ b/pkg/proc/app/app.go @@ -2,8 +2,8 @@ package app import ( "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/cmds" - log2 "github.com/indra-labs/indra/pkg/log" + cmds2 "github.com/indra-labs/indra/pkg/proc/cmds" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( @@ -12,20 +12,20 @@ var ( ) type App struct { - *cmds.Command - launch *cmds.Command + *cmds2.Command + launch *cmds2.Command runArgs []string - cmds.Envs + cmds2.Envs } -func New(c *cmds.Command, args []string) (a *App, e error) { +func New(c *cmds2.Command, args []string) (a *App, e error) { log2.App = c.Name // Add the default configuration items for datadir/configfile - cmds.GetConfigBase(c.Configs, c.Name, false) + cmds2.GetConfigBase(c.Configs, c.Name, false) // Add the help function - c.AddCommand(cmds.Help()) + c.AddCommand(cmds2.Help()) a = &App{Command: c} - if a.Command, e = cmds.Init(c, nil); check(e) { + if a.Command, e = cmds2.Init(c, nil); check(e) { return } // We first parse the CLI args, in case config file location has been diff --git a/pkg/app/app_test.go b/pkg/proc/app/app_test.go similarity index 84% rename from pkg/app/app_test.go rename to pkg/proc/app/app_test.go index eb3f707a..74f073ca 100644 --- a/pkg/app/app_test.go +++ b/pkg/proc/app/app_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/indra-labs/indra/pkg/cmds" - log2 "github.com/indra-labs/indra/pkg/log" + "github.com/indra-labs/indra/pkg/proc/cmds" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) func TestNew(t *testing.T) { diff --git a/pkg/cmds/args.go b/pkg/proc/cmds/args.go similarity index 94% rename from pkg/cmds/args.go rename to pkg/proc/cmds/args.go index 711118b1..c07a9bc1 100644 --- a/pkg/cmds/args.go +++ b/pkg/proc/cmds/args.go @@ -5,9 +5,9 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/util" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/norm" ) var ( @@ -56,7 +56,7 @@ func (c *Command) ParseCLIArgs(a []string) (run *Command, runArgs []string, // where relevant config items will be found. for ; cursor < len(args); cursor++ { for i := range cur.Commands { - if util.NormEq(args[cursor], cur.Commands[i].Name) { + if norm.Eq(args[cursor], cur.Commands[i].Name) { // the command to run is the last, so update // each new command found run = cur.Commands[i] @@ -89,7 +89,7 @@ func (c *Command) ParseCLIArgs(a []string) (run *Command, runArgs []string, // the final command can accept arbitrary arguments, // that are passed into the entrypoint runArgs = iArgs - if util.Norm(commands[i].Name) == "help" { + if norm.Norm(commands[i].Name) == "help" { break } for cursor = 0; cursor < len(iArgs); { @@ -160,7 +160,7 @@ func lookAhead(cmd *Command, cfgName, arg string, iArgs []string, names := append( []string{cfgName}, aliases...) for _, name := range names { - if util.Norm(name) != util.Norm(arg) { + if norm.Norm(name) != norm.Norm(arg) { continue } // check for booleans, which can only be @@ -207,8 +207,8 @@ func valueInArg(cmd *Command, arg string) (e error) { names := append( []string{cfgName}, aliases...) for _, name := range names { - if util.Norm(name) != - util.Norm(split[0]) { + if norm.Norm(name) != + norm.Norm(split[0]) { continue } diff --git a/pkg/cmds/args_test.go b/pkg/proc/cmds/args_test.go similarity index 96% rename from pkg/cmds/args_test.go rename to pkg/proc/cmds/args_test.go index 180cb51a..ca445ce7 100644 --- a/pkg/cmds/args_test.go +++ b/pkg/proc/cmds/args_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) func TestCommand_ParseCLIArgs(t *testing.T) { diff --git a/pkg/cmds/commands.go b/pkg/proc/cmds/commands.go similarity index 93% rename from pkg/cmds/commands.go rename to pkg/proc/cmds/commands.go index ca84da80..5d2935ab 100644 --- a/pkg/cmds/commands.go +++ b/pkg/proc/cmds/commands.go @@ -7,13 +7,13 @@ import ( "strings" "sync" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/opts/text" - "github.com/indra-labs/indra/pkg/opts/toggle" - "github.com/indra-labs/indra/pkg/path" - "github.com/indra-labs/indra/pkg/util" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/text" + "github.com/indra-labs/indra/pkg/proc/opts/toggle" + "github.com/indra-labs/indra/pkg/util/norm" + "github.com/indra-labs/indra/pkg/util/path/path" ) type Op func(c *Command, args []string) error @@ -121,7 +121,7 @@ trace log statements will not print. lvl := log2.Info for i := range log2.LvlStr { ll := log2.GetLevelName(i) - if util.Norm(v) == strings.TrimSpace(ll) { + if norm.Norm(v) == strings.TrimSpace(ll) { lvl = i found = true } @@ -222,16 +222,16 @@ func (c *Command) GetOpt(path path.Path) (o config.Option) { case len(p) > 2: // search subcommands for i := range c.Commands { - if util.Norm(c.Commands[i].Name) == util.Norm(p[1]) { + if norm.Norm(c.Commands[i].Name) == norm.Norm(p[1]) { cc := c.Commands[i] return cc.GetOpt(p[1:]) } } case len(p) == 2: // check name matches path, search for config item - if util.Norm(c.Name) == util.Norm(p[0]) { + if norm.Norm(c.Name) == norm.Norm(p[0]) { for i := range c.Configs { - if util.Norm(i) == util.Norm(p[1]) { + if norm.Norm(i) == norm.Norm(p[1]) { return c.Configs[i] } } diff --git a/pkg/cmds/commands_test.go b/pkg/proc/cmds/commands_test.go similarity index 98% rename from pkg/cmds/commands_test.go rename to pkg/proc/cmds/commands_test.go index 0746cf9d..40ee11ee 100644 --- a/pkg/cmds/commands_test.go +++ b/pkg/proc/cmds/commands_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/path" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/util/path/path" ) func TestCommand_Foreach(t *testing.T) { diff --git a/pkg/cmds/env.go b/pkg/proc/cmds/env.go similarity index 95% rename from pkg/cmds/env.go rename to pkg/proc/cmds/env.go index 947217b0..a6c47435 100644 --- a/pkg/cmds/env.go +++ b/pkg/proc/cmds/env.go @@ -5,8 +5,8 @@ import ( "sort" "strings" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/path" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/util/path/path" ) type Env struct { diff --git a/pkg/cmds/example.go b/pkg/proc/cmds/example.go similarity index 98% rename from pkg/cmds/example.go rename to pkg/proc/cmds/example.go index fbcdfff5..4c92c6a1 100644 --- a/pkg/cmds/example.go +++ b/pkg/proc/cmds/example.go @@ -6,14 +6,14 @@ import ( "fmt" "runtime" - "github.com/indra-labs/indra/pkg/opts/Integer" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/duration" - "github.com/indra-labs/indra/pkg/opts/float" - "github.com/indra-labs/indra/pkg/opts/list" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/opts/text" - "github.com/indra-labs/indra/pkg/opts/toggle" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/duration" + "github.com/indra-labs/indra/pkg/proc/opts/float" + "github.com/indra-labs/indra/pkg/proc/opts/integer" + "github.com/indra-labs/indra/pkg/proc/opts/list" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/text" + "github.com/indra-labs/indra/pkg/proc/opts/toggle" ) const lorem = ` diff --git a/pkg/cmds/help.go b/pkg/proc/cmds/help.go similarity index 96% rename from pkg/cmds/help.go rename to pkg/proc/cmds/help.go index c2a710d0..0c743e5a 100644 --- a/pkg/cmds/help.go +++ b/pkg/proc/cmds/help.go @@ -9,8 +9,8 @@ import ( "sync" "text/tabwriter" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/util" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/util/norm" ) // Help is a default top level command that is injected into a Command at the @@ -80,7 +80,7 @@ func HelpEntrypoint(c *Command, args []string) (err error) { c.ForEach(func(cm *Command, depth int) bool { for i := range args { // check for match of current command name - if util.Norm(cm.Name) == util.Norm(args[i]) { + if norm.Norm(cm.Name) == norm.Norm(args[i]) { if len(args) == 1 { foundCmdWhole = true *foundCmds = append(*foundCmds, cm) @@ -88,15 +88,15 @@ func HelpEntrypoint(c *Command, args []string) (err error) { } } // or partial match. - if strings.Contains(util.Norm(cm.Name), - util.Norm(args[i])) { + if strings.Contains(norm.Norm(cm.Name), + norm.Norm(args[i])) { *foundCmds = append(*foundCmds, cm) } // check for matches on configs for ops := range cm.Configs { - if strings.Contains(util.Norm(ops), - util.Norm(args[i])) { + if strings.Contains(norm.Norm(ops), + norm.Norm(args[i])) { // in the case of specifying a command // and an option and the option is from // the command, and there is only two @@ -107,8 +107,8 @@ func HelpEntrypoint(c *Command, args []string) (err error) { // recognised to indicate show detail if len(args) == 2 && len(*foundCmds) == 1 && - util.Norm(ops) == - util.Norm(args[i]) && + norm.Norm(ops) == + norm.Norm(args[i]) && cm.Configs[ops].Path(). Equal(cm.Path) { diff --git a/pkg/cmds/marshal.go b/pkg/proc/cmds/marshal.go similarity index 92% rename from pkg/cmds/marshal.go rename to pkg/proc/cmds/marshal.go index ae97d398..da77add5 100644 --- a/pkg/cmds/marshal.go +++ b/pkg/proc/cmds/marshal.go @@ -9,14 +9,14 @@ import ( "strings" "time" - "github.com/indra-labs/indra/pkg/opts/Integer" - "github.com/indra-labs/indra/pkg/opts/duration" - "github.com/indra-labs/indra/pkg/opts/float" - "github.com/indra-labs/indra/pkg/opts/list" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/opts/text" - "github.com/indra-labs/indra/pkg/opts/toggle" - path2 "github.com/indra-labs/indra/pkg/path" + "github.com/indra-labs/indra/pkg/proc/opts/duration" + "github.com/indra-labs/indra/pkg/proc/opts/float" + "github.com/indra-labs/indra/pkg/proc/opts/integer" + "github.com/indra-labs/indra/pkg/proc/opts/list" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/text" + "github.com/indra-labs/indra/pkg/proc/opts/toggle" + path2 "github.com/indra-labs/indra/pkg/util/path/path" "github.com/naoina/toml" ) diff --git a/pkg/log/log.go b/pkg/proc/log/log.go similarity index 100% rename from pkg/log/log.go rename to pkg/proc/log/log.go diff --git a/pkg/log/log_test.go b/pkg/proc/log/log_test.go similarity index 100% rename from pkg/log/log_test.go rename to pkg/proc/log/log_test.go diff --git a/pkg/opts/config/interface.go b/pkg/proc/opts/config/interface.go similarity index 91% rename from pkg/opts/config/interface.go rename to pkg/proc/opts/config/interface.go index d8b33079..a8b004d3 100644 --- a/pkg/opts/config/interface.go +++ b/pkg/proc/opts/config/interface.go @@ -3,8 +3,8 @@ package config import ( "time" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/path" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/path/path" ) // Concrete is a struct of functions that return the concrete values. Only the diff --git a/pkg/opts/duration/spec.go b/pkg/proc/opts/duration/spec.go similarity index 88% rename from pkg/opts/duration/spec.go rename to pkg/proc/opts/duration/spec.go index 1dc9bb7f..4c8103f4 100644 --- a/pkg/opts/duration/spec.go +++ b/pkg/proc/opts/duration/spec.go @@ -6,10 +6,10 @@ import ( "time" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) diff --git a/pkg/opts/float/spec.go b/pkg/proc/opts/float/spec.go similarity index 88% rename from pkg/opts/float/spec.go rename to pkg/proc/opts/float/spec.go index c19da5d0..894bc224 100644 --- a/pkg/opts/float/spec.go +++ b/pkg/proc/opts/float/spec.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) diff --git a/pkg/opts/Integer/spec.go b/pkg/proc/opts/integer/spec.go similarity index 88% rename from pkg/opts/Integer/spec.go rename to pkg/proc/opts/integer/spec.go index cc7e76f2..214320b2 100644 --- a/pkg/opts/Integer/spec.go +++ b/pkg/proc/opts/integer/spec.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) diff --git a/pkg/opts/list/spec.go b/pkg/proc/opts/list/spec.go similarity index 87% rename from pkg/opts/list/spec.go rename to pkg/proc/opts/list/spec.go index 1e5f6134..42f97d69 100644 --- a/pkg/opts/list/spec.go +++ b/pkg/proc/opts/list/spec.go @@ -4,11 +4,11 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - normalize2 "github.com/indra-labs/indra/pkg/opts/normalize" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/normalize" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) @@ -96,7 +96,7 @@ func NormalizeNetworkAddress(defaultPort string, return func(o *Opt) (e error) { var a []string - a, e = normalize2.Addresses( + a, e = normalize.Addresses( o.v.Load().([]string), defaultPort, userOnly) if !log.E.Chk(e) { o.x.Store(a) @@ -113,7 +113,7 @@ func NormalizeFilesystemPath(abs bool, appName string) func(*Opt) error { strings := o.v.Load().([]string) for i := range strings { var cleaned string - cleaned, e = normalize2.ResolvePath(strings[i], appName, abs) + cleaned, e = normalize.ResolvePath(strings[i], appName, abs) if !log.E.Chk(e) { strings[i] = cleaned } diff --git a/pkg/opts/meta/metadata.go b/pkg/proc/opts/meta/metadata.go similarity index 100% rename from pkg/opts/meta/metadata.go rename to pkg/proc/opts/meta/metadata.go diff --git a/pkg/opts/normalize/addresses.go b/pkg/proc/opts/normalize/addresses.go similarity index 97% rename from pkg/opts/normalize/addresses.go rename to pkg/proc/opts/normalize/addresses.go index 9140e82c..fccd787b 100644 --- a/pkg/opts/normalize/addresses.go +++ b/pkg/proc/opts/normalize/addresses.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/opts/normalize/paths.go b/pkg/proc/opts/normalize/paths.go similarity index 95% rename from pkg/opts/normalize/paths.go rename to pkg/proc/opts/normalize/paths.go index 69efc4ec..2b7c8d70 100644 --- a/pkg/opts/normalize/paths.go +++ b/pkg/proc/opts/normalize/paths.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/indra-labs/indra/pkg/appdata" + "github.com/indra-labs/indra/pkg/util/appdata" ) func ResolvePath(input, appName string, abs bool) (cleaned string, e error) { diff --git a/pkg/opts/text/spec.go b/pkg/proc/opts/text/spec.go similarity index 84% rename from pkg/opts/text/spec.go rename to pkg/proc/opts/text/spec.go index 90fff35b..571023ab 100644 --- a/pkg/opts/text/spec.go +++ b/pkg/proc/opts/text/spec.go @@ -4,11 +4,11 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - normalize2 "github.com/indra-labs/indra/pkg/opts/normalize" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/proc/opts/normalize" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) @@ -85,7 +85,7 @@ func NormalizeNetworkAddress(defaultPort string, return func(o *Opt) (e error) { var a string - a, e = normalize2.Address(o.v.Load(), defaultPort, userOnly) + a, e = normalize.Address(o.v.Load(), defaultPort, userOnly) if !log.E.Chk(e) { o.x.Store(a) } @@ -99,7 +99,7 @@ func NormalizeNetworkAddress(defaultPort string, func NormalizeFilesystemPath(abs bool, appName string) func(*Opt) error { return func(o *Opt) (e error) { var cleaned string - cleaned, e = normalize2.ResolvePath(o.v.Load(), appName, abs) + cleaned, e = normalize.ResolvePath(o.v.Load(), appName, abs) if !log.E.Chk(e) { o.x.Store(cleaned) } diff --git a/pkg/opts/toggle/spec.go b/pkg/proc/opts/toggle/spec.go similarity index 88% rename from pkg/opts/toggle/spec.go rename to pkg/proc/opts/toggle/spec.go index 7645da15..bd62d9b7 100644 --- a/pkg/opts/toggle/spec.go +++ b/pkg/proc/opts/toggle/spec.go @@ -6,10 +6,10 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/opts/config" - "github.com/indra-labs/indra/pkg/opts/meta" - "github.com/indra-labs/indra/pkg/path" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/proc/opts/config" + "github.com/indra-labs/indra/pkg/proc/opts/meta" + "github.com/indra-labs/indra/pkg/util/path/path" "go.uber.org/atomic" ) diff --git a/pkg/server/metrics/host.go b/pkg/server/metrics/host.go index 25c3a38a..e7ae96c2 100644 --- a/pkg/server/metrics/host.go +++ b/pkg/server/metrics/host.go @@ -6,7 +6,7 @@ import ( "time" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/libp2p/go-libp2p/core/host" ) diff --git a/pkg/server/server.go b/pkg/server/server.go index cb6b132f..7b04c6bb 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -2,16 +2,17 @@ package server import ( "context" + "time" + "github.com/indra-labs/indra" "github.com/indra-labs/indra/pkg/cfg" "github.com/indra-labs/indra/pkg/interrupt" - log2 "github.com/indra-labs/indra/pkg/log" "github.com/indra-labs/indra/pkg/p2p/introducer" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/server/metrics" "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/core/host" "github.com/multiformats/go-multiaddr" - "time" ) var ( @@ -69,9 +70,9 @@ func (srv *Server) Serve() (err error) { go introducer.Bootstrap(ctx, srv.host, srv.config.SeedAddresses) // Get some basic metrics for the host - //metrics.Init() - //metrics.Set('indra.host.status.reporting.interval', 30 * time.Second) - //metrics.Enable('indra.host.status') + // metrics.Init() + // metrics.Set('indra.host.status.reporting.interval', 30 * time.Second) + // metrics.Enable('indra.host.status') metrics.SetInterval(30 * time.Second) go metrics.HostStatus(ctx, srv.host) diff --git a/pkg/service/service.go b/pkg/service/service.go index 76ee6782..307025f8 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -1,12 +1,12 @@ package service import ( - "github.com/indra-labs/indra/pkg/ifc" + "github.com/indra-labs/indra/pkg/types" ) type Service struct { Port uint16 - ifc.Transport + types.Transport } type Services []*Service diff --git a/pkg/tests/testutils.go b/pkg/tests/testutils.go index 7240d20f..16326781 100644 --- a/pkg/tests/testutils.go +++ b/pkg/tests/testutils.go @@ -4,10 +4,10 @@ import ( "crypto/rand" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/traffic/session.go b/pkg/traffic/session.go index adddce53..0973f0ef 100644 --- a/pkg/traffic/session.go +++ b/pkg/traffic/session.go @@ -4,14 +4,14 @@ import ( "sync" "github.com/indra-labs/indra" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/identity" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" "github.com/indra-labs/indra/pkg/lnd/lnwire" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" "github.com/indra-labs/indra/pkg/payment" - "github.com/indra-labs/indra/pkg/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/transport/sim.go b/pkg/transport/sim.go index fe173077..f1e8a27b 100644 --- a/pkg/transport/sim.go +++ b/pkg/transport/sim.go @@ -2,8 +2,8 @@ package transport import ( "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/util/slice" ) var ( diff --git a/pkg/transport/transport.go b/pkg/transport/transport.go index c866f942..b800acf6 100644 --- a/pkg/transport/transport.go +++ b/pkg/transport/transport.go @@ -1,7 +1,7 @@ package transport import ( - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/util/slice" ) type Dispatcher chan slice.Bytes diff --git a/pkg/ifc/interfaces.go b/pkg/types/interfaces.go similarity index 60% rename from pkg/ifc/interfaces.go rename to pkg/types/interfaces.go index 4b3f2909..7f61169a 100644 --- a/pkg/ifc/interfaces.go +++ b/pkg/types/interfaces.go @@ -1,7 +1,7 @@ -package ifc +package types import ( - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/util/slice" ) type Transport interface { diff --git a/pkg/types/types.go b/pkg/types/types.go index cbd76ea4..e9e1cb86 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -1,7 +1,7 @@ package types import ( - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/util/slice" ) // Onion is an interface for the layers of messages each encrypted inside a diff --git a/pkg/appdata/appdata.go b/pkg/util/appdata/appdata.go similarity index 100% rename from pkg/appdata/appdata.go rename to pkg/util/appdata/appdata.go diff --git a/pkg/appdata/appdata_test.go b/pkg/util/appdata/appdata_test.go similarity index 99% rename from pkg/appdata/appdata_test.go rename to pkg/util/appdata/appdata_test.go index f1fe604f..9b294d22 100644 --- a/pkg/appdata/appdata_test.go +++ b/pkg/util/appdata/appdata_test.go @@ -8,7 +8,7 @@ import ( "testing" "unicode" - "github.com/indra-labs/indra/pkg/appdata" + "github.com/indra-labs/indra/pkg/util/appdata" ) // TestAppDataDir tests the API for Dir to ensure it gives expected results for various operating systems. diff --git a/pkg/util/apputil.go b/pkg/util/apputil.go deleted file mode 100644 index e56e80f9..00000000 --- a/pkg/util/apputil.go +++ /dev/null @@ -1,72 +0,0 @@ -package util - -import ( - "os" - "path/filepath" - "runtime" - "strings" -) - -// EnsureDir checks a file could be written to a path, creates the directories as needed -func EnsureDir(fileName string) { - dirName := filepath.Dir(fileName) - if _, serr := os.Stat(dirName); serr != nil { - merr := os.MkdirAll(dirName, os.ModePerm) - if merr != nil { - panic(merr) - } - } -} - -// FileExists reports whether the named file or directory exists. -func FileExists(filePath string) bool { - _, e := os.Stat(filePath) - return e == nil -} - -// MinUint32 is a helper function to return the minimum of two uint32s. This avoids a math import and the need to cast -// to floats. -func MinUint32(a, b uint32) uint32 { - if a < b { - return a - } - return b -} - -// PrependForWindows runs a command with a terminal -func PrependForWindows(args []string) []string { - if runtime.GOOS == "windows" { - args = append( - []string{ - "cmd.exe", - "/C", - }, - args..., - ) - } - return args -} - -// PrependForWindowsWithStart runs a process independently -func PrependForWindowsWithStart(args []string) []string { - if runtime.GOOS == "windows" { - args = append( - []string{ - "cmd.exe", - "/C", - "start", - }, - args..., - ) - } - return args -} - -func Norm(s string) string { - return strings.ToLower(s) -} - -func NormEq(a, b string) bool { - an, bn := Norm(a), Norm(b) - return an == bn -} diff --git a/pkg/util/file/file.go b/pkg/util/file/file.go new file mode 100644 index 00000000..2854eaef --- /dev/null +++ b/pkg/util/file/file.go @@ -0,0 +1,23 @@ +package file + +import ( + "os" + "path/filepath" +) + +// EnsureDir checks a file could be written to a path, creates the directories as needed +func EnsureDir(fileName string) { + dirName := filepath.Dir(fileName) + if _, serr := os.Stat(dirName); serr != nil { + merr := os.MkdirAll(dirName, os.ModePerm) + if merr != nil { + panic(merr) + } + } +} + +// FileExists reports whether the named file or directory exists. +func FileExists(filePath string) bool { + _, e := os.Stat(filePath) + return e == nil +} diff --git a/pkg/util/math/math.go b/pkg/util/math/math.go new file mode 100644 index 00000000..f6906b7d --- /dev/null +++ b/pkg/util/math/math.go @@ -0,0 +1,10 @@ +package math + +// MinUint32 is a helper function to return the minimum of two uint32s. This avoids a math import and the need to cast +// to floats. +func MinUint32(a, b uint32) uint32 { + if a < b { + return a + } + return b +} diff --git a/pkg/util/norm/norm.go b/pkg/util/norm/norm.go new file mode 100644 index 00000000..123bf94a --- /dev/null +++ b/pkg/util/norm/norm.go @@ -0,0 +1,14 @@ +package norm + +import ( + "strings" +) + +func Norm(s string) string { + return strings.ToLower(s) +} + +func Eq(a, b string) bool { + an, bn := Norm(a), Norm(b) + return an == bn +} diff --git a/pkg/path/path.go b/pkg/util/path/path/path.go similarity index 86% rename from pkg/path/path.go rename to pkg/util/path/path/path.go index c9e09a9a..0908c77c 100644 --- a/pkg/path/path.go +++ b/pkg/util/path/path/path.go @@ -4,8 +4,8 @@ import ( "strings" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/util" + log2 "github.com/indra-labs/indra/pkg/proc/log" + "github.com/indra-labs/indra/pkg/util/norm" ) var ( @@ -49,8 +49,8 @@ func (p Path) Common(p2 Path) (o Path) { func (p Path) Equal(p2 Path) bool { if len(p) == len(p2) { for i := range p { - if util.Norm(p[i]) != - util.Norm(p2[i]) { + if norm.Norm(p[i]) != + norm.Norm(p2[i]) { return false } } diff --git a/pkg/slice/interfaces_test.go b/pkg/util/slice/interfaces_test.go similarity index 95% rename from pkg/slice/interfaces_test.go rename to pkg/util/slice/interfaces_test.go index 167e3634..dd618744 100644 --- a/pkg/slice/interfaces_test.go +++ b/pkg/util/slice/interfaces_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/tests" ) diff --git a/pkg/slice/slice.go b/pkg/util/slice/slice.go similarity index 98% rename from pkg/slice/slice.go rename to pkg/util/slice/slice.go index a0e77538..7d92cd85 100644 --- a/pkg/slice/slice.go +++ b/pkg/util/slice/slice.go @@ -13,8 +13,8 @@ import ( "unsafe" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/slice/slice_test.go b/pkg/util/slice/slice_test.go similarity index 92% rename from pkg/slice/slice_test.go rename to pkg/util/slice/slice_test.go index aac1032e..67ca80ae 100644 --- a/pkg/slice/slice_test.go +++ b/pkg/util/slice/slice_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/indra-labs/indra/pkg/sha256" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/tests" ) diff --git a/pkg/util/windows/windows.go b/pkg/util/windows/windows.go new file mode 100644 index 00000000..731766e3 --- /dev/null +++ b/pkg/util/windows/windows.go @@ -0,0 +1,34 @@ +package windows + +import ( + "runtime" +) + +// PrependForWindows runs a command with a terminal +func PrependForWindows(args []string) []string { + if runtime.GOOS == "windows" { + args = append( + []string{ + "cmd.exe", + "/C", + }, + args..., + ) + } + return args +} + +// PrependForWindowsWithStart runs a process independently +func PrependForWindowsWithStart(args []string) []string { + if runtime.GOOS == "windows" { + args = append( + []string{ + "cmd.exe", + "/C", + "start", + }, + args..., + ) + } + return args +} diff --git a/pkg/wire/balance/balance.go b/pkg/wire/balance/balance.go index 75ae333f..ce7458ec 100644 --- a/pkg/wire/balance/balance.go +++ b/pkg/wire/balance/balance.go @@ -2,11 +2,11 @@ package balance import ( "github.com/indra-labs/indra" + "github.com/indra-labs/indra/pkg/crypto/nonce" "github.com/indra-labs/indra/pkg/lnd/lnwire" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/confirm/confirmation.go b/pkg/wire/confirm/confirmation.go index 655d807e..bd6a228c 100644 --- a/pkg/wire/confirm/confirmation.go +++ b/pkg/wire/confirm/confirmation.go @@ -4,10 +4,10 @@ import ( "fmt" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/nonce" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/confirm/confirms.go b/pkg/wire/confirm/confirms.go index 69eaa2cb..d541faf7 100644 --- a/pkg/wire/confirm/confirms.go +++ b/pkg/wire/confirm/confirms.go @@ -4,7 +4,7 @@ import ( "sync" "time" - "github.com/indra-labs/indra/pkg/nonce" + "github.com/indra-labs/indra/pkg/crypto/nonce" ) type Hook func(cf nonce.ID) diff --git a/pkg/wire/delay/delay.go b/pkg/wire/delay/delay.go index d0092795..8e334cc2 100644 --- a/pkg/wire/delay/delay.go +++ b/pkg/wire/delay/delay.go @@ -4,9 +4,9 @@ import ( "time" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/exit/exit.go b/pkg/wire/exit/exit.go index e73230cc..4b565b9d 100644 --- a/pkg/wire/exit/exit.go +++ b/pkg/wire/exit/exit.go @@ -3,11 +3,11 @@ package exit import ( "github.com/davecgh/go-spew/spew" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/forward/forward.go b/pkg/wire/forward/forward.go index a2aeb96d..d0e28390 100644 --- a/pkg/wire/forward/forward.go +++ b/pkg/wire/forward/forward.go @@ -6,9 +6,9 @@ import ( "net/netip" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/getbalance/getbalance.go b/pkg/wire/getbalance/getbalance.go index 98ed52fd..48a079f6 100644 --- a/pkg/wire/getbalance/getbalance.go +++ b/pkg/wire/getbalance/getbalance.go @@ -3,11 +3,11 @@ package getbalance import ( "github.com/davecgh/go-spew/spew" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/layer/layer.go b/pkg/wire/layer/layer.go index 7520ccfa..ac759141 100644 --- a/pkg/wire/layer/layer.go +++ b/pkg/wire/layer/layer.go @@ -5,14 +5,14 @@ import ( "fmt" "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/ciph" - "github.com/indra-labs/indra/pkg/key/cloak" - "github.com/indra-labs/indra/pkg/key/prv" - "github.com/indra-labs/indra/pkg/key/pub" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/ciph" + "github.com/indra-labs/indra/pkg/crypto/key/cloak" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/pub" + "github.com/indra-labs/indra/pkg/crypto/nonce" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/magicbytes/magic.go b/pkg/wire/magicbytes/magic.go index b99eb3a4..436346a2 100644 --- a/pkg/wire/magicbytes/magic.go +++ b/pkg/wire/magicbytes/magic.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" + log2 "github.com/indra-labs/indra/pkg/proc/log" ) var ( diff --git a/pkg/wire/noop/noop.go b/pkg/wire/noop/noop.go index ee8d716c..457e3749 100644 --- a/pkg/wire/noop/noop.go +++ b/pkg/wire/noop/noop.go @@ -1,8 +1,8 @@ package noop import ( - "github.com/indra-labs/indra/pkg/slice" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" ) type OnionSkin struct { diff --git a/pkg/wire/response/hook.go b/pkg/wire/response/hook.go index 7ae8d37d..681e0a9e 100644 --- a/pkg/wire/response/hook.go +++ b/pkg/wire/response/hook.go @@ -3,8 +3,8 @@ package response import ( "time" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/sha256" + "github.com/indra-labs/indra/pkg/util/slice" ) type Hook struct { diff --git a/pkg/wire/response/response.go b/pkg/wire/response/response.go index 56d3b1b1..f725ff9c 100644 --- a/pkg/wire/response/response.go +++ b/pkg/wire/response/response.go @@ -2,10 +2,10 @@ package response import ( "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/reverse/reverse.go b/pkg/wire/reverse/reverse.go index a36fe24c..b692b7d1 100644 --- a/pkg/wire/reverse/reverse.go +++ b/pkg/wire/reverse/reverse.go @@ -5,9 +5,9 @@ import ( "net/netip" "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" ) diff --git a/pkg/wire/session/session.go b/pkg/wire/session/session.go index e73243e8..fe0fbde6 100644 --- a/pkg/wire/session/session.go +++ b/pkg/wire/session/session.go @@ -2,14 +2,14 @@ package session import ( "github.com/indra-labs/indra" - "github.com/indra-labs/indra/pkg/key/prv" + "github.com/indra-labs/indra/pkg/crypto/key/prv" + "github.com/indra-labs/indra/pkg/crypto/nonce" + "github.com/indra-labs/indra/pkg/crypto/sha256" "github.com/indra-labs/indra/pkg/lnd/lnwire" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/nonce" "github.com/indra-labs/indra/pkg/payment" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" "github.com/indra-labs/indra/pkg/wire/noop" ) diff --git a/pkg/wire/token/token.go b/pkg/wire/token/token.go index 4a33cc3f..8831de21 100644 --- a/pkg/wire/token/token.go +++ b/pkg/wire/token/token.go @@ -2,10 +2,10 @@ package token import ( "github.com/indra-labs/indra" - log2 "github.com/indra-labs/indra/pkg/log" - "github.com/indra-labs/indra/pkg/sha256" - "github.com/indra-labs/indra/pkg/slice" + "github.com/indra-labs/indra/pkg/crypto/sha256" + log2 "github.com/indra-labs/indra/pkg/proc/log" "github.com/indra-labs/indra/pkg/types" + "github.com/indra-labs/indra/pkg/util/slice" "github.com/indra-labs/indra/pkg/wire/magicbytes" )