Table of Contents

VPN adapters

A VPN adapter is the virtual network interface a VPN reads packets from and writes them to. Every platform's adapter implements the same contract, so code written against it runs on all of them.

When to use it

  • You capture a device's traffic to tunnel it, inspect it or filter it.
  • You write a VPN client, a firewall or a traffic monitor in .NET.
  • You want one code path on every platform: write it against IVpnAdapter, and pick the platform's adapter when the app starts.

Which package to take

  • Windows: WinTun for an app or a service; WindowsVpnPlugin for an app that runs from an MSIX package; WinDivert to capture traffic without an interface of its own.
  • Linux: LinuxTun. Android: AndroidTun, in your VpnService. iOS and tvOS: IosTun, in your packet tunnel extension.
  • Code that only takes an adapter, and tests: VpnAdapters.Abstractions, with its null adapter.

Its packages

Package What it does
VpnHood.Net.VpnAdapters.Abstractions The VPN adapter contract: a virtual network interface whose packets a VPN reads and writes, the base class every platform's TUN adapter extends, and a null adapter. Guide · API
VpnHood.Net.VpnAdapters.AndroidTun The VPN adapter for Android, on the TUN interface that Android's VpnService gives an app. Guide · API
VpnHood.Net.VpnAdapters.IosTun The VPN adapter for iOS and tvOS, inside an app's packet tunnel extension. Guide · API
VpnHood.Net.VpnAdapters.LinuxTun The VPN adapter for Linux, on a TUN device of the process's own: its addresses, routes, MTU and DNS servers. Guide · API
VpnHood.Net.VpnAdapters.WinDivert A VPN adapter for Windows on WinDivert, a packet capture driver, with no network interface of its own. Guide · API
VpnHood.Net.VpnAdapters.WindowsVpnPlugin The VPN adapter of a Windows VPN plug-in, for an app that runs from an MSIX package: Windows owns the interface. Guide · API
VpnHood.Net.VpnAdapters.WinTun The VPN adapter for Windows on WinTun, a layer-3 TUN driver: it makes the interface and gives it its addresses, routes and DNS servers. Guide · API