-
Notifications
You must be signed in to change notification settings - Fork 62
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
Consider cross platform managed http to socks proxy #36
Comments
Yeah in general I like this idea whole lot. When I first started the project I couldn't find any well-established project that did this. I'll investigate this as another approach maybe even as an alternate option to what we already do with Privoxy. |
Hi Joel, just saw the new label. This is what i'm currently doing: var socksPort = 10_001;
var httpToSocksPort = 10_002; // Replaces privoxy http port
var settings = new TorSharpSettings
{
TorSettings = new TorSharpTorSettings
{
SocksPort = socksPort,
},
PrivoxySettings = new TorSharpPrivoxySettings
{
// NOTE: New setting
Disable = true,
}
};
var torSharpProxy = new TorSharpProxy(settings);
await torSharpProxy.ConfigureAndStartAsync();
// NOTE: Instead of using a WebProxy with privoxy's address and port, you can use the http proxy you want
// In this case i'm using HttpToSocks5Proxy
var httpToSocksProxy = new HttpToSocks5Proxy("127.0.0.1", socksPort, httpToSocksPort);
var httpClient = new HttpClient(new HttpClientHandler
{
UseProxy = true,
Proxy = httpToSocksProxy
}); Pros:
Cons:
|
Hey @AbeniMatteo, this is really awesome! Just so I understand, Ages ago I was working on an HTTP to SOCKS implementation but I got distracted by other things (this projects, for example). I'm really happy to see this come to fruition. Privoxy is cool but reducing complexity and the "fetcher" work is very good.
Sounds great, but TBH I was even considering doing this by adding a dependency to one of the existing packages out there. If we can get a bundled SOCKS proxy, that's even better.
❤️
My docs are pretty minimal as is. However now that there's two ways to do something (two different "bridges" from your C#
Are you interested in contributing the code back to the TorSharp by making a PR? You can even provide an unpolished version and I can work on plumping the options where they need to go. One example I am thinking of is when |
No, not my code. HttpToSocks5Proxy it's one of your suggested packages (see quote below).
You can add the dependency directly to TorSharp and maybe expose a custom IWebProxy but it's not necessary. What i did was just add a bunch of |
FYI: .NET 6 will natively support SOCKS proxies. dotnet/runtime#48883 |
And it works like a charm and is trivial to use, see https://til.cazzulino.com/dotnet/accessing-tor-via-httpclient-with-.net6 |
This is enabled in version 2.10.0 and a sample is added to the repo: Since SOCKS5 support is built into .NET 6, all TorSharp needs to do is allow Privoxy to be disabled, which is done. |
I'm currently using https://github.com/MihaZupan/HttpToSocks5Proxy on Android as http to socks proxy to replace Privoxy.
This solution is completely managed and cross platform as it just works with sockets.
I'm suggesting to consider this type of solution not requesting the integration.
The text was updated successfully, but these errors were encountered: