visitor@semih-os:~$cat /projects/internetakip.md

0x02in progress

internetakip

candroidjnikotlinnetworking

progress

updated:

5 / 7 stages done
  1. device discovery — done
  2. skeleton — done
  3. notification panel — done
  4. latency and speed test — done
  5. panel — done
  6. connection log← now
  7. log tools — planned

What it does

Live speed, daily usage, ping, jitter and packet loss in the notification bar, with per-app history underneath. The connection-log phase adds a record of every connection: which app, which domain, when.

I set three rules from the start: packet contents are never read, TLS is never decrypted by intercepting it, and no data ever leaves the device. Seeing the domain doesn’t require the contents — the DNS response and the SNI field in the TLS handshake are enough.

Native layer

The Kotlin side is split into modules (core, collector/{traffic,probe,flow}, runtime, feature/panel), and the build breaks if the inter-module dependency rule is violated. The real work happens in the C code under collector/flow:

  • tunnel.c — the JNI wrapper around the zdtun user-space TCP/IP tunnel
  • names.c — a hand-written DNS and TLS SNI parser

When resolving compressed names, the DNS parser only accepts pointers that go backward; that way a malicious response can’t drive the parser into an infinite loop.

The hard problem: dropped connections

While reading zdtun’s source, two default limits caught my eye: 128 sockets and a 60-second idle TCP timeout. I suspected that any connection going quiet for a minute would be cut, and I measured it on a real device (Poco X7 Pro, Android 16) using a test server that never closes the connection, compared against a control run with the VPN off: all 20 of 20 idle connections were cut at the 75th second. I wrote a patch raising the limits to 512 sockets and 7200 seconds; when the same test was repeated, they all stayed open. The full story is on the blog: “Dropped TCP connections”.

Other measured decisions:

  • ICMP datagram sockets are kept outside the tunnel with protect(); the ping measurement doesn’t monitor its own traffic.
  • The connection owner is found with getConnectionOwnerUid — 59/59 resolved in testing.
  • Tunnel throughput was measured for MTU 1500 / 9000 / 16000.
  • How traffic is cut off when the service is killed with SIGKILL and SIGSTOP was tested.

Every assumption is recorded in KARARLAR.md together with its measurement (A1–A17).

Where I am now

I’m in the connection log phase; after that come tools to filter and export the log.