WarpClient.DependencyInjection 26.10.21.7546

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WarpClient.DependencyInjection" Version="26.10.21.7546" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WarpClient.DependencyInjection" Version="26.10.21.7546" />
                    
Directory.Packages.props
<PackageReference Include="WarpClient.DependencyInjection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WarpClient.DependencyInjection --version 26.10.21.7546
                    
#r "nuget: WarpClient.DependencyInjection, 26.10.21.7546"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WarpClient.DependencyInjection@26.10.21.7546
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WarpClient.DependencyInjection&version=26.10.21.7546
                    
Install as a Cake Addin
#tool nuget:?package=WarpClient.DependencyInjection&version=26.10.21.7546
                    
Install as a Cake Tool

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 HttpClient instances 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 ITcpConnector and IUdpConnector, 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(),
};
  • RegistrationPath holds the device's private key and access token. It defaults to WarpClient/registration.json in the user's application data folder and is created readable only by its owner.
  • Underlay carries the registration API calls and the tunnel's own TCP connection. It defaults to SystemProxyTcpConnector, which connects directly unless the system proxy settings say otherwise.

How It Works

  1. A device is registered with Cloudflare's consumer API and an ECDSA P-256 key is enrolled for the MASQUE tunnel.
  2. The client connects to Cloudflare's MASQUE endpoint with mutual TLS, pinning the server key returned at enrollment.
  3. One HTTP/2 CONNECT stream (cf-connect-proto: cf-connect-ip) carries raw IPv4 packets in DATAGRAM capsules.
  4. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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