1、
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user