1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-28 00:20:13 +01:00

Propagate mainProto to xTransport

Fixes #880
This commit is contained in:
Frank Denis 2019-07-10 13:13:28 +02:00
parent ad05fd6f21
commit 0569c75596
2 changed files with 5 additions and 2 deletions

View File

@ -260,6 +260,7 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
proxy.xTransport.tlsDisableSessionTickets = config.TLSDisableSessionTickets
proxy.xTransport.tlsCipherSuite = config.TLSCipherSuite
proxy.xTransport.fallbackResolver = config.FallbackResolver
proxy.xTransport.mainProto = proxy.mainProto
if len(config.FallbackResolver) > 0 {
proxy.xTransport.ignoreSystemDNS = config.IgnoreSystemDNS
}

View File

@ -38,6 +38,7 @@ type XTransport struct {
timeout time.Duration
cachedIPs CachedIPs
fallbackResolver string
mainProto string
ignoreSystemDNS bool
useIPv4 bool
useIPv6 bool
@ -56,6 +57,7 @@ func NewXTransport() *XTransport {
keepAlive: DefaultKeepAlive,
timeout: DefaultTimeout,
fallbackResolver: DefaultFallbackResolver,
mainProto: "",
ignoreSystemDNS: false,
useIPv4: true,
useIPv6: false,
@ -249,8 +251,8 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
} else {
dlog.Noticef("System DNS configuration not usable yet, exceptionally resolving [%s] using fallback resolver [%s]", host, xTransport.fallbackResolver)
}
dnsClient := new(dns.Client)
foundIP, err = xTransport.resolveUsingResolver(dnsClient, host, xTransport.fallbackResolver)
dnsClient := dns.Client{Net: xTransport.mainProto}
foundIP, err = xTransport.resolveUsingResolver(&dnsClient, host, xTransport.fallbackResolver)
}
if foundIP == nil {
return nil, 0, fmt.Errorf("No IP found for [%s]", host)