Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for using SOCKS proxy #187

Open
cpiatnit opened this issue Oct 14, 2024 · 0 comments
Open

Please add support for using SOCKS proxy #187

cpiatnit opened this issue Oct 14, 2024 · 0 comments

Comments

@cpiatnit
Copy link

Here is my scenario

our laptops ◄----►Jumpbox1 ◄----►Jumpbox2 ◄----►Router ◄----►devices to be configured

as the provider uses https for this please consider scenarios like this.

After experimenting with this and reading a little about how it should work it seems that this could be handled using socks proxy
I do not know Golang to test this. Chatgpt or Google's version of AI applied to searching is suggesting the below

You can set the following environment variables to configure the proxy:
HTTP_PROXY: Set this to the address of your HTTP proxy server.
HTTPS_PROXY: Set this to the address of your HTTPS proxy server.
NO_PROXY: Set this to a comma-separated list of hosts that should bypass the proxy.
Code

export HTTP_PROXY=http://your-proxy-server:port/
export HTTPS_PROXY=http://your-proxy-server:port/
export NO_PROXY=localhost,127.0.0.1

If you are writing custom Go code that interacts with Terraform providers, you can explicitly check for and use the proxy settings from the environment variables.
Go

package main

import (
"fmt"
"net/http"
"os"
)

func main() {
// ... other code

// Get proxy settings from environment variables
httpProxy := os.Getenv("HTTP_PROXY")
httpsProxy := os.Getenv("HTTPS_PROXY")

// Create an HTTP client with proxy settings
client := &http.Client{}
if httpProxy != "" {
client.Transport = &http.Transport{
Proxy: http.ProxyURL(httpProxy),
}
}

// ... use the client to make requests
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant