fix: proxy

This commit is contained in:
putyy
2025-12-31 10:24:14 +08:00
parent b562f76c69
commit bb6a71f6b6
2 changed files with 5 additions and 1 deletions

View File

@@ -14,7 +14,7 @@
!define INFO_PRODUCTNAME "res-downloader"
!endif
!ifndef INFO_PRODUCTVERSION
!define INFO_PRODUCTVERSION "3.1.1"
!define INFO_PRODUCTVERSION "3.1.3"
!endif
!ifndef INFO_COPYRIGHT
!define INFO_COPYRIGHT "Copyright © 2023"

View File

@@ -120,10 +120,14 @@ func (p *Proxy) setTransport() {
IdleConnTimeout: 30 * time.Second,
}
p.Proxy.ConnectDial = nil
p.Proxy.ConnectDialWithReq = nil
if globalConfig.UpstreamProxy != "" && globalConfig.OpenProxy && !strings.Contains(globalConfig.UpstreamProxy, globalConfig.Port) {
proxyURL, err := url.Parse(globalConfig.UpstreamProxy)
if err == nil {
transport.Proxy = http.ProxyURL(proxyURL)
p.Proxy.ConnectDial = p.Proxy.NewConnectDialToProxy(globalConfig.UpstreamProxy)
}
}
p.Proxy.Tr = transport