TunnelForgeCoreNet 3.0.7

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

TunnelForgeCoreNet

Поддерживаемые языки / Supported languages / Unterstützte Sprachen / 支持的语言:


Русский

TunnelForgeCoreNet — это кроссплатформенная библиотека на .NET Standard 2.1 для работы с виртуальными сетевыми интерфейсами TUN/TAP в Windows и Linux. Она предоставляет единый удобный API для создания, управления и настройки туннелей VPN, позволяя читать и записывать сетевые пакеты с минимальными усилиями.

Быстрый обзор

  • AdapterManagerBuilder — класс-конструктор для создания и настройки менеджера туннельного адаптера.
  • ITunAdapterManager — интерфейс управления жизненным циклом туннельного адаптера и передачей пакетов.
  • NetworkConfigurator — набор высокоуровневых методов для настройки сетевого окружения VPN-клиента и сервера.

Детали и возможности

1. AdapterManagerBuilder — просто создать адаптер

Удобный билдер для задания имени интерфейса и размера буфера.

Пример:

var adapterManager = new AdapterManagerBuilder()
    .WithName("tun0")
    .WithCapacity(1024 * 1024)
    .Build();
2. ITunAdapterManager — управляй туннелем

Основные методы и события:

  • event Action<byte[]> OnPacketReceived
  • byte[]? ReadPacket()
  • Task<byte[]?> ReadPacketAsync(CancellationToken)
  • void WritePacket(ReadOnlySpan<byte>)
  • Task WritePacketAsync(ReadOnlyMemory<byte>, CancellationToken)
  • Task StartReceivingAsync(CancellationToken)
  • void StopReceiving()
  • bool IsRunning
3. NetworkConfigurator — настройка сети VPN
  • Клиентская настройка: IP, поднятие интерфейса, маршрут по умолчанию.
  • Серверная настройка: IP внешнего интерфейса, IP-форвардинг, NAT.

Пример клиента:

await NetworkConfigurator.ConfigureClientSideAsync(
    iface: "tun0",
    ip: "10.0.0.2",
    prefixLength: 24,
    serverTunnelIp: "10.0.0.1"
);

Пример сервера:

await NetworkConfigurator.ConfigureServerSideAsync(
    externalIface: "eth0",
    externalIp: "192.168.1.10",
    externalPrefix: 24,
    internalIface: "tun0"
);

Важные замечания

  • Поддержка только Windows и Linux.
  • Необходимы права администратора.
  • Управляйте жизненным циклом адаптера.

English

TunnelForgeCoreNet is a cross-platform .NET Standard 2.1 library for working with virtual TUN/TAP network interfaces on Windows and Linux. It provides a unified and convenient API for creating, managing, and configuring VPN tunnels, enabling easy reading and writing of network packets.

Quick overview

  • AdapterManagerBuilder — builder class to create and configure a tunnel adapter manager.
  • ITunAdapterManager — interface for managing tunnel lifecycle and packet transmission.
  • NetworkConfigurator — high-level methods for VPN client/server network configuration.

Features

1. AdapterManagerBuilder — easy adapter creation

Example:

var adapterManager = new AdapterManagerBuilder()
    .WithName("tun0")
    .WithCapacity(1024 * 1024)
    .Build();
2. ITunAdapterManager — manage your tunnel

Main members:

  • event Action<byte[]> OnPacketReceived
  • byte[]? ReadPacket()
  • Task<byte[]?> ReadPacketAsync(CancellationToken)
  • void WritePacket(ReadOnlySpan<byte>)
  • Task WritePacketAsync(ReadOnlyMemory<byte>, CancellationToken)
  • Task StartReceivingAsync(CancellationToken)
  • void StopReceiving()
  • bool IsRunning
3. NetworkConfigurator — VPN network setup
  • Client setup: assign IP, bring interface UP, add default route.
  • Server setup: assign IP to external iface, enable IP forwarding, configure NAT.

Client example:

await NetworkConfigurator.ConfigureClientSideAsync(
    iface: "tun0",
    ip: "10.0.0.2",
    prefixLength: 24,
    serverTunnelIp: "10.0.0.1"
);

Server example:

await NetworkConfigurator.ConfigureServerSideAsync(
    externalIface: "eth0",
    externalIp: "192.168.1.10",
    externalPrefix: 24,
    internalIface: "tun0"
);

Important notes

  • Supported platforms: Windows and Linux only.
  • Administrator privileges required.
  • Proper lifecycle management of the adapter is necessary.

Deutsch

TunnelForgeCoreNet ist eine plattformübergreifende .NET Standard 2.1-Bibliothek zur Arbeit mit virtuellen TUN/TAP-Netzwerkschnittstellen unter Windows und Linux. Sie bietet eine einheitliche und einfache API zum Erstellen, Verwalten und Konfigurieren von VPN-Tunneln, mit der Sie Netzwerkpakete einfach lesen und schreiben können.

Kurzübersicht

  • AdapterManagerBuilder — Builder-Klasse zum Erstellen und Konfigurieren eines Tunnel-Adapter-Managers.
  • ITunAdapterManager — Schnittstelle zur Verwaltung des Tunnel-Lebenszyklus und der Paketübertragung.
  • NetworkConfigurator — Hochrangige Methoden zur VPN-Client-/Server-Netzwerkkonfiguration.

Funktionen

1. AdapterManagerBuilder — einfacher Adapteraufbau

Beispiel:

var adapterManager = new AdapterManagerBuilder()
    .WithName("tun0")
    .WithCapacity(1024 * 1024)
    .Build();
2. ITunAdapterManager — Tunnelverwaltung

Wichtige Mitglieder:

  • event Action<byte[]> OnPacketReceived
  • byte[]? ReadPacket()
  • Task<byte[]?> ReadPacketAsync(CancellationToken)
  • void WritePacket(ReadOnlySpan<byte>)
  • Task WritePacketAsync(ReadOnlyMemory<byte>, CancellationToken)
  • Task StartReceivingAsync(CancellationToken)
  • void StopReceiving()
  • bool IsRunning
3. NetworkConfigurator — VPN-Netzwerkeinrichtung
  • Client: IP zuweisen, Interface hochfahren, Standardroute hinzufügen.
  • Server: IP externer Schnittstelle zuweisen, IP-Forwarding aktivieren, NAT konfigurieren.

Client-Beispiel:

await NetworkConfigurator.ConfigureClientSideAsync(
    iface: "tun0",
    ip: "10.0.0.2",
    prefixLength: 24,
    serverTunnelIp: "10.0.0.1"
);

Server-Beispiel:

await NetworkConfigurator.ConfigureServerSideAsync(
    externalIface: "eth0",
    externalIp: "192.168.1.10",
    externalPrefix: 24,
    internalIface: "tun0"
);

Wichtige Hinweise

  • Unterstützte Plattformen: Nur Windows und Linux.
  • Administratorrechte erforderlich.
  • Lebenszyklus des Adapters korrekt verwalten.

简体中文

TunnelForgeCoreNet 是一个基于 .NET Standard 2.1 的跨平台库,用于在 Windows 和 Linux 上操作虚拟 TUN/TAP 网络接口。它提供了统一且方便的 API,用于创建、管理和配置 VPN 隧道,轻松读取和写入网络数据包。

快速概览

  • AdapterManagerBuilder — 用于创建和配置隧道适配器管理器的构建类。
  • ITunAdapterManager — 管理隧道生命周期和数据包传输的接口。
  • NetworkConfigurator — 用于 VPN 客户端/服务器网络配置的高级方法集。

功能详情

1. AdapterManagerBuilder — 简单创建适配器

示例:

var adapterManager = new AdapterManagerBuilder()
    .WithName("tun0")
    .WithCapacity(1024 * 1024)
    .Build();
2. ITunAdapterManager — 管理隧道

主要成员:

  • event Action<byte[]> OnPacketReceived
  • byte[]? ReadPacket()
  • Task<byte[]?> ReadPacketAsync(CancellationToken)
  • void WritePacket(ReadOnlySpan<byte>)
  • Task WritePacketAsync(ReadOnlyMemory<byte>, CancellationToken)
  • Task StartReceivingAsync(CancellationToken)
  • void StopReceiving()
  • bool IsRunning
3. NetworkConfigurator — VPN 网络配置
  • 客户端配置:分配 IP,启用接口,添加默认路由。
  • 服务器配置:为外部接口分配 IP,启用 IP 转发,配置 NAT。

客户端示例:

await NetworkConfigurator.ConfigureClientSideAsync(
    iface: "tun0",
    ip: "10.0.0.2",
    prefixLength: 24,
    serverTunnelIp: "10.0.0.1"
);

服务器示例:

await NetworkConfigurator.ConfigureServerSideAsync(
    externalIface: "eth0",
    externalIp: "192.168.1.10",
    externalPrefix: 24,
    internalIface: "tun0"
);

重要注意事项

  • 仅支持 Windows 和 Linux。
  • 需要管理员权限。
  • 需正确管理适配器生命周期。
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
3.0.7 48 7/5/2025
3.0.6 58 7/5/2025 3.0.6 is deprecated because it has critical bugs.
3.0.5 61 7/5/2025 3.0.5 is deprecated because it has critical bugs.
3.0.4 60 7/5/2025 3.0.4 is deprecated because it has critical bugs.
3.0.3 61 7/5/2025 3.0.3 is deprecated because it has critical bugs.
3.0.2 61 7/5/2025 3.0.2 is deprecated because it has critical bugs.
3.0.1 59 7/5/2025 3.0.1 is deprecated because it has critical bugs.
3.0.0 60 7/5/2025 3.0.0 is deprecated because it has critical bugs.
2.1.15 85 7/4/2025 2.1.15 is deprecated because it is no longer maintained and has critical bugs.
2.1.14 86 7/4/2025 2.1.14 is deprecated because it is no longer maintained and has critical bugs.
2.1.13 141 6/30/2025 2.1.13 is deprecated because it is no longer maintained and has critical bugs.
2.1.12 188 6/28/2025 2.1.12 is deprecated because it is no longer maintained and has critical bugs.
2.1.11 172 6/24/2025 2.1.11 is deprecated because it is no longer maintained and has critical bugs.
2.1.10 209 6/24/2025 2.1.10 is deprecated because it is no longer maintained.
2.1.9 217 6/23/2025 2.1.9 is deprecated because it is no longer maintained.
2.1.8 204 6/23/2025 2.1.8 is deprecated because it has critical bugs.
2.1.7 206 6/23/2025 2.1.7 is deprecated because it has critical bugs.
2.1.6 208 6/23/2025 2.1.6 is deprecated because it has critical bugs.
2.1.5 210 6/23/2025 2.1.5 is deprecated because it has critical bugs.
2.1.4 218 6/22/2025 2.1.4 is deprecated because it has critical bugs.
2.1.3 213 6/22/2025 2.1.3 is deprecated because it has critical bugs.
2.1.2 179 6/21/2025 2.1.2 is deprecated because it has critical bugs.
2.1.1 217 6/19/2025 2.1.1 is deprecated because it has critical bugs.
2.1.0 213 6/18/2025 2.1.0 is deprecated because it has critical bugs.

EN:
- Fixed a crash in the Windows TUN adapter caused by disposal of SafeWaitHandle during async read operations.
- ReadPacketAsync now safely waits for native event signaling without triggering ObjectDisposedException.

RU:
- Исправлен сбой в Windows-адаптере TUN, возникавший при попытке читать данные после уничтожения SafeWaitHandle.
- ReadPacketAsync теперь безопасно ожидает сигнализации событий, исключая ObjectDisposedException.

DE:
- Absturz im Windows-TUN-Adapter behoben, der durch die vorzeitige Entsorgung von SafeWaitHandle bei asynchronen Leseoperationen ausgelöst wurde.
- ReadPacketAsync wartet jetzt sicher auf die native Ereignissignalisierung ohne ObjectDisposedException.

CN:
- 修复了 Windows TUN 适配器在异步读取期间因 SafeWaitHandle 被释放而导致的崩溃问题。
- ReadPacketAsync 现在安全地等待原生事件信号,避免 ObjectDisposedException。