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

speedtest-cli and proxies #49

Open
servidge opened this issue Feb 22, 2022 · 1 comment
Open

speedtest-cli and proxies #49

servidge opened this issue Feb 22, 2022 · 1 comment

Comments

@servidge
Copy link
Contributor

Is there a reliable way to use speedtest-cli with proxies?
Under certain circumstances the environment parameter http_proxy seems to be taken into account on different operating systems if this is configured.
Tested it mainly on windows. but even there on different systems there were different test results with the same exe.
However, the actual download of the server list or the transmission of the statistics at the end (--share) does not seem to run via the proxy at all. Maybe someone has a solution before I start tinkering.

@servidge
Copy link
Contributor Author

Seems only partially complicated with my knowledge of go. But that is rather ephemeral, if i be honest.
The following botch works but the code is not suitable for production in my mind.
I tested this in my fork. It works but it's not yet worthy of a pull request.

Insert the transport.Proxy = nil at line 158 in speedtest.go and no proxy is used at all.
That's where the easy part ends. More or less.
Insert the following at the same line and the HTTP_PROXY environment variable will be respected except the --share part.
proxyUrl, _ := url.Parse(os.Getenv("HTTP_PROXY"))
transport.Proxy = http.ProxyURL(proxyUrl)

After that, at least the speedtest server list download and the test itself are transported via the proxy.
Something similar could be realized with a start parameter like --proxy-http.
But at the end the --share still needs some tinkering.

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