Skip to main content

tunping

If ping shows something like 0.01 ms with ttl=64 after you enable the VPN, the ping is intercepted and answered locally. ICMP lies. tunping measures the real latency instead. With --compare it runs the same probe via two interfaces (VPN and direct), so the VPN overhead shows up as one number.

This is NOT ICMP. tunping times an HTTPS round-trip (HEAD / → first response byte) over one persistent connection.

Background

  • SOCKS-TUN mode (tun2socks/XRay-style): ping and hping -S / mtr --tcp are all answered by the local TUN device, so they report garbage, typically under 1 ms.
  • tunping works in that case because it times payload, not handshake.

What it looks like

With the VPN on, ping outputs:

$ ping 1.1.1.1
64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.01 ms

$ ping 192.0.2.1    # TEST-NET answers (it should never)
64 bytes from 192.0.2.1: icmp_seq=1 ttl=64 time=0.01 ms

$ traceroute -n 1.1.1.1
 1  * * *
 2  * * *

The true round-trip is slower:

$ tunping 1.1.1.1 -c 1
response from 1.1.1.1 (1.1.1.1): seq=1 ttfb=100.0 ms

Install

All distros (pipx):

pipx install tunping

Without pipx/uv:

python3 -m venv tunping-venv
source tunping-venv/bin/activate
pip install tunping

Arch Linux:

git clone https://github.com/mceblvn/tunping.git
cd tunping/packaging/aur
makepkg -si

Python >= 3.10, stdlib only, no deps.

Use

tunping 1.1.1.1 -c 4
tunping 1.1.1.1 -c 4 --json
tunping example.com -c 10 -i 0.5 --port 443 --timeout 5
tunping 1.1.1.1 --proto http --port 80 -c 2
tunping 1.1.1.1 --sni cloudflare-dns.com --insecure -c 2  # SNI override
tunping 1.1.1.1 -c 4 --compare tun2 enp14s0

--compare probes both interfaces and shows the delta

Output mimics ping by default:

TUNPING 1.1.1.1 (1.1.1.1:443) with HTTPS TTFB
response from 1.1.1.1 (1.1.1.1): seq=1 ttfb=182.4 ms
...
--- 1.1.1.1 tunping statistics ---
4 transmitted, 4 received, 0.0% loss
rtt min/avg/max/mdev = 181.2/183.1/185.4/1.5 ms
jitter = 2.1 ms

JSON (--json): one object per probe {"type":"probe",...} plus final {"type":"summary",...} is handy for graphs/scripts.

Exit codes: 0 if any probe succeeded, 1 if all lost, 2 on usage error.

License

MIT.

Metadata

Release files for tunping 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tunping 0.1.1
File Size Uploaded
tunping-0.1.1.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tunping 0.1.1
File Interpreter ABI Platform
tunping-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / tunping-0.1.1.tar.gz

Download URL tunping-0.1.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a317d922d223894090b986c3dd4342144f6ee29aa0002f093bf2f4edabcfff7d
BLAKE2b-256 checksum
How to use checksums
836391fa3d2ea189f5519d5454f0f1c7bc6361e47e5bf74ec915d9a2ec04b075
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / tunping-0.1.1-py3-none-any.whl

Download URL tunping-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94d693d15cd6b202771e2f398e36edfb3fba498414741b21589650f654f01c86
BLAKE2b-256 checksum
How to use checksums
23d05c16e9c670190feefc007ba61c17781c8632a88d50958ab830a6f20f03b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page