From 335162f25727109de0e088189980c97776a260ee Mon Sep 17 00:00:00 2001 From: Adam Greene Date: Thu, 9 Dec 2021 15:59:47 -0500 Subject: [PATCH] use http_proxy for RDAP client and bootstrap requests if set in environment --- cli.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cli.go b/cli.go index 3038fe2..6f9ddf2 100644 --- a/cli.go +++ b/cli.go @@ -464,6 +464,17 @@ func RunCLI(args []string, stdout io.Writer, stderr io.Writer, options CLIOption TLSClientConfig: tlsConfig, } + // If http_proxy is set, use that as the Transport Proxy + proxyStr, present := os.LookupEnv("http_proxy") + if present { + proxyURL, err := url.Parse(proxyStr) + if err != nil { + printError(stderr, fmt.Sprintf("rdap: Error: invalid proxy URL: %s", proxyURL)) + return 1 + } + transport.Proxy = http.ProxyURL(proxyURL) + } + // Setup http.RoundTripper for http clients bs.HTTP = &http.Client{ Transport: transport,