use clearnet by default instead of tor
This commit is contained in:
parent
de384e3af0
commit
a68b2c2ddc
14
main.go
14
main.go
|
@ -36,13 +36,14 @@ func (h *httpProxyHandler) dialOut(addr string) (net.Conn, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(host, ".loki") {
|
if strings.HasSuffix(host, ".onion") {
|
||||||
return net.Dial("tcp", addr)
|
return h.onion.Dial("tcp", addr)
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(host, ".i2p") {
|
if strings.HasSuffix(host, ".i2p") {
|
||||||
return h.i2p.Dial("tcp", addr)
|
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) {
|
func (h *httpProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -118,13 +119,14 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(host, ".loki") {
|
if strings.HasSuffix(host, ".onion") {
|
||||||
return net.Dial("tcp", addr)
|
return onionsock.Dial("tcp", addr)
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(host, ".i2p") {
|
if strings.HasSuffix(host, ".i2p") {
|
||||||
return i2psock.Dial("tcp", addr)
|
return i2psock.Dial("tcp", addr)
|
||||||
}
|
}
|
||||||
return onionsock.Dial("tcp", addr)
|
// fallthrough for clearnet and loki
|
||||||
|
return net.Dial("tcp", addr)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue