NetWintun 1.0.2

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

NetWintun NuGet Version License: MIT

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


💡 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 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. 
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
1.0.2 167 9/2/2025
1.0.1 667 8/20/2025
1.0.0 179 8/20/2025