mirror of https://github.com/statping/statping
Proxy Corrections
parent
559e0b9ff4
commit
3045ad951d
|
@ -10,7 +10,6 @@ import (
|
|||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
@ -211,18 +210,10 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
|
|||
TLSHandshakeTimeout: timeout,
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
// redirect all connections to host specified in url
|
||||
addr = strings.Split(req.URL.Host, ":")[0] + addr[strings.LastIndex(addr, ":"):]
|
||||
return dialer.DialContext(ctx, network, addr)
|
||||
},
|
||||
}
|
||||
if Params.GetString("HTTP_PROXY") != "" {
|
||||
proxyUrl, err := url.Parse(Params.GetString("HTTP_PROXY"))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
transport.Proxy = http.ProxyURL(proxyUrl)
|
||||
}
|
||||
|
||||
if customTLS != nil {
|
||||
transport.TLSClientConfig.RootCAs = customTLS.RootCAs
|
||||
transport.TLSClientConfig.Certificates = customTLS.Certificates
|
||||
|
|
Loading…
Reference in New Issue