bitbot
bitbot copied to clipboard
proxy configuration for utils.http.request, based on url pattern matching
This is mostly so we can configure *.onion URLs to use the local tor instance for accessing them but I'm sure there's other uses.
I'd much prefer this be a module but that would involve abstracting the below in to a replaceable "http client" object - a la dependency injection for providing the implementation of an interface.
https://github.com/jesopo/bitbot/blob/b1033a07210637ecd18cf7f2e501c4b6b46f78cb/src/utils/http.py#L78-L88
A good note about this from #142:
In addition to the Tor address obviously needing to be configurable, I think Bitbot should also support SOCKS proxy authentication, maybe with autogenerated bitbot:randompassword combination so it automatically gets stream isolation and bitbot cannot be used to figure out what other domains have been accessed through the same Tor instance.
I think Tor's HTTPTunnelPort only works for https traffic and thus it would be better to use the socks for it + the previous comment.
I2P however should work for *.i2p and it's a HTTP proxy on 127.0.0.1:4444 (at least if I am interpreting i2pd.conf properly (do note it's a fork))
the proxy configuration system would be able to utilise http, https, socks4 and socks5 proxies at a minimum :)
Might just bite the bullet on this one and have a module that overwrites utils.http.request() in its on_load() and rewrites it in unload()
that'll at least solve the problem for now and not cause any long-term issues