diff options
author | terminaldweller <devi@terminaldweller.com> | 2023-05-09 19:47:26 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2023-05-09 19:47:26 +0000 |
commit | 057a0e1076068ebb20c987f2e9aebe96a8e550ec (patch) | |
tree | 03968aa21f735b791362e5b30fdd482de874f455 /arbiter | |
parent | we no longer need to change the cert names manually (diff) | |
download | hived-057a0e1076068ebb20c987f2e9aebe96a8e550ec.tar.gz hived-057a0e1076068ebb20c987f2e9aebe96a8e550ec.zip |
using the simpler proxyfromenv function from the stdlib
Diffstat (limited to '')
-rw-r--r-- | arbiter/arbiter.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/arbiter/arbiter.go b/arbiter/arbiter.go index a9ce43d..8e2c999 100644 --- a/arbiter/arbiter.go +++ b/arbiter/arbiter.go @@ -6,9 +6,7 @@ import ( "encoding/json" "errors" "flag" - "fmt" "io" - "net" "net/http" "net/url" "os" @@ -21,7 +19,6 @@ import ( "github.com/gorilla/mux" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "golang.org/x/net/proxy" ) var ( @@ -87,28 +84,9 @@ type errorChanStruct struct { } func GetProxiedClient() (*http.Client, error) { - proxyURL := os.Getenv("ALL_PROXY") - if proxyURL == "" { - proxyURL = os.Getenv("HTTPS_PROXY") - } - - dialer, err := proxy.SOCKS5("tcp", proxyURL, nil, proxy.Direct) - if err != nil { - return nil, fmt.Errorf("[GetProxiedClient] : %w", err) - } - - dialContext := func(ctx context.Context, network, address string) (net.Conn, error) { - netConn, err := dialer.Dial(network, address) - if err == nil { - return netConn, nil - } - - return netConn, fmt.Errorf("[dialContext] : %w", err) - } - transport := &http.Transport{ - DialContext: dialContext, DisableKeepAlives: true, + Proxy: http.ProxyFromEnvironment, } client := &http.Client{ Transport: transport, |