From a68b2c2ddc9b41d8f21b67ab66e8815224da0f11 Mon Sep 17 00:00:00 2001 From: Kay Faraday Date: Wed, 28 Jul 2021 04:19:11 +0000 Subject: [PATCH] use clearnet by default instead of tor --- main.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index c23c4d9..ac26fa8 100644 --- a/main.go +++ b/main.go @@ -36,13 +36,14 @@ func (h *httpProxyHandler) dialOut(addr string) (net.Conn, error) { if err != nil { return nil, err } - if strings.HasSuffix(host, ".loki") { - return net.Dial("tcp", addr) + if strings.HasSuffix(host, ".onion") { + return h.onion.Dial("tcp", addr) } if strings.HasSuffix(host, ".i2p") { return h.i2p.Dial("tcp", addr) } - return h.onion.Dial("tcp", addr) + // fallthrough for clearnet and .loki + return net.Dial("tcp", addr) } func (h *httpProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -118,13 +119,14 @@ func main() { if err != nil { return nil, err } - if strings.HasSuffix(host, ".loki") { - return net.Dial("tcp", addr) + if strings.HasSuffix(host, ".onion") { + return onionsock.Dial("tcp", addr) } if strings.HasSuffix(host, ".i2p") { return i2psock.Dial("tcp", addr) } - return onionsock.Dial("tcp", addr) + // fallthrough for clearnet and loki + return net.Dial("tcp", addr) }, })