ToTS carries encrypted L3 VPN packets through VK Calls TURN/UDP, the direct WebRTC-side ingress, SaluteJazz RTP media, Yandex Docs WebSocket, Mail.ru Docs WebSocket, Cups.online Centrifugo rooms, or MAX Calls TURN/WebRTC signaling. The client runs an independent worker pool, keeps latency-sensitive small UDP pinned to one healthy worker, stripes bulk TCP/large UDP across workers in bounded flowlets, and can rebuild a failed worker on the preferred provider or a configured fallback. Windows IPv4 Internet egress through both providers has been verified against three IP services, with clean timed exits and full-tunnel route removal. The same Jazz config also passed a reconnect probe. See test results.
tots-core: packet protocol, encryption, fragmentation, probing and transport abstractions.tots-client: shared Windows/Linux CLI client library and desktop executable with managed desktop TUN/routing support.tots-openwrt: dedicated OpenWrt executable entrypoint, sharing the exacttots-clientdataplane/provider implementation and adding config-file/status-file service integration.tots-android: Android CLI worker binary withVpnServiceTUN-fd support; release packaging renames the executable tolibtots.sofor APKjniLibsdelivery.tots-ios: C ABI/static library for a NetworkExtension host.tots-server: Linux TUN, UDP ingress, SQLite and the local management API.Providers/: native VK, Jazz,ya-docs,mail-docs,cups, and MAX adapters. MAX call setup uses KometTeam's permissively licensedkolibri-netprotocol/signaling crate; no Komet GPL application code is copied. No OpenFlux executable/sidecar is used. The bundled MIT-licensedjazz-sessionlibrary remains a path dependency excluded from workspace membership.
The management API defaults to 127.0.0.1:9080. Create a configuration with POST /v1/configs, using a private JSON request file:
curl -sS http://127.0.0.1:9080/v1/configs \
-H 'content-type: application/json' \
--data-binary @request.private.jsonThe request contains provider (the preferred provider), provider_data, a password of at least eight bytes, device_id (UUID), and optional valid_days (default 30). provider_data is now keyed by provider so one config can contain fallbacks, for example:
{
"provider": "vk",
"provider_data": {
"vk": {"vk_call_links": ["https://vk.ru/call/join/..."]},
"jazz": {},
"max": {"access_token": "<MAX access_token>"}
}
}vk accepts vk_call_links or vk_token; optional ice_servers supplements bootstrap. VK bootstrap generations remain paced by three seconds to avoid anonymous API flood control, but one generation may lease credentials to a cohort of up to seven workers. Those workers still create independent UDP sockets, TURN allocations and encrypted sessions. Worker setup/path probing is bounded to seven concurrent workers and candidate paths inside each worker are probed in parallel. Multiple call links rotate between bootstrap generations. Repeated flood-control failures impose a shared 30/60/120/240/300-second cooldown.
For parallel Jazz workers, request "jazz": {"worker_count": 30} and run the returned URI with --n 30. The count is 1–50, default 1. The server provisions independent rooms and bridges, with four concurrent setup operations, and persists an ordered secret worker_rooms array. Each worker uses its own room so media is not broadcast to the other workers. The first room's invite and connector_url remain in the legacy fields. An optional join_link supplies room zero; further rooms are created independently. Existing one-room configs support one Jazz worker and must be provisioned again for a larger pool. This also applies when Jazz is configured as a fallback.
Jazz also accepts the diagnostic media_carrier option: audio (default), audio-wallclock (same audio transport with timestamps derived from elapsed time), or vp8-experimental (opaque video RTP envelope). The API applies it to both server bridges and client worker rooms. The video variant adds VP8 framing metadata for forwarding tests; it is not a VP8 video encoder. Check the throughput report for physical-provider evidence before choosing an experimental carrier.
For Yandex Telemost, set "provider": "telemost" and "provider_data": {"telemost": {"join_link": "https://telemost.yandex.ru/j/<meeting-id>"}} when creating a config. Use an existing meeting that admits guests. Links on telemost.yandex.com and telemost.360.yandex.ru are normalized for the guest API. ToTS uses Telemost signalling and VP8 RTP adapted from olcRTC. Each desktop or Android client shares one media session across its independent encrypted ToTS workers.
tots-client --config "$TOTS_URI" --n 30 --relay-only --probe-only --no-egress-pinningNative document/room providers use the same worker/fallback machinery:
{
"provider": "vk",
"provider_data": {
"vk": {"vk_call_links": ["https://vk.ru/call/join/..."]},
"ya-docs": {"urls": ["https://docs.yandex.ru/docs/view?...", "https://docs.yandex.ru/docs/view?..."]},
"mail-docs": {"urls": ["AbCdEfGh1/IjKlMnOp2"]},
"cups": {"worker_count": 20}
}
}ya-docs accepts url or urls; optional cookies is a JSON object of cookie name/value pairs. The provider follows Yandex document redirects and solves the showcaptchafast proof-of-work challenge in-process. A browser-only SmartCaptcha/login still needs reusable cookies. mail-docs accepts a bare public weblink (AbCdEfGh1/IjKlMnOp2) or a full https://cloud.mail.ru/public/... link, also as url/urls. For both document carriers, workers select URLs round-robin; providing multiple URLs avoids concentrating every worker in one collaborative document.
cups accepts {"worker_count": N} in the server API. The server provisions N independent Cups.online rooms, stores them in worker_rooms, and starts one native bridge per room. As with Jazz, if Cups is available as a fallback, provision worker_count >= --n so any failed slot can move to a non-conflicting room. Existing room_id/worker_rooms can also be reused on server restart.
max accepts {"access_token": "..."}. For a MAX-only device, set "provider": "max" and "provider_data": {"max": {"access_token": "..."}}. Each MAX worker logs in with that token, attempts to create a randomly named private group, starts an audio call to the same account to obtain call credentials, attempts to attach that call to the group, then reads ICE/TURN data from the call's WebRTC signaling handshake. No contacts are invited. MAX may reject attaching a self-only group call; in that case the transport still uses the call's TURN credentials and reports group_call_attached: false. MAX is a client-side provider, not a server-native bridge. It uses the Komet Android-style binary TCP/TLS session; supply an access_token accepted by the MAX mobile protocol (a web-only scoped token may require a separate WebSocket login mode).
If TOTS_ADMIN_TOKEN is configured, include its bearer authorization header. Store the returned tots:// URI privately; it contains credentials. The MAX access_token is part of provider_data and is stored in the server config database so clients can restore the provider after restart; protect the DB and treat the URI as a bearer secret. The database preserves the invite; server restart rejoins active rooms. Revoke, expiry and provider replacement close the old room bridge. Revoke a device with DELETE /v1/configs/{device_id}. The server bridges Jazz/Yandex Docs/Mail.ru Docs/Cups packets into its existing authenticated UDP/TUN dataplane.
The server uses 10.77.0.0/16 for virtual addresses. scripts/setup-network.sh configures Linux forwarding/NAT; set TOTS_UPLINK if automatic uplink detection is unsuitable. Keep the management API on loopback unless remote access is explicitly configured.
Extract the delivery archive and keep wintun.dll beside the Windows tots-client.exe. Run TUN operations as Administrator. Windows now creates Wintun immediately, then waits only for the first healthy worker before switching system routes. ToTS installs protected /32 transport routes, both IPv4 /1 routes and an IPv4 default route through Wintun. Additional provider endpoints discovered later are added to the underlay escape-route set. It snapshots/restores DNS on the physical and TUN interfaces, and blocks IPv6 Internet egress with Windows Firewall's Internet6 address keyword while the IPv4-only tunnel is active so IPv6-capable applications cannot bypass it.
.\tots-client.exe --config 'tots://...' --n 10 --relay-onlyUse --no-tun-default-route only when you intentionally want to create the TUN without changing system-wide routes. --tun-default-route remains accepted for backwards compatibility. If the process is force-killed, remove any leftover ToTS IPv6 firewall rule from an elevated PowerShell window:
Get-NetFirewallRule -Group 'ToTS Full Tunnel' -ErrorAction SilentlyContinue | Remove-NetFirewallRuleTo request a preferred startup split across configured providers, add --workers_percent. Values may be JSON strings or integers and must total 100:
.\tots-client.exe --config 'tots://...' --n 20 --workers_percent '{"vk":"35","jazz":"20","ya-docs":"15","mail-docs":"10","cups":"10","max":"10"}' --relay-only --tun-default-routeThe split only controls each slot's preferred provider. Every slot still keeps the other configured providers in its fallback order, so the actual workers_vk, workers_jazz, workers_ya_docs, workers_mail_docs, workers_cups, and workers_max counts can move away from the requested percentages after failures. Omitting --workers_percent preserves the existing primary-provider-first behavior. If Jazz is present as a fallback, provision at least worker_count = --n, because any slot may eventually fail over to Jazz and must have a non-conflicting room.
Useful options:
| Option | Behavior |
|---|---|
--config URI |
Decode one server-issued tots:// config. |
--n N |
Run N independent transport workers (1..256). |
--workers_percent JSON |
Preferred worker split across configured providers, including telemost. Percentages must sum to 100. |
--mtu N |
Override the IPv4 TUN MTU, including with --config; valid range 576..1400. |
--relay-only |
Exclude the direct VPS/WebRTC-side UDP path; use provider relay/native transport. |
--probe-only |
Wait for every requested encrypted worker without opening TUN or installing routes. |
--tun-default-route |
Explicitly enable Windows full-tunnel routing (already enabled by default). |
--no-tun-default-route |
Opt out of Windows full-tunnel routing; leave system routes unchanged. |
--run-for-seconds N |
End the connected TUN run gracefully after a bounded interval. |
--egress-interface NAME |
Force the physical adapter (eth0, wan, en0, ...) that carries ToTS transport, provider HTTP/WebSocket signalling and WebRTC media. Default: detected from the IPv4 default route. |
--no-egress-pinning |
Disable physical-adapter pinning and let ToTS sockets follow the system route table. |
For example, add --run-for-seconds 75 for a bounded test. Before Wintun is opened, the client snapshots the active physical IPv4 underlay. The route guard then pins the VPS and provider endpoint IPv4 addresses to that captured interface/gateway before installing the two TUN /1 routes, so later Windows connectivity/metric changes cannot make ToTS transport packets recurse through tots0. Known virtual/VPN adapters are excluded from automatic underlay selection. If Windows or a driver still reports the wrong adapter, set TOTS_PHYSICAL_IFINDEX to the desired Wi-Fi/Ethernet interface index before launching the client:
Get-NetRoute -AddressFamily IPv4 -DestinationPrefix '0.0.0.0/0' |
Format-Table InterfaceIndex,NextHop,RouteMetric
$env:TOTS_PHYSICAL_IFINDEX = '12'
.\tots-client.exe --config 'tots://...' --n 20 --relay-only --tun-default-routeThe forced index is validated to be Up, connected, and to own a usable active IPv4 default route; ToTS refuses to use the TUN's own interface index as its underlay. On normal exit the guard removes only routes it created and restores the original DNS servers on both affected interfaces. Cleanup after force-killing the process is not guaranteed; remove the leftover firewall rule with the command above if needed.
The client waits only for the first healthy worker before installing Windows full-tunnel routes; it does not wait for every selected provider group or the complete worker pool. Remaining workers continue connecting in the background. Startup/reconnect connection work is capped at seven workers concurrently rather than serially staggering every worker. Any request that configures Jazz or Cups (primary or fallback) and exceeds its provisioned room count fails immediately.
The current dataplane is IPv4-only. On Windows, ToTS blocks IPv6 egress with a temporary Windows Defender Firewall rule for the lifetime of the full tunnel and removes it during normal shutdown. DNS on the physical adapter is changed to public IPv4 resolvers while connected and restored on shutdown. Automatic full-tunnel routing is currently Windows-only. Android uses the separate tots-android binary below; iOS requires a NetworkExtension host.
tots-android carries the same worker/provider dataplane as tots-client: --n, --workers_percent, relay-only mode, provider fallback/recovery, flowlet scheduling and five-second traffic/worker telemetry are preserved. Android TUN ownership is intentionally different: the APK's VpnService creates/configures the interface, and the native binary receives the descriptor over an abstract local socket with SCM_RIGHTS (--tun-fd-socket).
The host VpnService must configure the same virtual IPv4 address and MTU contained in the tots:// configuration. Prefer passing the live TUN fd over an abstract local socket using SCM_RIGHTS and --tun-fd-socket; Android ProcessBuilder does not reliably preserve arbitrary descriptors even when FD_CLOEXEC is cleared. The legacy --tun-fd form remains for launchers that guarantee descriptor inheritance. The native client owns the received fd, switches it to non-blocking mode, and uses epoll readiness so EAGAIN is not treated as process-fatal. The Android host owns route/DNS/app-selection policy and must exclude its own package/UID or otherwise protect provider sockets from routing back into its TUN.
Example process arguments inside an APK host:
libtots.so --config tots://... --n 20 --workers_percent {"vk":50,"jazz":50} --relay-only --tun-fd-socket lalune-tots-random
libtots.so is deliberately not a Rust cdylib: it is the normal PIE executable produced from tots-android, renamed after linking so Android packaging can place it under jniLibs/<abi>/libtots.so. The package build.rs has two modes. Under Cargo it stamps the Android ELF soname; when compiled/run standalone by scripts/build-android.sh, the same build.rs invokes the real Android Cargo build and moves the finished executable to dist/android/<abi>/libtots.so.
Build any supported Android ABI locally with an Android NDK installed:
export ANDROID_NDK_HOME=/path/to/android-ndk
./scripts/build-android.sh aarch64-linux-android
./scripts/build-android.sh armv7-linux-androideabi
./scripts/build-android.sh x86_64-linux-androidThe minimum/default Android API level is 24 and can be overridden with ANDROID_API to a newer level. API 23 is not supported because the WebRTC networking stack uses getifaddrs/freeifaddrs, which Android exposes from API 24. The build helper also understands i686-linux-android for local legacy builds. GitHub CI/Release build the three APK ABIs arm64-v8a, armeabi-v7a, and x86_64 in parallel and package them together under jniLibs/<abi>/libtots.so.
Normal Android startup launches worker supervisors immediately and opens TUN without waiting for every worker health probe; the first outbound packet waits asynchronously for any worker to become ready. --probe-only retains the explicit full-pool readiness check. For a probe without consuming a TUN fd:
libtots.so --config tots://... --n 20 --relay-only --probe-only
OpenWrt is a dedicated binary build of the shared ToTS client, not a second
provider implementation. The tots-openwrt crate reuses tots-client and
produces a standalone tots-openwrt executable for musl-based router targets.
It can read a private URI from a file and atomically publish status/traffic
counters for a router manager:
Install Zig 0.13.x, Rust stable and cargo-zigbuild first:
cargo install cargo-zigbuild --locked
./scripts/build-openwrt.sh aarch64
./scripts/build-openwrt.sh x86_64
./scripts/build-openwrt.sh armv7GitHub Release publishes tots-openwrt-aarch64.tar.gz,
tots-openwrt-x86_64.tar.gz, and tots-openwrt-armv7.tar.gz. Each archive
contains /usr/bin/tots-openwrt, an optional procd init script, and a sample
UCI config. The init script reads /etc/tots/config.uri, creates tots0,
and writes /var/run/tots/status.json. The binary owns the TUN device and
transport workers; it deliberately does not install firewall/NAT or LAN policy
routes. Router-wide policy routing remains the responsibility of the router
manager (LaLune in this integration).
Every socket ToTS opens for itself — direct VPS UDP, TURN/UDP allocations, provider HTTP/REST, provider WebSocket signalling and WebRTC/ICE media — is pinned to a real hardware adapter so it never follows the full-tunnel default route back into the ToTS TUN device. This is what keeps the transport alive after the tunnel is up: without it, a reconnect would have to reach the provider through the tunnel that is currently down.
The adapter is resolved once per process:
--egress-interface NAMEorTOTS_EGRESS_INTERFACE,- otherwise the IPv4 default route is inspected and known virtual adapters
(
tun*,tots*,wg*,utun*,docker*,veth*,br-*,tailscale*,WireGuard,Wintun, ...) are excluded.
Pinning uses SO_BINDTODEVICE on Linux/Android/Fuchsia (needs CAP_NET_RAW or
root), IP_BOUND_IF with TOTS_EGRESS_INTERFACE_INDEX on the macOS family, and
adapter-address binding plus the existing underlay host routes on Windows.
TOTS_EGRESS_ADDRESS supplies a local IPv4 when it cannot be detected, and
TOTS_EGRESS_DISABLE=1 turns pinning off. Pinning failure is reported once and is
never fatal: an unprivileged process (for example an Android app that protects
sockets through VpnService) keeps working unpinned.
# Force Wi-Fi on a Linux desktop
tots-client --config 'tots://...' --egress-interface wlp60s0
# Router: WAN device on OpenWrt
tots-openwrt --config-file /etc/tots/config.uri --egress-interface wanVK uses TURN/UDP allocation, authentication, permissions and channel binding. Its relay requires a 12-byte RTP envelope around each encrypted ToTS datagram. The server recognizes that envelope while continuing to accept raw ToTS datagrams for the direct/legacy path.
Jazz uses actual WebSocket signalling and WebRTC RTP media through the restored jazz-session library. preconnect_call performs HTTP provisioning on the VPS; join_preconnected lets the PC connect directly to Jazz WSS/media endpoints. SSH is used for setup or private configuration retrieval, never for user traffic. Public media keepalives establish the remote track and are filtered before ToTS packet processing.
The Jazz session publishes audio with muted:false and explicitly subscribes to remote unmuted AUDIO tracks, deduplicating updates and unsubscribing when tracks are muted. Readiness is the negotiated media state; TURN credentials are no longer required for a session to become ready, and an unusable ICE entry from the signalling server is skipped instead of aborting the join. A rotated rtc:config, an unknown/unsupported ICE candidate, or a stale connector_url no longer tears down or permanently blocks a worker. Encrypted path probes retry every 500 ms with fresh sequence numbers; VK keeps a three-second deadline and native providers get a ten-second one, because a media join legitimately needs a real RTP round trip.
ToTS frames use XChaCha20-Poly1305 with an Argon2id-derived key, authenticated envelope metadata and replay protection. Each worker has its own session and sequence space; workers reuse the device key without repeating Argon2. Data frames receive their sequence number immediately before encrypted transmission. The replay window remains 128 packets. ACK-range feedback is delayed for at most about 2 ms and batched up to 32 received packet IDs per datagram, reducing control traffic and transport sends without changing authenticated packet numbering.
TCP/UDP IP traffic uses best-effort datagram forwarding, relying on the inner transport's congestion control rather than adding a second ACK window, pacer or retransmission layer. Bounded queues and socket backpressure still apply. Reliable control traffic retains congestion control, burst pacing, loss detection and bounded recovery. Best-effort ACK diagnostics retain at most 512 payload-free samples per worker.
Bulk traffic moves between workers at roughly 16 KiB flowlet boundaries. Small UDP (up to 300-byte IP packets) stays sticky unless its short-window load rises above about 75% of one estimated allocation, at which point it is temporarily treated as bulk. Worker selection uses an adaptive token/deficit weight of about 247 kB/s (~2 Mbit/s) per allocation; this is a balancing estimate rather than a hard rate cap. The server receive hot path uses a larger bounded TUN ingress queue and no longer awaits one TUN enqueue plus one ACK network send per incoming IP packet; ACK transmission is handled by a separate per-session batcher. TURN paths also reuse their receive/send packet buffers instead of allocating a ~65 KiB receive Vec and multiple transmit Vecs per datagram. These changes follow the same hot-path separation/buffer-reuse principles as MRTT without importing its source code.
Every worker owns a distinct authenticated session_id, so workers from one device cannot overwrite each other on the server. A session must also survive long runs: TURN allocation maintenance is driven by a dedicated keepalive task as well as by the receive loop, the client receive path never blocks on downstream queues, worker restarts are rate-limited and based on an aged RTT baseline, and the server retries transient TUN and database errors instead of silently dropping every session of a device. If a path dies, the same SessionEngine/sequence space is retained while the worker re-probes direct/WebRTC-side and TURN candidates; after repeated preferred-provider failures it tries configured fallback providers. This gives authenticated 0-RTT-like path resumption without importing QUIC wire format. A five-second status line reports TUN MB, healthy/target worker counts, per-provider worker split and the approximate aggregate VK scheduling capacity. TURN/TCP and TURN/TLS are not implemented.
This source tree contains no private configuration or credentials. GitHub Actions automatically builds the Linux server, Linux and Windows clients, Android arm64-v8a/armeabi-v7a/x86_64 payloads, and OpenWrt aarch64/x86_64/armv7 musl binaries. The macOS client builds only when you manually run the CI or Release workflow. Release publication can proceed without the macOS archive. Local builds use stable Rust. This revision was tested with Rust 1.99.1; workspace/Jazz minimum-version metadata is 1.89. The workspace lockfile predates the added native WebSocket/cookie dependencies in this snapshot. Android's standalone builder therefore lets Cargo refresh the lock during the build. Jazz still pins webrtc-ice = 0.17.2 explicitly, so refreshing the lock cannot silently move that relay-sensitive dependency to 0.17.3. See PROJECT_STATUS.md and docs/THROUGHPUT-RESULTS.md for measured validation and remaining limitations.
cargo test --workspace
cargo test --manifest-path Providers/jazz-session/Cargo.toml --locked
cargo build --workspace --releaseDistribute the built Windows executable with its matching official AMD64 wintun.dll, and include LICENSE, NOTICE and the Jazz MIT license. The Android release archive contains jniLibs/arm64-v8a/libtots.so, jniLibs/armeabi-v7a/libtots.so, and jniLibs/x86_64/libtots.so; each is an executable PIE despite the .so filename. The Linux server package also needs the systemd unit and network setup script. Preserve /var/lib/tots/tots.db and /etc/tots/server.env when upgrading. Archive delivery does not require a pull request or published release.
AGENT.MD describes architecture and ownership; PROJECT_STATUS.md separates implementation from verified behavior. ToTS is a reference implementation and has not received an independent security audit.
ToTS - Powered by LaLune Team