Updating encoder and logger

This commit is contained in:
David Vennik
2022-12-22 16:18:52 +00:00
parent 9d499830e1
commit cff3bf7eb3
14 changed files with 57 additions and 79 deletions

View File

@@ -36,7 +36,7 @@ func main() {
log.I.Ln("running node")
return nil
},
Default: cmds.Tags("ind"),
Default: cmds.Tags("help"),
Configs: config.Opts{
"AutoPorts": toggle.New(meta.Data{
Label: "Automatic Ports",
@@ -64,15 +64,11 @@ func main() {
var application *app.App
log.I.S(command)
if application, err = app.New(command, os.Args); err != nil {
spew.Dump(err)
os.Exit(1)
}
log.I.S(application)
if err = application.Launch(); err != nil {
spew.Dump(err)
os.Exit(1)

2
go.mod
View File

@@ -3,7 +3,7 @@ module github.com/Indra-Labs/indra
go 1.19
require (
github.com/cybriq/proc v0.2.0
github.com/cybriq/proc v0.20.4
github.com/cybriq/qu v0.1.2
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0

4
go.sum
View File

@@ -6,8 +6,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cybriq/proc v0.2.0 h1:oemzeS1eXBX0OZZk0U5MXe+BzSvF/pQyPZ8Rt3jIc/U=
github.com/cybriq/proc v0.2.0/go.mod h1:b6JDUUwfe8soxWzvAziWA/msrb73O2v6gZEQL+wHYx8=
github.com/cybriq/proc v0.20.4 h1:BRlqzRdENMXkdWobtfm16vQ0k7jCnkP27A5SMkVEmbg=
github.com/cybriq/proc v0.20.4/go.mod h1:b6JDUUwfe8soxWzvAziWA/msrb73O2v6gZEQL+wHYx8=
github.com/cybriq/qu v0.1.2 h1:4R65BhG22C3mY4fXYZpfJYklw9N1AVkCwTwrby4andY=
github.com/cybriq/qu v0.1.2/go.mod h1:1Ph7YWr5HVJTBSRTQ8cFcaFE+DK56r+cSpbNWD+CQS8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@@ -8,9 +8,9 @@ import (
"github.com/Indra-Labs/indra/pkg/wire/magicbytes"
)
// Type cipher delivers a pair of public keys to be used in association with a Return
// specifically in the situation of a node bootstrapping sessions, which doesn't
// have sessions yet.
// Type cipher delivers a pair of public keys to be used in association with a
// Return specifically in the situation of a node bootstrapping sessions, which
// doesn't have sessions yet.
type Type struct {
Header, Payload *prv.Key
types.Onion
@@ -39,13 +39,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -14,8 +14,8 @@ var (
check = log.E.Chk
)
// Type confirmation is an encryption layer for messages returned to the client on
// the inside of an onion, for Ping and Cipher messages, providing a
// Type confirmation is an encryption layer for messages returned to the client
// on the inside of an onion, for Ping and Cipher messages, providing a
// confirmation of the transit of the onion through its encoded route.
//
// It is encrypted because otherwise internal identifiers could be leaked and
@@ -48,13 +48,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -64,13 +64,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -42,13 +42,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -21,9 +21,9 @@ var (
check = log.E.Chk
)
// Type message is the generic top level wrapper for an Onion. All following messages
// are wrapped inside this. This type provides the encryption for each layer,
// and a header which a relay uses to determine what cipher to use.
// Type message is the generic top level wrapper for an Onion. All following
// messages are wrapped inside this. This type provides the encryption for each
// layer, and a header which a relay uses to determine what cipher to use.
type Type struct {
To *address.Sender
From *prv.Key

View File

@@ -46,13 +46,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -36,13 +36,11 @@ func (x Response) Encode(o slice.Bytes, c *slice.Cursor) {
func (x Response) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -46,13 +46,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -16,11 +16,11 @@ var (
check = log.E.Chk
)
// Type session is a message containing two public keys which identify to a relay how
// to decrypt the header in a Return message, using the HeaderKey, and the
// payload, which uses the PayloadKey. There is two keys in order to prevent the
// Exit node from being able to decrypt the header, but enable it to encrypt the
// payload, and Return relay hops have these key pairs and identify the
// Type session is a message containing two public keys which identify to a
// relay how to decrypt the header in a Return message, using the HeaderKey, and
// the payload, which uses the PayloadKey. There is two keys in order to prevent
// the Exit node from being able to decrypt the header, but enable it to encrypt
// the payload, and Return relay hops have these key pairs and identify the
// HeaderKey and then know they can unwrap their layer of the payload using the
// PayloadKey.
//
@@ -56,13 +56,11 @@ func (x *Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x *Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -34,13 +34,11 @@ func (x Type) Encode(o slice.Bytes, c *slice.Cursor) {
func (x Type) Decode(b slice.Bytes) (e error) {
magic := Magic
if !magicbytes.CheckMagic(b, magic) {
return magicbytes.WrongMagic(x, b, magic)
if !magicbytes.CheckMagic(b, Magic) {
return magicbytes.WrongMagic(x, b, Magic)
}
minLen := MinLen
if len(b) < minLen {
return magicbytes.TooShort(len(b), minLen, string(magic))
if len(b) < MinLen {
return magicbytes.TooShort(len(b), MinLen, string(Magic))
}
sc := slice.Cursor(0)
c := &sc

View File

@@ -13,11 +13,11 @@ var (
// GitRef is the gitref, as in refs/heads/branchname.
GitRef = "refs/heads/main"
// ParentGitCommit is the commit hash of the parent HEAD.
ParentGitCommit = "9b62d2923963946cfbe6bba41d99db24c0adee8e"
ParentGitCommit = "f3abb3f85ba85b7372a1c636c900827c6f33e90a"
// BuildTime stores the time when the current binary was built.
BuildTime = "2022-12-22T12:41:32Z"
BuildTime = "2022-12-22T16:18:52Z"
// SemVer lists the (latest) git tag on the build.
SemVer = "v0.0.214"
SemVer = "v0.0.215"
// PathBase is the path base returned from runtime caller.
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
// Major is the major number from the tag.
@@ -25,7 +25,7 @@ var (
// Minor is the minor number from the tag.
Minor = 0
// Patch is the patch version number from the tag.
Patch = 214
Patch = 215
)
// Version returns a pretty printed version information string.