Skip to content

Add support for HTTP_PROXY and SOCKS_PROXY #458

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

unclearParadigm
Copy link

Hi @sigaloid,

It has been a while since I initially proposed to add Support for Proxies. The project was still called LibReddit at that time - see original request: libreddit/libreddit#841 .

Further Issues that relate to that

Since my instance is getting rate-limited frequently, people are already complaining about it, and I don't want to add further VPS (with new public IPs) just to circumvent the rate-limiting. So I finally decided to patch redlib to support HTTP_PROXY and SOCKS proxies.

Changes in this MR

Redlib honors the following Environment-Variables:

  • HTTP_PROXY
  • HTTPS_PROXY
  • SOCKS_PROXY

if SOCKS_PROXY is set, it'll take precedence over HTTPS_PROXY and HTTP_PROXY. Additionally the Environment Variables support authentication using the following format scheme://username:password@host:port (e.g. http://proxyUsername:mySuperSecureProxyPassword@localhost:8090).

For SOCKS support I introduced tokio-socks as dependency. For HTTP Proxy support, I just wrote a simple HTTP CONNECT wrapper. In all cases, consumers of the CLIENT won't notice a difference.

Tests

I have tested HTTP Proxying with TinyProxy locally. And I have tested SOCKS Proxying with my VPN Providers SOCKS Proxy, and TOR proxying through a local tor-socks-proxy container.

Would appreciate if you could review this MR - and maybe merge back. That'd make the world a better place - at least get rid of some rate-limits ^^

Cheers,
ruffy

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

Successfully merging this pull request may close these issues.

1 participant