From a02ad3a299bd483561a3b3dae4824892b46ac8bc Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 29 Jul 2020 22:28:34 -0400 Subject: [PATCH] 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)