This commit is contained in:
2025-03-21 20:44:35 +08:00
parent bac4fd8b11
commit 8cede57a70
21 changed files with 430 additions and 120 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"strings"
"time"
"golang.org/x/net/proxy"
)
@ -20,7 +21,9 @@ import (
*/
func CreateHtppProxy(proxyType, proxyAddr string, client *http.Client) error {
// Set up proxy based on type (HTTP, HTTPS, SOCKS5)
transport := &http.Transport{}
transport := &http.Transport{
TLSHandshakeTimeout: 10 * time.Second,
}
if proxyAddr != "" {
if !strings.HasPrefix(proxyAddr, "http://") && !strings.HasPrefix(proxyAddr, "https://") && !strings.HasPrefix(proxyAddr, "socks5://") {
proxyAddr = proxyType + "://" + proxyAddr