diff --git a/backend/init/lang/lang.go b/backend/init/lang/lang.go index e5a041376..3f931480c 100644 --- a/backend/init/lang/lang.go +++ b/backend/init/lang/lang.go @@ -108,7 +108,7 @@ func loadRestorePath(upgradeDir string) (string, error) { func downloadLangFromRemote(fileOp files.FileOp) { path := fmt.Sprintf("%s/language/lang.tar.gz", global.CONF.System.RepoUrl) - if err := fileOp.DownloadFileWithProxy(path, "/usr/local/bin/lang.tar.gz"); err != nil { + if err := fileOp.DownloadFile(path, "/usr/local/bin/lang.tar.gz"); err != nil { global.LOG.Errorf("download lang.tar.gz failed, err: %v", err) return } @@ -127,7 +127,7 @@ func downloadLangFromRemote(fileOp files.FileOp) { func downloadGeoFromRemote(fileOp files.FileOp, targetPath string) { _ = os.MkdirAll(path.Dir(targetPath), os.ModePerm) pathItem := fmt.Sprintf("%s/geo/GeoIP.mmdb", global.CONF.System.RepoUrl) - if err := fileOp.DownloadFileWithProxy(pathItem, targetPath); err != nil { + if err := fileOp.DownloadFile(pathItem, targetPath); err != nil { global.LOG.Errorf("download geo ip failed, err: %v", err) return } diff --git a/backend/utils/http/get.go b/backend/utils/http/get.go index 4dd90da55..66a9aed1b 100644 --- a/backend/utils/http/get.go +++ b/backend/utils/http/get.go @@ -2,21 +2,30 @@ package http import ( "context" + "crypto/tls" "errors" + "net" "net/http" "strings" "time" "github.com/1Panel-dev/1Panel/backend/buserr" - "github.com/1Panel-dev/1Panel/backend/utils/xpack" ) func GetHttpRes(url string) (*http.Response, error) { client := &http.Client{ Timeout: time.Second * 300, + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + DialContext: (&net.Dialer{ + Timeout: 60 * time.Second, + KeepAlive: 60 * time.Second, + }).DialContext, + TLSHandshakeTimeout: 5 * time.Second, + ResponseHeaderTimeout: 10 * time.Second, + IdleConnTimeout: 15 * time.Second, + }, } - transport := xpack.LoadRequestTransport() - client.Transport = transport req, err := http.NewRequestWithContext(context.Background(), "GET", url, nil) if err != nil {