Merge pull request #64 from eyedeekay/i2p-support

I2p support
This commit is contained in:
Ken-Håvard Lieng 2020-07-30 08:44:50 +02:00 committed by GitHub
commit 27142cc5c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

2
go.mod
View File

@ -11,6 +11,8 @@ require (
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect
github.com/dsnet/compress v0.0.1 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/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect

5
go.sum
View File

@ -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/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/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/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 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= 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= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=

View File

@ -8,6 +8,7 @@ import (
"net" "net"
"strings" "strings"
"github.com/eyedeekay/goSam"
"github.com/khlieng/dispatch/pkg/irc" "github.com/khlieng/dispatch/pkg/irc"
"github.com/khlieng/dispatch/storage" "github.com/khlieng/dispatch/storage"
"golang.org/x/net/proxy" "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 := irc.NewClient(ircCfg)
i.Config.HandleNickInUse = createNickInUseHandler(i, state) i.Config.HandleNickInUse = createNickInUseHandler(i, state)

5
vendor/modules.txt vendored
View File

@ -81,6 +81,11 @@ github.com/davecgh/go-spew/spew
github.com/dsnet/compress/brotli github.com/dsnet/compress/brotli
github.com/dsnet/compress/internal github.com/dsnet/compress/internal
github.com/dsnet/compress/internal/errors 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 # github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51
## explicit ## explicit
# github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 # github.com/facebookgo/stack v0.0.0-20160209184415-751773369052