This project is suitable for all WebProxy, HTTP Client, WebSocket and for others.
Nuget: https://www.nuget.org/packages/Yove.Proxy/
Install-Package Yove.Proxy
dotnet add package Yove.Proxy
ProxyClient proxy = new ProxyClient("138.68.161.60", 1080, ProxyType.Socks5);
ProxyClient proxy = new ProxyClient("138.68.161.60:1080", ProxyType.Socks5);
ProxyClient proxy = new ProxyClient("138.68.161.60:1080", "UserID / Username", ProxyType.Socks4);
ProxyClient proxy = new ProxyClient("138.68.161.60:1080", "Username", "Password", ProxyType.Socks5);
using (ProxyClient proxy = new ProxyClient("36.67.195.34", 57456, ProxyType.Socks5)
{
ReadWriteTimeOut = 10000
})
{
ClientWebSocket webSocket = new ClientWebSocket
{
Options.Proxy = proxy
};
await webSocket.ConnectAsync(new Uri("wss://echo.websocket.org"), TokenSource.Token);
}
using (ProxyClient proxy = new ProxyClient("36.67.195.34", 57456, ProxyType.Socks4)
{
ReadWriteTimeOut = 10000
})
{
HttpClientHandler handler = new HttpClientHandler { Proxy = proxy };
HttpClient client = new HttpClient(handler);
try
{
string response = await client.GetStringAsync("https://api.ipify.org/?format=json");
Console.WriteLine(response);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
handler.Dispose();
client.Dispose();
}
}