VpnHood.Net.VpnAdapters.WinTun 9.1.875

dotnet add package VpnHood.Net.VpnAdapters.WinTun --version 9.1.875
                    
NuGet\Install-Package VpnHood.Net.VpnAdapters.WinTun -Version 9.1.875
                    
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="VpnHood.Net.VpnAdapters.WinTun" Version="9.1.875" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VpnHood.Net.VpnAdapters.WinTun" Version="9.1.875" />
                    
Directory.Packages.props
<PackageReference Include="VpnHood.Net.VpnAdapters.WinTun" />
                    
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 VpnHood.Net.VpnAdapters.WinTun --version 9.1.875
                    
#r "nuget: VpnHood.Net.VpnAdapters.WinTun, 9.1.875"
                    
#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 VpnHood.Net.VpnAdapters.WinTun@9.1.875
                    
#: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=VpnHood.Net.VpnAdapters.WinTun&version=9.1.875
                    
Install as a Cake Addin
#tool nuget:?package=VpnHood.Net.VpnAdapters.WinTun&version=9.1.875
                    
Install as a Cake Tool

VpnHood.Net.VpnAdapters.WinTun

The Windows VPN adapter of VpnHood, on WinTun: a virtual network interface (TUN) that the host's traffic is routed into, whose IP packets a VPN reads and writes. It implements VpnHood.Net.VpnAdapters.Abstractions.

dotnet add package VpnHood.Net.VpnAdapters.WinTun

Quick start

Open an adapter and handle the packets the host routes into it. The example compiles with the tests in CI (VpnAdaptersReadmeExampleTest.cs) but does not run there, as it needs an administrator's rights. Its namespaces are VpnHood.Net.VpnAdapters.WinTun, VpnHood.Net.VpnAdapters.Abstractions and VpnHood.Net.Toolkit.Net.

// LinuxTunVpnAdapter, AndroidVpnAdapter and IosVpnAdapter take the same calls
using var adapter = new WinTunVpnAdapter(new WinTunVpnAdapterSettings {
    AdapterName = "MyVpn",
    Blocking = false // a full queue drops its oldest packet instead of making a send wait
});

// every packet the host routes into the tunnel arrives here
adapter.PacketReceived += (_, ipPacket) => {
    Console.WriteLine($"{ipPacket.SourceAddress} -> {ipPacket.DestinationAddress}, {ipPacket.Protocol}");
    ipPacket.Dispose(); // the handler owns each packet: forward it or dispose it
};

await adapter.Start(new VpnAdapterOptions {
    SessionName = "My VPN",
    VirtualIpNetworkV4 = IpNetwork.Parse("10.255.0.2/24"),
    IncludeNetworks = IpNetwork.All
}, cancellationToken);

How it works

  • WinTunVpnAdapter is an IVpnAdapter: make it with a WinTunVpnAdapterSettings, whose AdapterName names the interface. The Abstractions quick start goes on from here: sending packets to the host, and stopping.
  • A start makes the interface and sets its addresses, routes, MTU and metric through Windows' IP Helper API. Its DNS servers come with a Name Resolution Policy Table (NRPT) rule that makes them the only ones Windows asks, as Windows otherwise asks every adapter's servers at once; Group Policy's own NRPT rules override it, which the adapter logs.
  • For a server, UseNat translates the virtual IPv4 network to the host's address through WinNAT; WinNAT has no IPv6. There is no app filter.
  • WinTunVpnAdapter.BuildGuidFromName gives the interface's GUID for a name, the same at every start, so a kill switch can find the interface.

Requirements

  • Windows 10 or later, in an x64 or arm64 process.
  • An administrator's rights: the first start in a process installs wintun.dll into a protected folder of its own under Common Files, and WinTun installs its driver with the first interface.
  • The package carries WinTun's prebuilt DLLs, which come under WinTun's own Prebuilt Binaries License.

License

LGPL-2.1-only. See the VpnHood repository.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on VpnHood.Net.VpnAdapters.WinTun:

Package Downloads
VpnHood.Core.Client.Devices.WindowsTun

VpnHood client device provider for Windows with WinTun: the app's side, and what its VPN host shares

VpnHood.Core.Client.VpnServices.Host.WindowsTun

VpnHood's VPN service on Windows with WinTun: the VPN host's half, which runs the engine

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.875 29 11/16/2026
9.1.874 56 11/15/2026
9.1.864 127 11/3/2026
9.0.860 127 10/31/2026
9.0.859.16-prerelease 118 10/30/2026
9.0.857 140 10/20/2026
9.0.856 139 10/19/2026
9.0.855 132 10/13/2026
8.2.853.11-prerelease 126 10/5/2026
8.2.853 146 9/23/2026
8.2.852 136 9/23/2026