WarpClient.DependencyInjection
26.10.21.7546
See the version list below for details.
dotnet add package WarpClient.DependencyInjection --version 26.10.21.7546
NuGet\Install-Package WarpClient.DependencyInjection -Version 26.10.21.7546
<PackageReference Include="WarpClient.DependencyInjection" Version="26.10.21.7546" />
<PackageVersion Include="WarpClient.DependencyInjection" Version="26.10.21.7546" />
<PackageReference Include="WarpClient.DependencyInjection" />
paket add WarpClient.DependencyInjection --version 26.10.21.7546
#r "nuget: WarpClient.DependencyInjection, 26.10.21.7546"
#:package WarpClient.DependencyInjection@26.10.21.7546
#addin nuget:?package=WarpClient.DependencyInjection&version=26.10.21.7546
#tool nuget:?package=WarpClient.DependencyInjection&version=26.10.21.7546
WarpClient
A .NET library for sending TCP, UDP, and HTTP traffic through Cloudflare WARP. Remote services see a Cloudflare address while the calling code keeps using ordinary streams, datagrams, and HttpClient — no VPN, TUN device, or elevated privileges.
Features
- Register a free WARP device on first use and reuse it afterwards.
- Open TCP streams, connected UDP associations, or
HttpClientinstances through the tunnel. - Resolve host names inside the tunnel with 1.1.1.1, so lookups never leak to the local resolver.
- Run over HTTP/2 on TCP port 443, so it works on networks that block UDP; honours
HTTPS_PROXY. - Swap network paths behind
ITcpConnectorandIUdpConnector, with direct implementations included.
Quick Start
using Warp;
await using WarpClient warp = await WarpClient.CreateAsync();
using HttpClient client = warp.CreateHttpClient();
string address = await client.GetStringAsync("https://ifconfig.me/ip");
Raw TCP and UDP use the same client:
await using Stream tcp = await warp.ConnectTcpAsync("example.com", 443);
await using IUdpConnection udp = await warp.ConnectUdpAsync("stun.cloudflare.com", 3478);
Dependency Injection
Install WarpClient.DependencyInjection and register with your service collection:
builder.Services.AddWarpClient();
builder.Services.AddHttpClient("warp").UseWarpClient();
AddWarpClient also exposes the shared client as ITcpConnector and IUdpConnector.
Configuration
WarpClientOptions options = new()
{
RegistrationPath = "/var/lib/myapp/warp.json",
Underlay = new DirectTcpConnector(),
};
RegistrationPathholds the device's private key and access token. It defaults toWarpClient/registration.jsonin the user's application data folder and is created readable only by its owner.Underlaycarries the registration API calls and the tunnel's own TCP connection. It defaults toSystemProxyTcpConnector, which connects directly unless the system proxy settings say otherwise.
How It Works
- A device is registered with Cloudflare's consumer API and an ECDSA P-256 key is enrolled for the MASQUE tunnel.
- The client connects to Cloudflare's MASQUE endpoint with mutual TLS, pinning the server key returned at enrollment.
- One HTTP/2
CONNECTstream (cf-connect-proto: cf-connect-ip) carries raw IPv4 packets in DATAGRAM capsules. - A small userspace IPv4 stack turns those packets into TCP connections and UDP datagrams.
The research behind this — registration API, WireGuard and MASQUE transports, and how community clients work — is in reports/.
Limitations
- IPv4 destinations only; the tunnel's IPv6 address is not used yet.
- HTTP/2 transport only. HTTP/3 needs QUIC datagrams, which .NET does not expose yet.
- The TCP implementation favours simplicity: no congestion control, selective acknowledgments, or window scaling.
- Free WARP accounts only; Zero Trust enrollment and WARP+ licenses are not supported yet.
- Registering a device accepts Cloudflare's terms of service.
Credits
The wire protocol is undocumented; this library builds on reverse engineering by usque, wgcf, warp-plus, mihomo, and Xray-core.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.13)
- WarpClient (>= 26.10.21.7546)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.10.21.8006 | 99 | 10/21/2026 |
| 26.10.21.7972 | 94 | 10/21/2026 |
| 26.10.21.7941 | 96 | 10/21/2026 |
| 26.10.21.7857 | 93 | 10/21/2026 |
| 26.10.21.7751 | 92 | 10/21/2026 |
| 26.10.21.7546 | 104 | 10/21/2026 |