From a02ad3a299bd483561a3b3dae4824892b46ac8bc Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 29 Jul 2020 22:28:34 -0400 Subject: [PATCH 1/3] try it with goSam --- server/irc.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/irc.go b/server/irc.go index 0f7d4b2e..da5e637d 100644 --- a/server/irc.go +++ b/server/irc.go @@ -8,6 +8,7 @@ import ( "net" "strings" + "github.com/eyedeekay/goSam" "github.com/khlieng/dispatch/pkg/irc" "github.com/khlieng/dispatch/storage" "golang.org/x/net/proxy" @@ -77,6 +78,26 @@ 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) + + //var auth *proxy.Auth + //if cfg.Proxy.Username != "" { + //auth = &proxy.Auth{ + //User: cfg.Proxy.Username, + //Password: cfg.Proxy.Password, + //} + //} + + //dialer, err := proxy.SOCKS5("tcp", addr, auth, irc.DefaultDialer) + client, err := goSam.NewClient(addr) + if err != nil { + log.Println(err) + } else { + ircCfg.Dialer = client //.Dial + } + } + i := irc.NewClient(ircCfg) i.Config.HandleNickInUse = createNickInUseHandler(i, state) From f997149dd64b00d60756796d94de53673e31328d Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 29 Jul 2020 23:04:13 -0400 Subject: [PATCH 2/3] how awesome is that! --- go.mod | 2 ++ go.sum | 5 +++++ server/irc.go | 13 ++----------- vendor/modules.txt | 5 +++++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 514d7a03..98ddbd15 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,8 @@ 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/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 github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect diff --git a/go.sum b/go.sum index abb9a6cf..6add93a1 100644 --- a/go.sum +++ b/go.sum @@ -138,6 +138,11 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 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/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/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= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= diff --git a/server/irc.go b/server/irc.go index da5e637d..75d5eb6b 100644 --- a/server/irc.go +++ b/server/irc.go @@ -80,21 +80,12 @@ 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) - - //var auth *proxy.Auth - //if cfg.Proxy.Username != "" { - //auth = &proxy.Auth{ - //User: cfg.Proxy.Username, - //Password: cfg.Proxy.Password, - //} - //} - - //dialer, err := proxy.SOCKS5("tcp", addr, auth, irc.DefaultDialer) + log.Println("USING I2P!") client, err := goSam.NewClient(addr) if err != nil { log.Println(err) } else { - ircCfg.Dialer = client //.Dial + ircCfg.Dialer = client } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 3ff3fd5f..c76e9208 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -81,6 +81,11 @@ 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 +## explicit +github.com/eyedeekay/goSam +# github.com/eyedeekay/sam3 v0.32.3 +## explicit # github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 ## explicit # github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 From 8f18eaa4cf90ac2d5e7765e6f2f4f2375a8552af Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 29 Jul 2020 23:22:17 -0400 Subject: [PATCH 3/3] Remove debugging message --- server/irc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/irc.go b/server/irc.go index 75d5eb6b..63cb2ec0 100644 --- a/server/irc.go +++ b/server/irc.go @@ -80,7 +80,7 @@ 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) - log.Println("USING I2P!") + client, err := goSam.NewClient(addr) if err != nil { log.Println(err)