diff --git a/assets/bindata.go b/assets/bindata.go index 67281fe0..f5ba5aa8 100644 --- a/assets/bindata.go +++ b/assets/bindata.go @@ -718,35 +718,35 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "10.8d4e3eadb5bf393297d4.js.br": _108d4e3eadb5bf393297d4JsBr, - "6.927d29943814584bff4c.js.LICENSE.txt": _6927d29943814584bff4cJsLicenseTxt, - "6.dabc66d5e65984b4d1b8.js.br": _6Dabc66d5e65984b4d1b8JsBr, - "7.44423ff074b7ee9187c6.js.br": _744423ff074b7ee9187c6JsBr, - "8.bb4e76f2bbe2e0961488.js.br": _8Bb4e76f2bbe2e0961488JsBr, - "9.ce30b62587989503c1b1.js.br": _9Ce30b62587989503c1b1JsBr, - "boot.a9e9f667d5db067ec5ee.js.br": bootA9e9f667d5db067ec5eeJsBr, - "config.default.toml": configDefaultToml, - "connect.ebc4a0d419c384c3e282.js.br": connectEbc4a0d419c384c3e282JsBr, - "favicon.ico": faviconIco, - "font/Montserrat-Bold.woff": fontMontserratBoldWoff, - "font/Montserrat-Bold.woff2": fontMontserratBoldWoff2, - "font/Montserrat-Regular.woff": fontMontserratRegularWoff, - "font/Montserrat-Regular.woff2": fontMontserratRegularWoff2, - "font/RobotoMono-Bold.woff": fontRobotomonoBoldWoff, - "font/RobotoMono-Bold.woff2": fontRobotomonoBoldWoff2, - "font/RobotoMono-Regular.woff": fontRobotomonoRegularWoff, - "font/RobotoMono-Regular.woff2": fontRobotomonoRegularWoff2, - "icon_192.png": icon_192Png, - "icon_512.png": icon_512Png, - "main.1b2663ec4e3f90d36c9b.js.br": main1b2663ec4e3f90d36c9bJsBr, - "main.7a567880bf6424b9d73b.css.br": main7a567880bf6424b9d73bCssBr, - "manifest.json.br": manifestJsonBr, - "runtime.b976cc3431568cb71c47.js.br": runtimeB976cc3431568cb71c47JsBr, - "sw.js.br": swJsBr, - "vendors~connect.3ca0619eb76955d609ed.js.br": vendorsConnect3ca0619eb76955d609edJsBr, + "10.8d4e3eadb5bf393297d4.js.br": _108d4e3eadb5bf393297d4JsBr, + "6.927d29943814584bff4c.js.LICENSE.txt": _6927d29943814584bff4cJsLicenseTxt, + "6.dabc66d5e65984b4d1b8.js.br": _6Dabc66d5e65984b4d1b8JsBr, + "7.44423ff074b7ee9187c6.js.br": _744423ff074b7ee9187c6JsBr, + "8.bb4e76f2bbe2e0961488.js.br": _8Bb4e76f2bbe2e0961488JsBr, + "9.ce30b62587989503c1b1.js.br": _9Ce30b62587989503c1b1JsBr, + "boot.a9e9f667d5db067ec5ee.js.br": bootA9e9f667d5db067ec5eeJsBr, + "config.default.toml": configDefaultToml, + "connect.ebc4a0d419c384c3e282.js.br": connectEbc4a0d419c384c3e282JsBr, + "favicon.ico": faviconIco, + "font/Montserrat-Bold.woff": fontMontserratBoldWoff, + "font/Montserrat-Bold.woff2": fontMontserratBoldWoff2, + "font/Montserrat-Regular.woff": fontMontserratRegularWoff, + "font/Montserrat-Regular.woff2": fontMontserratRegularWoff2, + "font/RobotoMono-Bold.woff": fontRobotomonoBoldWoff, + "font/RobotoMono-Bold.woff2": fontRobotomonoBoldWoff2, + "font/RobotoMono-Regular.woff": fontRobotomonoRegularWoff, + "font/RobotoMono-Regular.woff2": fontRobotomonoRegularWoff2, + "icon_192.png": icon_192Png, + "icon_512.png": icon_512Png, + "main.1b2663ec4e3f90d36c9b.js.br": main1b2663ec4e3f90d36c9bJsBr, + "main.7a567880bf6424b9d73b.css.br": main7a567880bf6424b9d73bCssBr, + "manifest.json.br": manifestJsonBr, + "runtime.b976cc3431568cb71c47.js.br": runtimeB976cc3431568cb71c47JsBr, + "sw.js.br": swJsBr, + "vendors~connect.3ca0619eb76955d609ed.js.br": vendorsConnect3ca0619eb76955d609edJsBr, "vendors~connect.8ff8cf6237ae10adbdb1.js.LICENSE.txt": vendorsConnect8ff8cf6237ae10adbdb1JsLicenseTxt, - "vendors~main.ca3aa6cc261be8bc77a1.js.br": vendorsMainCa3aa6cc261be8bc77a1JsBr, - "vendors~main.d13b9f2abe9b978a5708.js.LICENSE.txt": vendorsMainD13b9f2abe9b978a5708JsLicenseTxt, + "vendors~main.ca3aa6cc261be8bc77a1.js.br": vendorsMainCa3aa6cc261be8bc77a1JsBr, + "vendors~main.d13b9f2abe9b978a5708.js.LICENSE.txt": vendorsMainD13b9f2abe9b978a5708JsLicenseTxt, } // AssetDir returns the file names below a certain @@ -788,38 +788,39 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ - "10.8d4e3eadb5bf393297d4.js.br": &bintree{_108d4e3eadb5bf393297d4JsBr, map[string]*bintree{}}, + "10.8d4e3eadb5bf393297d4.js.br": &bintree{_108d4e3eadb5bf393297d4JsBr, map[string]*bintree{}}, "6.927d29943814584bff4c.js.LICENSE.txt": &bintree{_6927d29943814584bff4cJsLicenseTxt, map[string]*bintree{}}, - "6.dabc66d5e65984b4d1b8.js.br": &bintree{_6Dabc66d5e65984b4d1b8JsBr, map[string]*bintree{}}, - "7.44423ff074b7ee9187c6.js.br": &bintree{_744423ff074b7ee9187c6JsBr, map[string]*bintree{}}, - "8.bb4e76f2bbe2e0961488.js.br": &bintree{_8Bb4e76f2bbe2e0961488JsBr, map[string]*bintree{}}, - "9.ce30b62587989503c1b1.js.br": &bintree{_9Ce30b62587989503c1b1JsBr, map[string]*bintree{}}, - "boot.a9e9f667d5db067ec5ee.js.br": &bintree{bootA9e9f667d5db067ec5eeJsBr, map[string]*bintree{}}, - "config.default.toml": &bintree{configDefaultToml, map[string]*bintree{}}, - "connect.ebc4a0d419c384c3e282.js.br": &bintree{connectEbc4a0d419c384c3e282JsBr, map[string]*bintree{}}, - "favicon.ico": &bintree{faviconIco, map[string]*bintree{}}, + "6.dabc66d5e65984b4d1b8.js.br": &bintree{_6Dabc66d5e65984b4d1b8JsBr, map[string]*bintree{}}, + "7.44423ff074b7ee9187c6.js.br": &bintree{_744423ff074b7ee9187c6JsBr, map[string]*bintree{}}, + "8.bb4e76f2bbe2e0961488.js.br": &bintree{_8Bb4e76f2bbe2e0961488JsBr, map[string]*bintree{}}, + "9.ce30b62587989503c1b1.js.br": &bintree{_9Ce30b62587989503c1b1JsBr, map[string]*bintree{}}, + "boot.a9e9f667d5db067ec5ee.js.br": &bintree{bootA9e9f667d5db067ec5eeJsBr, map[string]*bintree{}}, + "config.default.toml": &bintree{configDefaultToml, map[string]*bintree{}}, + "connect.ebc4a0d419c384c3e282.js.br": &bintree{connectEbc4a0d419c384c3e282JsBr, map[string]*bintree{}}, + "favicon.ico": &bintree{faviconIco, map[string]*bintree{}}, "font": &bintree{nil, map[string]*bintree{ - "Montserrat-Bold.woff": &bintree{fontMontserratBoldWoff, map[string]*bintree{}}, - "Montserrat-Bold.woff2": &bintree{fontMontserratBoldWoff2, map[string]*bintree{}}, - "Montserrat-Regular.woff": &bintree{fontMontserratRegularWoff, map[string]*bintree{}}, + "Montserrat-Bold.woff": &bintree{fontMontserratBoldWoff, map[string]*bintree{}}, + "Montserrat-Bold.woff2": &bintree{fontMontserratBoldWoff2, map[string]*bintree{}}, + "Montserrat-Regular.woff": &bintree{fontMontserratRegularWoff, map[string]*bintree{}}, "Montserrat-Regular.woff2": &bintree{fontMontserratRegularWoff2, map[string]*bintree{}}, - "RobotoMono-Bold.woff": &bintree{fontRobotomonoBoldWoff, map[string]*bintree{}}, - "RobotoMono-Bold.woff2": &bintree{fontRobotomonoBoldWoff2, map[string]*bintree{}}, - "RobotoMono-Regular.woff": &bintree{fontRobotomonoRegularWoff, map[string]*bintree{}}, + "RobotoMono-Bold.woff": &bintree{fontRobotomonoBoldWoff, map[string]*bintree{}}, + "RobotoMono-Bold.woff2": &bintree{fontRobotomonoBoldWoff2, map[string]*bintree{}}, + "RobotoMono-Regular.woff": &bintree{fontRobotomonoRegularWoff, map[string]*bintree{}}, "RobotoMono-Regular.woff2": &bintree{fontRobotomonoRegularWoff2, map[string]*bintree{}}, }}, - "icon_192.png": &bintree{icon_192Png, map[string]*bintree{}}, - "icon_512.png": &bintree{icon_512Png, map[string]*bintree{}}, - "main.1b2663ec4e3f90d36c9b.js.br": &bintree{main1b2663ec4e3f90d36c9bJsBr, map[string]*bintree{}}, - "main.7a567880bf6424b9d73b.css.br": &bintree{main7a567880bf6424b9d73bCssBr, map[string]*bintree{}}, - "manifest.json.br": &bintree{manifestJsonBr, map[string]*bintree{}}, - "runtime.b976cc3431568cb71c47.js.br": &bintree{runtimeB976cc3431568cb71c47JsBr, map[string]*bintree{}}, - "sw.js.br": &bintree{swJsBr, map[string]*bintree{}}, - "vendors~connect.3ca0619eb76955d609ed.js.br": &bintree{vendorsConnect3ca0619eb76955d609edJsBr, map[string]*bintree{}}, + "icon_192.png": &bintree{icon_192Png, map[string]*bintree{}}, + "icon_512.png": &bintree{icon_512Png, map[string]*bintree{}}, + "main.1b2663ec4e3f90d36c9b.js.br": &bintree{main1b2663ec4e3f90d36c9bJsBr, map[string]*bintree{}}, + "main.7a567880bf6424b9d73b.css.br": &bintree{main7a567880bf6424b9d73bCssBr, map[string]*bintree{}}, + "manifest.json.br": &bintree{manifestJsonBr, map[string]*bintree{}}, + "runtime.b976cc3431568cb71c47.js.br": &bintree{runtimeB976cc3431568cb71c47JsBr, map[string]*bintree{}}, + "sw.js.br": &bintree{swJsBr, map[string]*bintree{}}, + "vendors~connect.3ca0619eb76955d609ed.js.br": &bintree{vendorsConnect3ca0619eb76955d609edJsBr, map[string]*bintree{}}, "vendors~connect.8ff8cf6237ae10adbdb1.js.LICENSE.txt": &bintree{vendorsConnect8ff8cf6237ae10adbdb1JsLicenseTxt, map[string]*bintree{}}, - "vendors~main.ca3aa6cc261be8bc77a1.js.br": &bintree{vendorsMainCa3aa6cc261be8bc77a1JsBr, map[string]*bintree{}}, - "vendors~main.d13b9f2abe9b978a5708.js.LICENSE.txt": &bintree{vendorsMainD13b9f2abe9b978a5708JsLicenseTxt, map[string]*bintree{}}, + "vendors~main.ca3aa6cc261be8bc77a1.js.br": &bintree{vendorsMainCa3aa6cc261be8bc77a1JsBr, map[string]*bintree{}}, + "vendors~main.d13b9f2abe9b978a5708.js.LICENSE.txt": &bintree{vendorsMainD13b9f2abe9b978a5708JsLicenseTxt, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory @@ -868,4 +869,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } - diff --git a/go.mod b/go.mod index 9af4eee9..d473daed 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/blevesearch/bleve v1.0.9 github.com/caddyserver/certmagic v0.11.2 github.com/cenkalti/backoff/v4 v4.0.2 // indirect + github.com/cryptix/goSam v0.1.0 // indirect github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d // indirect github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect @@ -52,3 +53,5 @@ require ( gopkg.in/ini.v1 v1.57.0 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect ) + +replace github.com/eyedeekay/goSam v0.32.29 => ../goSam diff --git a/go.sum b/go.sum index 42c6afac..7586460c 100644 --- a/go.sum +++ b/go.sum @@ -114,6 +114,10 @@ github.com/cpu/goacmedns v0.0.2/go.mod h1:4MipLkI+qScwqtVxcNO6okBhbgRrr7/tKXUSgS github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cryptix/go v1.3.1 h1:I9opbROgEpldI0PwkMku0UY2DLFYgelZd9u0uaxmMgY= +github.com/cryptix/go v1.3.1/go.mod h1:mFQotm9rTzptzvNjJM+1vSIDa/rVOVqMu0889GIXg70= +github.com/cryptix/goSam v0.1.0 h1:lKXtrTv3Kd6+eIuNtcq3zPShJEVRqw+lQwmh49HmC7k= +github.com/cryptix/goSam v0.1.0/go.mod h1:7ewkjhXT8V5RG07pvWUOHHtMahvGbeKlEv8ukUyRiTA= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= @@ -152,6 +156,8 @@ github.com/eyedeekay/sam3 v0.32.3 h1:PW1vQoo2H7c3Q4l2DngJqpSdsdJprMCk9NOkUHtcdmM github.com/eyedeekay/sam3 v0.32.3/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350 h1:8R4zcaWsgANiZ4MKKBPUf9Isct2M1IFVUVZdAMqPCmU= github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= +github.com/eyedeekay/sam3 v0.32.32 h1:9Ea1Ere5O8Clx8zYxKnvhrWy7R96Q4FvxlPskYf8VW0= +github.com/eyedeekay/sam3 v0.32.32/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= @@ -168,6 +174,7 @@ github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwl github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA= github.com/getlantern/netx v0.0.0-20190110220209-9912de6f94fd/go.mod h1:wKdY0ikOgzrWSeB9UyBVKPRhjXQ+vTb+BPeJuypUuNE= github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= +github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a h1:FQqoVvjbiUioBBFUL5up+h+GdCa/AnJsL/1bIs/veSI= @@ -180,10 +187,12 @@ github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.7.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -326,6 +335,8 @@ github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3N github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.29 h1:xHBEhR+t5RzcFJjBLJlax2daXOrTYtr9z4WdKEfWFzg= github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miolini/datacounter v0.0.0-20171104152933-fd4e42a1d5e0 h1:clkDYGefEWUCwyCrwYn900sOaVGDpinPJgD0W6ebEjs= +github.com/miolini/datacounter v0.0.0-20171104152933-fd4e42a1d5e0/go.mod h1:P6fDJzlxN+cWYR09KbE9/ta+Y6JofX9tAUhJpWkWPaM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= diff --git a/server/irc.go b/server/irc.go index 63cb2ec0..881c929d 100644 --- a/server/irc.go +++ b/server/irc.go @@ -8,6 +8,7 @@ import ( "net" "strings" + // "github.com/cryptix/goSam" "github.com/eyedeekay/goSam" "github.com/khlieng/dispatch/pkg/irc" "github.com/khlieng/dispatch/storage" @@ -80,8 +81,24 @@ func connectIRC(network *storage.Network, state *State, srcIP []byte) *irc.Clien if cfg.Proxy.Enabled && strings.ToLower(cfg.Proxy.Protocol) == "i2p" { addr := net.JoinHostPort(cfg.Proxy.Host, cfg.Proxy.Port) - - client, err := goSam.NewClient(addr) + client, err := goSam.NewClientFromOptions( + goSam.SetAddr(addr), + goSam.SetUnpublished(false), + goSam.SetInQuantity(3), + goSam.SetOutQuantity(3), + goSam.SetInBackups(2), + goSam.SetOutBackups(2), + goSam.SetInLength(2), + goSam.SetOutLength(2), + goSam.SetInVariance(-1), + goSam.SetOutVariance(-1), + goSam.SetCloseIdle(false), + goSam.SetDebug(false), + goSam.SetLeaseSetEncType("4"), + goSam.SetMinSAMVersion(0), + goSam.SetMaxSAMVersion(1), + ) + //client, err := goSam.NewClient(addr) if err != nil { log.Println(err) } else { diff --git a/vendor/github.com/eyedeekay/goSam/accept.go b/vendor/github.com/eyedeekay/goSam/accept.go index 4c4dba3d..a93a7ad5 100644 --- a/vendor/github.com/eyedeekay/goSam/accept.go +++ b/vendor/github.com/eyedeekay/goSam/accept.go @@ -32,7 +32,7 @@ func (c *Client) ListenI2P(dest string) (net.Listener, error) { } fmt.Println("Listening on destination:", c.Base32()+".b32.i2p") - c, err = c.NewClient() + c, err = c.NewClient(c.id) if err != nil { return nil, err } diff --git a/vendor/github.com/eyedeekay/goSam/client.go b/vendor/github.com/eyedeekay/goSam/client.go index 1798bbdb..a535ac7c 100644 --- a/vendor/github.com/eyedeekay/goSam/client.go +++ b/vendor/github.com/eyedeekay/goSam/client.go @@ -11,7 +11,8 @@ import ( "math/rand" "net" "strings" - "sync" + // "sync" + "time" ) // A Client represents a single Connection to the SAM bridge @@ -52,10 +53,9 @@ type Client struct { debug bool //NEVER, EVER modify lastaddr or id yourself. They are used internally only. - lastaddr string - id int32 - ml sync.Mutex - oml sync.Mutex + id int32 + sammin int + sammax int } var SAMsigTypes = []string{ @@ -66,6 +66,12 @@ var SAMsigTypes = []string{ "SIGNATURE_TYPE=EdDSA_SHA512_Ed25519", } +var ValidSAMCommands = []string{ + "HELLO", + "SESSION", + "STREAM", +} + var ( i2pB64enc *base64.Encoding = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~") i2pB32enc *base32.Encoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567") @@ -83,7 +89,10 @@ func NewClient(addr string) (*Client, error) { // NewID generates a random number to use as an tunnel name func (c *Client) NewID() int32 { - return rand.Int31n(math.MaxInt32) + if c.id == 0 { + c.id = rand.Int31n(math.MaxInt32) + } + return c.id } // Destination returns the full destination of the local tunnel @@ -127,11 +136,11 @@ func NewClientFromOptions(opts ...func(*Client) error) (*Client, error) { c.port = "7656" c.inLength = 3 c.inVariance = 0 - c.inQuantity = 1 + c.inQuantity = 3 c.inBackups = 1 c.outLength = 3 c.outVariance = 0 - c.outQuantity = 1 + c.outQuantity = 3 c.outBackups = 1 c.dontPublishLease = true c.encryptLease = false @@ -140,20 +149,22 @@ func NewClientFromOptions(opts ...func(*Client) error) (*Client, error) { c.reduceIdleQuantity = 1 c.closeIdle = true c.closeIdleTime = 600000 - c.debug = true + c.debug = false c.sigType = SAMsigTypes[4] c.id = 0 - c.lastaddr = "invalid" c.destination = "" c.leaseSetEncType = "4,0" c.fromport = "" c.toport = "" + c.sammin = 0 + c.sammax = 1 for _, o := range opts { if err := o(&c); err != nil { return nil, err } } - conn, err := net.Dial("tcp", c.samaddr()) + c.id = c.NewID() + conn, err := net.DialTimeout("tcp", c.samaddr(), 15*time.Minute) if err != nil { return nil, err } @@ -180,7 +191,7 @@ func (c *Client) samaddr() string { // send the initial handshake command and check that the reply is ok func (c *Client) hello() error { - r, err := c.sendCmd("HELLO VERSION MIN=3.0 MAX=3.2\n") + r, err := c.sendCmd("HELLO VERSION MIN=3.%d MAX=3.%d\n", c.sammin, c.sammax) if err != nil { return err } @@ -216,8 +227,10 @@ func (c *Client) Close() error { return c.SamConn.Close() } -// NewClient generates an exact copy of the client with the same options -func (c *Client) NewClient() (*Client, error) { +// NewClient generates an exact copy of the client with the same options, but +// re-does all the handshaky business so that Dial can pick up right where it +// left off, should the need arise. +func (c *Client) NewClient(id int32) (*Client, error) { return NewClientFromOptions( SetHost(c.host), SetPort(c.port), @@ -238,7 +251,6 @@ func (c *Client) NewClient() (*Client, error) { SetCloseIdle(c.closeIdle), SetCloseIdleTime(c.closeIdleTime), SetCompression(c.compression), - setlastaddr(c.lastaddr), - setid(c.id), + setid(id), ) } diff --git a/vendor/github.com/eyedeekay/goSam/dial.go b/vendor/github.com/eyedeekay/goSam/dial.go index c820ce1c..058f71a3 100644 --- a/vendor/github.com/eyedeekay/goSam/dial.go +++ b/vendor/github.com/eyedeekay/goSam/dial.go @@ -2,35 +2,28 @@ package goSam import ( "context" - "fmt" + "log" "net" "strings" ) // DialContext implements the net.DialContext function and can be used for http.Transport func (c *Client) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { - c.oml.Lock() - defer c.oml.Unlock() errCh := make(chan error, 1) connCh := make(chan net.Conn, 1) go func() { - if conn, err := c.Dial(network, addr); err != nil { + if conn, err := c.DialContextFree(network, addr); err != nil { errCh <- err } else if ctx.Err() != nil { - var err error - c, err = c.NewClient() - if err != nil { - conn.Close() - } + log.Println(ctx) + errCh <- ctx.Err() } else { connCh <- conn } }() select { case err := <-errCh: - // var err error - c, err = c.NewClient() - return c.SamConn, err + return nil, err case conn := <-connCh: return conn, nil case <-ctx.Done(): @@ -38,42 +31,49 @@ func (c *Client) DialContext(ctx context.Context, network, addr string) (net.Con } } -func (c *Client) dialCheck(addr string) (int32, bool) { - if c.lastaddr == "invalid" { - fmt.Println("Preparing to dial new address.") - return c.NewID(), true - } else if c.lastaddr != addr { - fmt.Println("Preparing to dial next new address.") - } - return c.id, false +func (c *Client) Dial(network, addr string) (net.Conn, error) { + return c.DialContext(context.TODO(), network, addr) } // Dial implements the net.Dial function and can be used for http.Transport -func (c *Client) Dial(network, addr string) (net.Conn, error) { - c.ml.Lock() - defer c.ml.Unlock() +func (c *Client) DialContextFree(network, addr string) (net.Conn, error) { portIdx := strings.Index(addr, ":") if portIdx >= 0 { addr = addr[:portIdx] } addr, err := c.Lookup(addr) if err != nil { + log.Printf("LOOKUP DIALER ERROR %s %s", addr, err) return nil, err } - var test bool - if c.id, test = c.dialCheck(addr); test == true { - c.destination, err = c.CreateStreamSession(c.id, c.destination) + c.destination, err = c.CreateStreamSession(c.id, c.destination) + if err != nil { + c.Close() + d, err := c.NewClient(c.id + 1) /**/ if err != nil { return nil, err } - c.lastaddr = addr + d.destination, err = d.CreateStreamSession(d.id, c.destination) + if err != nil { + return nil, err + } + d, err = d.NewClient(d.id) + if err != nil { + return nil, err + } + // d.lastaddr = addr + err = d.StreamConnect(d.id, addr) + if err != nil { + return nil, err + } + c = d + return d.SamConn, nil } - c, err = c.NewClient() + c, err = c.NewClient(c.id) if err != nil { return nil, err } - err = c.StreamConnect(c.id, addr) if err != nil { return nil, err diff --git a/vendor/github.com/eyedeekay/goSam/go.mod b/vendor/github.com/eyedeekay/goSam/go.mod index cd436349..baeaa471 100644 --- a/vendor/github.com/eyedeekay/goSam/go.mod +++ b/vendor/github.com/eyedeekay/goSam/go.mod @@ -1,10 +1,11 @@ module github.com/eyedeekay/goSam require ( - github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350 + github.com/eyedeekay/sam3 v0.32.32 github.com/getlantern/go-socks5 v0.0.0-20171114193258-79d4dd3e2db5 github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect github.com/getlantern/netx v0.0.0-20190110220209-9912de6f94fd // indirect + github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 // indirect ) //replace github.com/eyedeekay/gosam v0.1.1-0.20190814195658-27e786578944 => github.com/eyedeekay/goSam ./ diff --git a/vendor/github.com/eyedeekay/goSam/go.sum b/vendor/github.com/eyedeekay/goSam/go.sum index effd6167..025b1603 100644 --- a/vendor/github.com/eyedeekay/goSam/go.sum +++ b/vendor/github.com/eyedeekay/goSam/go.sum @@ -6,6 +6,8 @@ github.com/eyedeekay/sam3 v0.32.2/go.mod h1:Y3igFVzN4ybqkkpfUWULGhw7WRp8lieq0ORX github.com/eyedeekay/sam3 v0.32.31 h1:0fdDAupEQZSETHcyVQAsnFgpYArGJzU+lC2qN6f0GDk= github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350 h1:8R4zcaWsgANiZ4MKKBPUf9Isct2M1IFVUVZdAMqPCmU= github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= +github.com/eyedeekay/sam3 v0.32.32 h1:9Ea1Ere5O8Clx8zYxKnvhrWy7R96Q4FvxlPskYf8VW0= +github.com/eyedeekay/sam3 v0.32.32/go.mod h1:qRA9KIIVxbrHlkj+ZB+OoxFGFgdKeGp1vSgPw26eOVU= github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4= github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY= github.com/getlantern/errors v1.0.1 h1:XukU2whlh7OdpxnkXhNH9VTLVz0EVPGKDV5K0oWhvzw= @@ -22,6 +24,8 @@ github.com/getlantern/netx v0.0.0-20190110220209-9912de6f94fd h1:mn98vs69Kqw56iK github.com/getlantern/netx v0.0.0-20190110220209-9912de6f94fd/go.mod h1:wKdY0ikOgzrWSeB9UyBVKPRhjXQ+vTb+BPeJuypUuNE= github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA= github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= +github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 h1:QthAQCekS1YOeYWSvoHI6ZatlG4B+GBDLxV/2ZkBsTA= +github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= diff --git a/vendor/github.com/eyedeekay/goSam/naming.go b/vendor/github.com/eyedeekay/goSam/naming.go index e1d68e70..81e2a3d3 100644 --- a/vendor/github.com/eyedeekay/goSam/naming.go +++ b/vendor/github.com/eyedeekay/goSam/naming.go @@ -37,37 +37,39 @@ func (c *Client) Lookup(name string) (string, error) { } func (c *Client) forward(client, conn net.Conn) { + defer client.Close() + defer conn.Close() go func() { - defer client.Close() - defer conn.Close() + // defer client.Close() + // defer conn.Close() io.Copy(client, conn) }() go func() { - defer client.Close() - defer conn.Close() + // defer client.Close() + // defer conn.Close() io.Copy(conn, client) }() } func (c *Client) Resolve(ctx context.Context, name string) (context.Context, net.IP, error) { - if c.lastaddr == "invalid" || c.lastaddr != name { - client, err := c.DialContext(ctx, "", name) - if err != nil { - return ctx, nil, err - } - ln, err := net.Listen("tcp", "127.0.0.1:") - if err != nil { - return ctx, nil, err - } - go func() { - for { - conn, err := ln.Accept() - if err != nil { - fmt.Println(err.Error()) - } - go c.forward(client, conn) - } - }() + // if c.lastaddr == "invalid" || c.lastaddr != name { + client, err := c.DialContext(ctx, "", name) + if err != nil { + return ctx, nil, err } + ln, err := net.Listen("tcp", "127.0.0.1:") + if err != nil { + return ctx, nil, err + } + go func() { + for { + conn, err := ln.Accept() + if err != nil { + fmt.Println(err.Error()) + } + go c.forward(client, conn) + } + }() + // } return ctx, nil, nil } diff --git a/vendor/github.com/eyedeekay/goSam/options.go b/vendor/github.com/eyedeekay/goSam/options.go index 68f64448..593173ca 100644 --- a/vendor/github.com/eyedeekay/goSam/options.go +++ b/vendor/github.com/eyedeekay/goSam/options.go @@ -62,6 +62,32 @@ func SetHost(s string) func(*Client) error { } } +func SetSAMMinVersion(i int) func(*Client) error { + return func(c *Client) error { + if i < 0 { + return fmt.Errorf("SAM version must be greater than or equal to 0") + } + if i > 3 { + return fmt.Errorf("SAM version must be less than or equal to 3") + } + c.sammin = i + return nil + } +} + +func SetSAMMaxVersion(i int) func(*Client) error { + return func(c *Client) error { + if i < 0 { + return fmt.Errorf("SAM version must be greater than or equal to 0") + } + if i > 3 { + return fmt.Errorf("SAM version must be less than or equal to 3") + } + c.sammin = i + return nil + } +} + //SetLocalDestination sets the local destination of the tunnel from a private //key func SetLocalDestination(s string) func(*Client) error { @@ -71,13 +97,6 @@ func SetLocalDestination(s string) func(*Client) error { } } -func setlastaddr(s string) func(*Client) error { - return func(c *Client) error { - c.lastaddr = s - return nil - } -} - func setid(s int32) func(*Client) error { return func(c *Client) error { c.id = s diff --git a/vendor/github.com/eyedeekay/goSam/replyParser.go b/vendor/github.com/eyedeekay/goSam/replyParser.go index bc5b1332..d7e6d150 100644 --- a/vendor/github.com/eyedeekay/goSam/replyParser.go +++ b/vendor/github.com/eyedeekay/goSam/replyParser.go @@ -44,6 +44,25 @@ func parseReply(line string) (*Reply, error) { if len(parts) < 3 { return nil, fmt.Errorf("Malformed Reply.\n%s\n", line) } + preParseReply := func() []string { + val := "" + quote := false + for _, v := range parts { + if strings.Contains(v, "=\"") { + quote = true + } + if strings.Contains(v, "\"\n") || strings.Contains(v, "\" ") { + quote = false + } + if quote { + val += v + "_" + } else { + val += v + " " + } + } + return strings.Split(strings.TrimSuffix(strings.TrimSpace(val), "_"), " ") + } + parts = preParseReply() r := &Reply{ Topic: parts[0], @@ -63,9 +82,8 @@ func parseReply(line string) (*Reply, error) { } else { kvPair := strings.SplitN(v, "=", 2) if kvPair != nil { - if len(kvPair) == 1 { - } else if len(kvPair) != 2 { - return nil, fmt.Errorf("Malformed key-value-pair.\n%s\n", kvPair) + if len(kvPair) != 2 { + return nil, fmt.Errorf("Malformed key-value-pair len != 2.\n%s\n", kvPair) } } r.Pairs[kvPair[0]] = kvPair[len(kvPair)-1] diff --git a/vendor/github.com/eyedeekay/goSam/stream.go b/vendor/github.com/eyedeekay/goSam/stream.go index 517b2fae..79ddd8e8 100644 --- a/vendor/github.com/eyedeekay/goSam/stream.go +++ b/vendor/github.com/eyedeekay/goSam/stream.go @@ -6,6 +6,9 @@ import ( // StreamConnect asks SAM for a TCP-Like connection to dest, has to be called on a new Client func (c *Client) StreamConnect(id int32, dest string) error { + if dest == "" { + return nil + } r, err := c.sendCmd("STREAM CONNECT ID=%d DESTINATION=%s %s %s\n", id, dest, c.from(), c.to()) if err != nil { return err diff --git a/vendor/modules.txt b/vendor/modules.txt index 3487ae6a..cc1dff59 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -68,6 +68,8 @@ github.com/couchbase/vellum github.com/couchbase/vellum/levenshtein github.com/couchbase/vellum/regexp github.com/couchbase/vellum/utf8 +# github.com/cryptix/goSam v0.1.0 +## explicit # github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d ## explicit # github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 @@ -81,10 +83,10 @@ 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.29 +# github.com/eyedeekay/goSam v0.32.29 => ../goSam ## explicit github.com/eyedeekay/goSam -# github.com/eyedeekay/sam3 v0.32.32-0.20201122050855-f464873c9350 +# github.com/eyedeekay/sam3 v0.32.32 github.com/eyedeekay/sam3/i2pkeys # github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 ## explicit