Skip to main content

tunping

If ping shows 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.

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 way 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

pip install -e .

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

Output mimics ping by default:

TUNPING 1.1.1.1 (1.1.1.1:443) with HTTPS TTFB (not ICMP; for TUNs that answer ping locally)
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",...} — handy for graphs.

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

License

MIT.

Metadata

Release files for tunping 0.1.0

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.0
File Size Uploaded
tunping-0.1.0.tar.gz 8.7 kB Details

Built distribution (wheel)

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

Total release size: 16.1 kB

Release files / tunping-0.1.0.tar.gz

Download URL tunping-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
653562ce1d19831a42f5ba17852ee033ad314f9a86bb8db288013db3ba60e32e
BLAKE2b-256 checksum
How to use checksums
1705c66ef3f70b6848838f133dbd398ab700453eabc12f958de986a2a0ec516d
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.0-py3-none-any.whl

Download URL tunping-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
394401590e4dde9dbf0d1d23f6a6ec7469ab0bf911fe114c03f6ccad0d718e61
BLAKE2b-256 checksum
How to use checksums
9ddb47167416d073a3154b327dc9473c9cc4599bd211fbaf10a89e13886e52fb
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

0.1.1

2 release files

This release

0.1.0 This release

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