EzNetProxy 1.1.0
dotnet add package EzNetProxy --version 1.1.0
NuGet\Install-Package EzNetProxy -Version 1.1.0
<PackageReference Include="EzNetProxy" Version="1.1.0" />
paket add EzNetProxy --version 1.1.0
#r "nuget: EzNetProxy, 1.1.0"
// Install EzNetProxy as a Cake Addin #addin nuget:?package=EzNetProxy&version=1.1.0 // Install EzNetProxy as a Cake Tool #tool nuget:?package=EzNetProxy&version=1.1.0
EzNetProxy
A library to simplify proxy usage in .NET 7+
Usage
- Install package via Nuget or some other method
- Import modules:
using EzNetProxy;
- Use your preferred way to parse the proxy connection information.
Notes:
- Requires .NET 7+
- Backbone connections supported
- ipv6 works (backbone connection)
Supported proxy formats:
host:port
host:port:user:pw
user:pw@host:port
Method #1:
var httpProxy = ProxyClient.Parse("http://host:port");
var socks4Proxy = ProxyClient.Parse("socks4://host:port:user:pw");
var socks4aProxy = ProxyClient.Parse("socks4a://user:pw@host:port");
var socks5Proxy = ProxyClient.Parse("socks5://host:port");
Method #2:
string proxy = "123.123.123.123:8080";
var httpProxy = ProxyClient.Parse(ProxyType.HTTP, proxy);
...
Method #3:
using EzNetProxy.Modals;
ProxyData data = new()
{
Type = ProxyType.HTTP,
Ip = "pornhub.com",
Port = 80,
Username = "username",
Password = "password"
};
var proxy = ProxyClient.Parse(data);
You can also use Fiddler's debugging proxy by:
var proxy = ProxyClient.DebugFiddler();
Here is a simple example:
// backbone connection; ipv4; 104.227.XXX.XXX
var proxy = ProxyClient.Parse(ProxyType.HTTP, "q.webshare.io:80");
HttpClientHandler httpClientHandler = new()
{
Proxy = proxy,
UseProxy = true // IMPORTANT!
};
using HttpClient client = new(httpClientHandler, true);
var str = await client.GetStringAsync("https://wtfismyip.com/text");
Console.WriteLine(str);
// str = 104.227.XXX.XXX
This project is inspired by xNet; the project is no longer maintained by its creator and even many forks of the project, such as Leaf.xNet. One of the main reasons why xNet was treasured was for its support of many proxy protocols, such as Socks-4 and Socks-5, and how simple it was to use. Hopefully, this project can be an excellent replacement for one part of the project — simple proxy usage.
Please check my profile if you'd like to contact me.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.