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 0f7d4b2e..63cb2ec0 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,17 @@ 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) + if err != nil { + log.Println(err) + } else { + ircCfg.Dialer = client + } + } + i := irc.NewClient(ircCfg) i.Config.HandleNickInUse = createNickInUseHandler(i, state) 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