mirror of https://github.com/statping/statping
Merge 0647939ea2
into fd889a14c0
commit
0b1bd0b59b
|
@ -9,7 +9,6 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -214,18 +213,10 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
|
||||||
TLSHandshakeTimeout: timeout,
|
TLSHandshakeTimeout: timeout,
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
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)
|
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 {
|
if customTLS != nil {
|
||||||
transport.TLSClientConfig.RootCAs = customTLS.RootCAs
|
transport.TLSClientConfig.RootCAs = customTLS.RootCAs
|
||||||
transport.TLSClientConfig.Certificates = customTLS.Certificates
|
transport.TLSClientConfig.Certificates = customTLS.Certificates
|
||||||
|
|
Loading…
Reference in New Issue