hiddify.st
EN

TopicInbound

The little router inside the virtual adapter

TUN implementation on Hiddify's inbound page decides how packets in VPN mode become connections again, and strict route decides whether any traffic can bypass the virtual adapter. This article compares the four implementations on speed, compatibility and resources, and explains what strict route does on Windows and Linux.

Checked on

A row of blinking servers in a data centre: the TUN implementation is the network equipment behind the virtual adapter
A row of blinking servers in a data centre: the TUN implementation is the network equipment behind the virtual adapter BalticServers.com, CC BY-SA 3.0

In VPN mode Hiddify adds a virtual network adapter (TUN) to the system. Every packet a program sends goes into this adapter first, and Hiddify decides where it goes. The catch: the adapter receives loose IP packets, while a proxy needs a connection. The part of the program that reassembles packets into connections is called a network stack, and TUN implementation under Settings → Inbound chooses that stack.

TUN implementation and strict route in VPN mode rarely need touching. But for problems like lag in games, a phone running hot or VPN mode failing after a system update, they are often the key. Below: first what happens inside the virtual adapter, then how to choose and how to troubleshoot.

Four implementations

ImplementationHow it worksProsCons
SystemUses the operating system's own network stackFast, lightDepends on system behaviour; compatibility issues on some systems
gVisorUses the user-space network stack from the gVisor projectCompatible, consistent behaviourMore CPU and memory
MixedSystem stack for TCP, gVisor for UDPSpeed plus UDP compatibilityCan meet problems from both
Sing 15Named after an early sing-box versionA fallback when newer implementations failLittle official documentation; not recommended as a first choice here

gVisor began as Google's security sandbox for containers. Its network stack runs entirely in user space without relying on the system, so it behaves the same on every device. The price is that each packet passes through more code, which costs a little battery on phones.

Neat cabling in a server rack: the system stack and gVisor are two ways of wiring the same room
Neat cabling in a server rack: the system stack and gVisor are two ways of wiring the same room Inisheer, CC BY-SA 3.0

How to choose

  1. Keep the defaultIf it works and is not slow, leave it
  2. Games or video calls (UDP) have problemsTry gVisor or Mixed
  3. The phone runs hot or drains noticeablyTry System
  4. VPN mode stopped working after a system updateSwitch implementation to rule things out
  5. Tried all four, still failingReport the problem with logs
Start from the default

Disconnect and reconnect after every switch. When comparing, use the same server at the same time of day, so you do not mistake server swings for the implementation.

What strict route does

With strict route on, Hiddify keeps traffic inside the virtual adapter more firmly and leaves no room for detours. How depends on the system:

SystemWhat strict route does
LinuxUnsupported networks become unreachable; ICMP (ping) also goes into the adapter; all connections go through TUN
WindowsAdds firewall rules that stop DNS leaks caused by Windows querying several adapters at once

Windows has a habit: with several adapters, it may send the same DNS query to the DNS servers of all of them and use whichever answers first. Even with a VPN on, queries can leak out of the real adapter. Strict route's firewall rules close that gap.

Layers of crossing ramps on a motorway interchange: strict route leads every slip road onto one main road
Layers of crossing ramps on a motorway interchange: strict route leads every slip road onto one main road Coolcaesar, CC BY 4.0

Side effects of strict route

Closing things firmly can hit the wrong target:

  • Local network access: the router admin page, a NAS or a LAN printer may fail; pair it with the Bypass LAN rule.
  • Virtual machines and containers: VirtualBox and Docker adapters may lose internet access.
  • Other VPNs or corporate clients: company VPN software may conflict with it.

If any of this happens after turning it on, turn it off first to confirm the cause, then decide. People who care most about privacy keep it on; those who value convenience can turn it off.

A troubleshooting example

Say that on Windows, with VPN mode on, browsing works but online games keep disconnecting. Troubleshoot like this:

  1. First rule out the server: test with another one, and continue only if it still drops;
  2. Switch TUN implementation from the default to gVisor, reconnect and play for half an hour;
  3. Still failing, try Mixed, since games mostly use UDP;
  4. Still dropping, turn strict route off for now to see whether a firewall rule blocks one of the game's connections;
  5. If none of this helps, export a diagnostics report and send feedback.

Change only one thing per step and note the result. Then even if you end up reporting the problem, you can say clearly what you tried and what happened, which saves the developers a lot of detours.

The same approach works on phones, with fewer options. On Android, if the phone gets noticeably warm with VPN on, try switching from gVisor to System, since the system implementation skips a layer of user-space processing and usually uses less power; use it for half a day and compare the battery graph before deciding which to keep.

Do Android and iPhone have these options?

On phones the VPN is managed by the system's VPN interface, so some options are unavailable or do nothing. The screen marks unavailable options.

How does TUN implementation relate to service mode?

TUN implementation is used only when the service mode is VPN. System proxy and proxy-only modes do not use the virtual adapter.

Speed changed a lot after switching implementation?

A network stack usually changes speed by under 10%. Big changes are more likely due to a different server or time of day.

Do I need to restart the computer after switching implementation?

Usually not; disconnecting and connecting again uses the new implementation. If an old virtual adapter is left behind in the system, one restart cleans it up.