NetWintun 1.0.2
dotnet add package NetWintun --version 1.0.2
NuGet\Install-Package NetWintun -Version 1.0.2
<PackageReference Include="NetWintun" Version="1.0.2" />
<PackageVersion Include="NetWintun" Version="1.0.2" />
<PackageReference Include="NetWintun" />
paket add NetWintun --version 1.0.2
#r "nuget: NetWintun, 1.0.2"
#:package NetWintun@1.0.2
#addin nuget:?package=NetWintun&version=1.0.2
#tool nuget:?package=NetWintun&version=1.0.2
NetWintun

NetWintun is an unofficial C# wrapper around the Wintun library.
Wintun is a minimal, high-performance TUN driver for Windows, providing userspace programs with a simple virtual network adapter for sending and receiving packets.
✨ Features
- 🌀
async/await
support for receiving packets - 📋 Integration with Microsoft.Extensions.Logging
- 🛡️ Robust error handling and resource management
- 🔌 Ships with the prebuilt, signed Wintun binaries.
💡 Example Usage
Sending a packet
using var adapter = Adapter.Create("OfficeNet", "Wintun");
using var session = adapter.StartSession(Wintun.Constants.MaxRingCapacity);
session.SendPacket("Hello World"u8);
Receiving a packet
using var adapter = Adapter.Create("OfficeNet", "Wintun");
using var session = adapter.StartSession(Wintun.Constants.MinRingCapacity);
// Asynchronously wait for a packet
var packet = await session.ReceivePacketAsync();
// Or try to grab one immediately
if (session.TryReceivePacket(out var packet)) {
Console.WriteLine($"Received {packet.Length} bytes");
}
Plugging into Microsoft.Extensions.Logging
using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
Wintun.SetLogger(loggerFactory.CreateLogger<Program>());
👉 Check out the full example program for a working demo.
🛠️ Building from Source
Prerequisites
Before building, unzip the prebuilt Wintun binaries into the /wintun
directory:
/netwintun
├─ src/
├─ examples/
└─ wintun/ <-- unzip here
📜 Licensing
The contents of the repository are "Copyright (c) 2025 aneilmac".
Source code: Licensed under the MIT License
The library requires usage of wintun.dll. The NetWintun nuget package includes prebuilt and signed Wintun binaries, which are distributed under the terms of the Prebuilt Binaries License. By using NetWintun via NuGet, you agree to the terms of the Wintun Prebuilt Binaries License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Microsoft.Extensions.Logging (>= 9.0.8)
- Microsoft.VisualStudio.Threading.Only (>= 17.14.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.