parent
ad05fd6f21
commit
0569c75596
|
@ -260,6 +260,7 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
||||||
proxy.xTransport.tlsDisableSessionTickets = config.TLSDisableSessionTickets
|
proxy.xTransport.tlsDisableSessionTickets = config.TLSDisableSessionTickets
|
||||||
proxy.xTransport.tlsCipherSuite = config.TLSCipherSuite
|
proxy.xTransport.tlsCipherSuite = config.TLSCipherSuite
|
||||||
proxy.xTransport.fallbackResolver = config.FallbackResolver
|
proxy.xTransport.fallbackResolver = config.FallbackResolver
|
||||||
|
proxy.xTransport.mainProto = proxy.mainProto
|
||||||
if len(config.FallbackResolver) > 0 {
|
if len(config.FallbackResolver) > 0 {
|
||||||
proxy.xTransport.ignoreSystemDNS = config.IgnoreSystemDNS
|
proxy.xTransport.ignoreSystemDNS = config.IgnoreSystemDNS
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ type XTransport struct {
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
cachedIPs CachedIPs
|
cachedIPs CachedIPs
|
||||||
fallbackResolver string
|
fallbackResolver string
|
||||||
|
mainProto string
|
||||||
ignoreSystemDNS bool
|
ignoreSystemDNS bool
|
||||||
useIPv4 bool
|
useIPv4 bool
|
||||||
useIPv6 bool
|
useIPv6 bool
|
||||||
|
@ -56,6 +57,7 @@ func NewXTransport() *XTransport {
|
||||||
keepAlive: DefaultKeepAlive,
|
keepAlive: DefaultKeepAlive,
|
||||||
timeout: DefaultTimeout,
|
timeout: DefaultTimeout,
|
||||||
fallbackResolver: DefaultFallbackResolver,
|
fallbackResolver: DefaultFallbackResolver,
|
||||||
|
mainProto: "",
|
||||||
ignoreSystemDNS: false,
|
ignoreSystemDNS: false,
|
||||||
useIPv4: true,
|
useIPv4: true,
|
||||||
useIPv6: false,
|
useIPv6: false,
|
||||||
|
@ -249,8 +251,8 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string,
|
||||||
} else {
|
} else {
|
||||||
dlog.Noticef("System DNS configuration not usable yet, exceptionally resolving [%s] using fallback resolver [%s]", host, xTransport.fallbackResolver)
|
dlog.Noticef("System DNS configuration not usable yet, exceptionally resolving [%s] using fallback resolver [%s]", host, xTransport.fallbackResolver)
|
||||||
}
|
}
|
||||||
dnsClient := new(dns.Client)
|
dnsClient := dns.Client{Net: xTransport.mainProto}
|
||||||
foundIP, err = xTransport.resolveUsingResolver(dnsClient, host, xTransport.fallbackResolver)
|
foundIP, err = xTransport.resolveUsingResolver(&dnsClient, host, xTransport.fallbackResolver)
|
||||||
}
|
}
|
||||||
if foundIP == nil {
|
if foundIP == nil {
|
||||||
return nil, 0, fmt.Errorf("No IP found for [%s]", host)
|
return nil, 0, fmt.Errorf("No IP found for [%s]", host)
|
||||||
|
|
Loading…
Reference in New Issue