Ignore onion servers if Tor is not being used

This commit is contained in:
Frank Denis 2019-04-14 14:19:12 +02:00
parent 4940b34c76
commit 5c9edfccfe
1 changed files with 3 additions and 0 deletions

View File

@ -224,6 +224,9 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
} }
var err error var err error
host := url.Host host := url.Host
if xTransport.proxyDialer == nil && strings.HasSuffix(host, ".onion") {
return nil, 0, errors.New("Onion service is not reachable without Tor")
}
resolveByProxy := false resolveByProxy := false
if xTransport.proxyDialer != nil || xTransport.httpProxyFunction != nil { if xTransport.proxyDialer != nil || xTransport.httpProxyFunction != nil {
resolveByProxy = true resolveByProxy = true