From 03e134905819f89ac830b335a48bc4d23719f603 Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 12 Nov 2020 20:21:16 -0500 Subject: [PATCH 1/4] update goSam version to 0.32.27 --- go.mod | 2 +- go.sum | 3 +++ vendor/modules.txt | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 98ddbd15..3f0df70b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect github.com/dsnet/compress v0.0.1 - github.com/eyedeekay/goSam v0.32.22 + github.com/eyedeekay/goSam v0.32.27 github.com/eyedeekay/sam3 v0.32.3 // indirect github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect diff --git a/go.sum b/go.sum index 6add93a1..9378a3b1 100644 --- a/go.sum +++ b/go.sum @@ -140,8 +140,11 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/eyedeekay/goSam v0.32.22 h1:SD0GEQ8MGJ1wZ4MepSa0mpZjiZAGMSTUhSwAZVrm2kg= github.com/eyedeekay/goSam v0.32.22/go.mod h1:YIklxqKiJ3I5JNRgb5pM7VCQOSNDGnVulHnrKBbbECM= +github.com/eyedeekay/goSam v0.32.27 h1:yYdL384sLPge4K0vK7l7v4vBakrK/kf6qW9hQ7uyW/E= +github.com/eyedeekay/goSam v0.32.27/go.mod h1:YIklxqKiJ3I5JNRgb5pM7VCQOSNDGnVulHnrKBbbECM= github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab/go.mod h1:h7mvUAMgZ/rtRDUOkvKTK+8LnDMeUhJSoa5EPdB51fc= github.com/eyedeekay/sam3 v0.32.2/go.mod h1:Y3igFVzN4ybqkkpfUWULGhw7WRp8lieq0ORXbLBbcZM= +github.com/eyedeekay/sam3 v0.32.3 h1:PW1vQoo2H7c3Q4l2DngJqpSdsdJprMCk9NOkUHtcdmM= github.com/eyedeekay/sam3 v0.32.3/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= diff --git a/vendor/modules.txt b/vendor/modules.txt index c76e9208..8d83c201 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -81,11 +81,12 @@ github.com/davecgh/go-spew/spew github.com/dsnet/compress/brotli github.com/dsnet/compress/internal github.com/dsnet/compress/internal/errors -# github.com/eyedeekay/goSam v0.32.22 +# github.com/eyedeekay/goSam v0.32.27 ## explicit github.com/eyedeekay/goSam # github.com/eyedeekay/sam3 v0.32.3 ## explicit +github.com/eyedeekay/sam3/i2pkeys # github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 ## explicit # github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 From 04f851eeb6ba731e38188df80a4df710f2eabdd7 Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 12 Nov 2020 22:53:16 -0500 Subject: [PATCH 2/4] Actually, do 0.32.28 instead --- go.mod | 2 +- go.sum | 2 ++ vendor/github.com/eyedeekay/goSam/Makefile | 2 +- vendor/github.com/eyedeekay/goSam/README.md | 1 + vendor/github.com/eyedeekay/goSam/dial.go | 6 +++++- vendor/github.com/eyedeekay/goSam/go.sum | 1 + vendor/github.com/eyedeekay/goSam/options.go | 12 ++++++++++++ vendor/github.com/eyedeekay/goSam/replyParser.go | 9 ++++++--- vendor/modules.txt | 2 +- 9 files changed, 30 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 3f0df70b..0c7787e9 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect github.com/dsnet/compress v0.0.1 - github.com/eyedeekay/goSam v0.32.27 + github.com/eyedeekay/goSam v0.32.28 github.com/eyedeekay/sam3 v0.32.3 // indirect github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect diff --git a/go.sum b/go.sum index 695a7c8e..34983e1b 100644 --- a/go.sum +++ b/go.sum @@ -142,6 +142,8 @@ github.com/eyedeekay/goSam v0.32.22 h1:SD0GEQ8MGJ1wZ4MepSa0mpZjiZAGMSTUhSwAZVrm2 github.com/eyedeekay/goSam v0.32.22/go.mod h1:YIklxqKiJ3I5JNRgb5pM7VCQOSNDGnVulHnrKBbbECM= github.com/eyedeekay/goSam v0.32.27 h1:yYdL384sLPge4K0vK7l7v4vBakrK/kf6qW9hQ7uyW/E= github.com/eyedeekay/goSam v0.32.27/go.mod h1:YIklxqKiJ3I5JNRgb5pM7VCQOSNDGnVulHnrKBbbECM= +github.com/eyedeekay/goSam v0.32.28 h1:8O9aDGr45EIS82TRm4x0xAnGnz6ZHW0/8oyqziYiN9U= +github.com/eyedeekay/goSam v0.32.28/go.mod h1:YIklxqKiJ3I5JNRgb5pM7VCQOSNDGnVulHnrKBbbECM= github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab/go.mod h1:h7mvUAMgZ/rtRDUOkvKTK+8LnDMeUhJSoa5EPdB51fc= github.com/eyedeekay/sam3 v0.32.2/go.mod h1:Y3igFVzN4ybqkkpfUWULGhw7WRp8lieq0ORXbLBbcZM= github.com/eyedeekay/sam3 v0.32.3 h1:PW1vQoo2H7c3Q4l2DngJqpSdsdJprMCk9NOkUHtcdmM= diff --git a/vendor/github.com/eyedeekay/goSam/Makefile b/vendor/github.com/eyedeekay/goSam/Makefile index 94fdae3f..c73825aa 100644 --- a/vendor/github.com/eyedeekay/goSam/Makefile +++ b/vendor/github.com/eyedeekay/goSam/Makefile @@ -1,6 +1,6 @@ USER_GH=eyedeekay -VERSION=0.32.27 +VERSION=0.32.28 packagename=gosam echo: fmt diff --git a/vendor/github.com/eyedeekay/goSam/README.md b/vendor/github.com/eyedeekay/goSam/README.md index 5fae8727..d39e25d3 100644 --- a/vendor/github.com/eyedeekay/goSam/README.md +++ b/vendor/github.com/eyedeekay/goSam/README.md @@ -85,6 +85,7 @@ to produce an unsigned deb for personal use only. For packagers, will produce a viable source package for use with Launchpad PPA's and other similar systems. + ### TODO * Improve recovery on failed sockets diff --git a/vendor/github.com/eyedeekay/goSam/dial.go b/vendor/github.com/eyedeekay/goSam/dial.go index 7bd9dac7..50b426c0 100644 --- a/vendor/github.com/eyedeekay/goSam/dial.go +++ b/vendor/github.com/eyedeekay/goSam/dial.go @@ -15,7 +15,11 @@ func (c *Client) DialContext(ctx context.Context, network, addr string) (net.Con if conn, err := c.Dial(network, addr); err != nil { errCh <- err } else if ctx.Err() != nil { - conn.Close() + var err error + c, err = c.NewClient() + if err != nil { + conn.Close() + } } else { connCh <- conn } diff --git a/vendor/github.com/eyedeekay/goSam/go.sum b/vendor/github.com/eyedeekay/goSam/go.sum index 6f9cf05b..30187b66 100644 --- a/vendor/github.com/eyedeekay/goSam/go.sum +++ b/vendor/github.com/eyedeekay/goSam/go.sum @@ -1,3 +1,4 @@ +github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab h1:EfTRHxGSbiaEyxNzvKRBWVIDw3mD8xXGxj4gvwFzY7Q= github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab/go.mod h1:h7mvUAMgZ/rtRDUOkvKTK+8LnDMeUhJSoa5EPdB51fc= github.com/eyedeekay/sam3 v0.32.2 h1:xODDY5nBVg0oK7KaYk7ofkXFoHPsmI1umhSv1TZlS7s= github.com/eyedeekay/sam3 v0.32.2/go.mod h1:Y3igFVzN4ybqkkpfUWULGhw7WRp8lieq0ORXbLBbcZM= diff --git a/vendor/github.com/eyedeekay/goSam/options.go b/vendor/github.com/eyedeekay/goSam/options.go index b812d45b..68f64448 100644 --- a/vendor/github.com/eyedeekay/goSam/options.go +++ b/vendor/github.com/eyedeekay/goSam/options.go @@ -369,6 +369,12 @@ func SetSignatureType(s string) func(*Client) error { //return the from port as a string. func (c *Client) from() string { + if c.fromport == "FROM_PORT=0" { + return "" + } + if c.fromport == "0" { + return "" + } if c.fromport == "" { return "" } @@ -377,6 +383,12 @@ func (c *Client) from() string { //return the to port as a string. func (c *Client) to() string { + if c.fromport == "TO_PORT=0" { + return "" + } + if c.fromport == "0" { + return "" + } if c.toport == "" { return "" } diff --git a/vendor/github.com/eyedeekay/goSam/replyParser.go b/vendor/github.com/eyedeekay/goSam/replyParser.go index c5d2e616..4abffa7e 100644 --- a/vendor/github.com/eyedeekay/goSam/replyParser.go +++ b/vendor/github.com/eyedeekay/goSam/replyParser.go @@ -39,7 +39,6 @@ type Reply struct { } func parseReply(line string) (*Reply, error) { - fmt.Println("PARSER PARTS", line) line = strings.TrimSpace(line) parts := strings.Split(line, " ") if len(parts) < 3 { @@ -54,9 +53,13 @@ func parseReply(line string) (*Reply, error) { for _, v := range parts[2:] { if strings.Contains(v, "FROM_PORT") { - r.From = v + if v != "FROM_PORT=0" { + r.From = v + } } else if strings.Contains(v, "TO_PORT") { - r.To = v + if v != "TO_PORT=0" { + r.To = v + } } else { kvPair := strings.SplitN(v, "=", 2) if kvPair != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 8d83c201..5880207b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -81,7 +81,7 @@ github.com/davecgh/go-spew/spew github.com/dsnet/compress/brotli github.com/dsnet/compress/internal github.com/dsnet/compress/internal/errors -# github.com/eyedeekay/goSam v0.32.27 +# github.com/eyedeekay/goSam v0.32.28 ## explicit github.com/eyedeekay/goSam # github.com/eyedeekay/sam3 v0.32.3 From 8ba86fa654aaabf628909ed407146c443e292893 Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 12 Nov 2020 23:17:41 -0500 Subject: [PATCH 3/4] Add missing files/dirs --- vendor/github.com/eyedeekay/goSam/i2pkeys.go | 35 ++++ .../eyedeekay/sam3/i2pkeys/I2PAddr.go | 198 ++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 vendor/github.com/eyedeekay/goSam/i2pkeys.go create mode 100644 vendor/github.com/eyedeekay/sam3/i2pkeys/I2PAddr.go diff --git a/vendor/github.com/eyedeekay/goSam/i2pkeys.go b/vendor/github.com/eyedeekay/goSam/i2pkeys.go new file mode 100644 index 00000000..e798f85b --- /dev/null +++ b/vendor/github.com/eyedeekay/goSam/i2pkeys.go @@ -0,0 +1,35 @@ +package goSam + +import ( + "errors" + + "github.com/eyedeekay/sam3/i2pkeys" +) + +// NewDestination generates a new I2P destination, creating the underlying +// public/private keys in the process. The public key can be used to send messages +// to the destination, while the private key can be used to reply to messages +func (c *Client) NewDestination(sigType ...string) (i2pkeys.I2PKeys, error) { + var ( + sigtmp string + keys i2pkeys.I2PKeys + ) + if len(sigType) > 0 { + sigtmp = sigType[0] + } + r, err := c.sendCmd( + "DEST GENERATE %s\n", + sigtmp, + ) + if err != nil { + return keys, err + } + var pub, priv string + if priv = r.Pairs["PRIV"]; priv == "" { + return keys, errors.New("failed to generate private destination key") + } + if pub = r.Pairs["PUB"]; pub == "" { + return keys, errors.New("failed to generate public destination key") + } + return i2pkeys.NewKeys(i2pkeys.I2PAddr(pub), priv), nil +} diff --git a/vendor/github.com/eyedeekay/sam3/i2pkeys/I2PAddr.go b/vendor/github.com/eyedeekay/sam3/i2pkeys/I2PAddr.go new file mode 100644 index 00000000..37ed2f53 --- /dev/null +++ b/vendor/github.com/eyedeekay/sam3/i2pkeys/I2PAddr.go @@ -0,0 +1,198 @@ +package i2pkeys + +import ( + "bytes" + "crypto/sha256" + "encoding/base32" + "encoding/base64" + "errors" + "io" + "strings" +) + +var ( + i2pB64enc *base64.Encoding = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~") + i2pB32enc *base32.Encoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567") +) + +// The public and private keys associated with an I2P destination. I2P hides the +// details of exactly what this is, so treat them as blobs, but generally: One +// pair of DSA keys, one pair of ElGamal keys, and sometimes (almost never) also +// a certificate. String() returns you the full content of I2PKeys and Addr() +// returns the public keys. +type I2PKeys struct { + Address I2PAddr // only the public key + Both string // both public and private keys +} + +// Creates I2PKeys from an I2PAddr and a public/private keypair string (as +// generated by String().) +func NewKeys(addr I2PAddr, both string) I2PKeys { + return I2PKeys{addr, both} +} + +// load keys from non standard format +func LoadKeysIncompat(r io.Reader) (k I2PKeys, err error) { + var buff bytes.Buffer + _, err = io.Copy(&buff, r) + if err == nil { + parts := strings.Split(buff.String(), "\n") + k = I2PKeys{I2PAddr(parts[0]), parts[1]} + } + return +} + +// store keys in non standard format +func StoreKeysIncompat(k I2PKeys, w io.Writer) (err error) { + _, err = io.WriteString(w, k.Address.Base64()+"\n"+k.Both) + return +} + +// Returns the public keys of the I2PKeys. +func (k I2PKeys) Addr() I2PAddr { + return k.Address +} + +// Returns the keys (both public and private), in I2Ps base64 format. Use this +// when you create sessions. +func (k I2PKeys) String() string { + return k.Both +} + +// I2PAddr represents an I2P destination, almost equivalent to an IP address. +// This is the humongously huge base64 representation of such an address, which +// really is just a pair of public keys and also maybe a certificate. (I2P hides +// the details of exactly what it is. Read the I2P specifications for more info.) +type I2PAddr string + +// an i2p destination hash, the .b32.i2p address if you will +type I2PDestHash [32]byte + +// create a desthash from a string b32.i2p address +func DestHashFromString(str string) (dhash I2PDestHash, err error) { + if strings.HasSuffix(str, ".b32.i2p") && len(str) == 60 { + // valid + _, err = i2pB32enc.Decode(dhash[:], []byte(str[:52]+"====")) + } else { + // invalid + err = errors.New("invalid desthash format") + } + return +} + +// get string representation of i2p dest hash(base32 version) +func (h I2PDestHash) String() string { + b32addr := make([]byte, 56) + i2pB32enc.Encode(b32addr, h[:]) + return string(b32addr[:52]) + ".b32.i2p" +} + +// get base64 representation of i2p dest sha256 hash(the 44-character one) +func (h I2PDestHash) Hash() string { + hash := sha256.New() + hash.Write(h[:]) + digest := hash.Sum(nil) + buf := make([]byte, 44) + i2pB64enc.Encode(buf, digest) + return string(buf) +} + +// Returns "I2P" +func (h *I2PDestHash) Network() string { + return "I2P" +} + +// Returns the base64 representation of the I2PAddr +func (a I2PAddr) Base64() string { + return string(a) +} + +// Returns the I2P destination (base64-encoded) +func (a I2PAddr) String() string { + return string(a) +} + +// Returns "I2P" +func (a I2PAddr) Network() string { + return "I2P" +} + +// Creates a new I2P address from a base64-encoded string. Checks if the address +// addr is in correct format. (If you know for sure it is, use I2PAddr(addr).) +func NewI2PAddrFromString(addr string) (I2PAddr, error) { + if strings.HasSuffix(addr, ".i2p") { + if strings.HasSuffix(addr, ".b32.i2p") { + return I2PAddr(""), errors.New("cannot convert .b32.i2p to full destination") + } + // strip off .i2p if it's there + addr = addr[:len(addr)-4] + } + addr = strings.Trim(addr, "\t\n\r\f ") + // very basic check + if len(addr) > 4096 || len(addr) < 516 { + return I2PAddr(""), errors.New("Not an I2P address") + } + buf := make([]byte, i2pB64enc.DecodedLen(len(addr))) + if _, err := i2pB64enc.Decode(buf, []byte(addr)); err != nil { + return I2PAddr(""), errors.New("Address is not base64-encoded") + } + return I2PAddr(addr), nil +} + +func FiveHundredAs() I2PAddr { + s := "" + for x := 0; x < 517; x++ { + s += "A" + } + r, _ := NewI2PAddrFromString(s) + return r +} + +// Creates a new I2P address from a byte array. The inverse of ToBytes(). +func NewI2PAddrFromBytes(addr []byte) (I2PAddr, error) { + if len(addr) > 4096 || len(addr) < 384 { + return I2PAddr(""), errors.New("Not an I2P address") + } + buf := make([]byte, i2pB64enc.EncodedLen(len(addr))) + i2pB64enc.Encode(buf, addr) + return I2PAddr(string(buf)), nil +} + +// Turns an I2P address to a byte array. The inverse of NewI2PAddrFromBytes(). +func (addr I2PAddr) ToBytes() ([]byte, error) { + buf := make([]byte, i2pB64enc.DecodedLen(len(addr))) + if _, err := i2pB64enc.Decode(buf, []byte(addr)); err != nil { + return buf, errors.New("Address is not base64-encoded") + } + return buf, nil +} + +func (addr I2PAddr) Bytes() []byte { + b, _ := addr.ToBytes() + return b +} + +// Returns the *.b32.i2p address of the I2P address. It is supposed to be a +// somewhat human-manageable 64 character long pseudo-domain name equivalent of +// the 516+ characters long default base64-address (the I2PAddr format). It is +// not possible to turn the base32-address back into a usable I2PAddr without +// performing a Lookup(). Lookup only works if you are using the I2PAddr from +// which the b32 address was generated. +func (addr I2PAddr) Base32() (str string) { + return addr.DestHash().String() +} + +func (addr I2PAddr) DestHash() (h I2PDestHash) { + hash := sha256.New() + b, _ := addr.ToBytes() + hash.Write(b) + digest := hash.Sum(nil) + copy(h[:], digest) + return +} + +// Makes any string into a *.b32.i2p human-readable I2P address. This makes no +// sense, unless "anything" is an I2P destination of some sort. +func Base32(anything string) string { + return I2PAddr(anything).Base32() +} From 8184f339a723e342a63585e2cc3ee28d78a4a980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ken-H=C3=A5vard=20Lieng?= Date: Fri, 13 Nov 2020 08:59:36 +0100 Subject: [PATCH 4/4] Use node LTS on travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5702164e..0e105223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,8 @@ matrix: install: - GO111MODULE=off go get github.com/jteeuwen/go-bindata/... - cd client - - nvm install node - - nvm use node + - nvm install --lts + - nvm use --lts - npm install -g yarn - yarn global add gulp-cli - yarn