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
<PackageReference Include="VpnHood.Net.VpnAdapters.WinTun" Version="9.1.875" />
<PackageVersion Include="VpnHood.Net.VpnAdapters.WinTun" Version="9.1.875" />
<PackageReference Include="VpnHood.Net.VpnAdapters.WinTun" />
paket add VpnHood.Net.VpnAdapters.WinTun --version 9.1.875
#r "nuget: VpnHood.Net.VpnAdapters.WinTun, 9.1.875"
#:package VpnHood.Net.VpnAdapters.WinTun@9.1.875
#addin nuget:?package=VpnHood.Net.VpnAdapters.WinTun&version=9.1.875
#tool nuget:?package=VpnHood.Net.VpnAdapters.WinTun&version=9.1.875
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
WinTunVpnAdapteris anIVpnAdapter: make it with aWinTunVpnAdapterSettings, whoseAdapterNamenames 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,
UseNattranslates the virtual IPv4 network to the host's address through WinNAT; WinNAT has no IPv6. There is no app filter. WinTunVpnAdapter.BuildGuidFromNamegives 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.dllinto 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- VpnHood.Net.VpnAdapters.Abstractions (>= 9.1.875)
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 |