SocksSharp provides support for Socks4/4a/5 proxy servers to HttpClient
Install as NuGet package:
Install-Package SocksSharp
.NET CLI:
dotnet add package SocksSharp
For .NET Core build-time support, you must use the .NET Core 2 SDK. You can target any supported platform in your library, long as the 2.0+ SDK is used at build-time.
var settings = new ProxySettings()
{
Host = "127.0.0.1",
Port = 1080
};
using (var proxyClientHandler = new ProxyClientHandler<Socks5>(settings))
{
using (var httpClient = new HttpClient(proxyClientHandler))
{
var response = await httpClient.GetAsync("http://example.com/");
}
}
Interesting? See more
Feel free to open an issue or submit a pull request. To make sure your pull request doesn't go in vain (gets declined), open an issue first discussing it (before actually implementing it).