try it with goSam

This commit is contained in:
idk 2020-07-29 22:28:34 -04:00
parent ea4f321fe7
commit a02ad3a299

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,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 := irc.NewClient(ircCfg)
i.Config.HandleNickInUse = createNickInUseHandler(i, state) i.Config.HandleNickInUse = createNickInUseHandler(i, state)