Repository layout
Tetheron is one repository with two products, the Android app and the Linux
desktop software, and the protocol schemas they share
(ADR-0001). Directories, crates and
packages keep the name tether (see Names).
Top level
.
├── proto/ protobuf schemas, the single source for both sides
├── desktop/ Rust workspace: daemon, desktop app, CLI, packaging
├── android/ Gradle build: the Android app and the shell helper
├── docs/ this documentation (mdBook source)
├── .github/ CI workflows, issue and pull request templates
├── book.toml mdBook configuration, output goes to target/book/
├── README.md project overview
├── CHANGELOG.md release notes, Keep a Changelog format
├── CONTRIBUTING.md pointer to the contributor guide
├── CODE_OF_CONDUCT.md code of conduct
├── SECURITY.md how to report a vulnerability, threat model summary
├── NOTICE copyright notice and third-party credits
├── LICENSE GPL-3.0
└── logo.svg the project logo
proto/tether/v1/
The wire protocol, version 1. Rust types are generated by tether-proto,
Kotlin types by the Wire Gradle plugin. Behaviour is specified in the
wire protocol reference.
| File | Contents |
|---|---|
envelope.proto | Envelope: the frame of the control connection, a oneof over every message below except those of shell.proto |
common.proto | Hello, Ping, Pong, Disconnect, the UDP Beacon, StreamOpen and StreamPurpose for secondary connections, DeviceKind |
pairing.proto | PairRequest, PairResponse, PairConfirm, PairReject, Unpair |
device.proto | DeviceInfo, Battery |
notifications.proto | NotificationPosted, NotificationRemoved, NotificationActionRequest, NotificationDismiss |
blobs.proto | BlobRequest, Blob: small binary objects addressed by hash (icons, avatars, album art) |
messages.proto | SMS and MMS: conversations, messages, live events, sending, attachments |
contacts.proto | contact sync as vCard deltas |
media.proto | media sessions and commands, phone volume |
misc.proto | Do Not Disturb, RingPhone, Connectivity, Clipboard, ShareText |
files.proto | file offers in both directions, transfer progress and cancellation |
photos.proto | gallery queries, thumbnails, fetch, delete, change notices |
calls.proto | call state, call commands, call log, Bluetooth identity |
enhance.proto | enhanced tier, app side: AdbLink, AdbWifiState, AdbWifiRequest, the app list |
shell.proto | the separate protocol between the daemon and the shell helper (ShellEnvelope): handshake, mirroring, input, clipboard, grants, display power, app start, audio, camera |
desktop/
A Cargo workspace (desktop/Cargo.toml) with six crates under
desktop/crates/ and the packaging files under desktop/packaging/.
Cargo.lock is committed.
Crate dependencies
tether-proto generated types, no dependency on other crates
^
|-- tether-core protocol engine (library)
| ^
| |
|-- tetherd the daemon, uses tether-core and tether-proto
|
`-- tether-gtk the desktop app, uses tether-proto only
tether-distro no dependency on other crates, used by tetherd and tether-gtk
tether-cli no dependency on other crates
tether-gtk and tether-cli reach the daemon only through D-Bus
(ADR-0006). tether-gtk uses
tether-proto for the mirror stream, which it reads from the shell helper’s
video connection.
tether-proto
| Path | Contents |
|---|---|
build.rs | compiles the .proto files with protox and prost-build, from an explicit list of files |
src/lib.rs | module v1 (generated), PROTOCOL_VERSION, DEFAULT_PORT, ALPN, MDNS_SERVICE |
tether-distro
| Path | Contents |
|---|---|
src/lib.rs | family(): the distribution family (Debian, Fedora, Arch or other) from /etc/os-release. The package names and install commands that hints of the daemon and the app show for each family |
tether-core
A library with everything an endpoint needs below the user interface. It has no D-Bus interface.
| Path | Contents |
|---|---|
src/lib.rs | public exports, CAPABILITIES |
src/identity.rs | the device identity: a self-signed ECDSA P-256 certificate. The device id is the hash of its public key |
src/trust.rs | the persistent store of paired devices |
src/tls.rs | mutual TLS 1.3 with trust on first use |
src/framing.rs | length-prefixed Envelope framing |
src/session.rs | one authenticated connection: Hello, send and receive loop, keepalive, the capability each frame requires |
src/pairing.rs | short authentication string, QR proof, the tether://pair URI |
src/streams.rs | secondary connections for bulk data (ADR-0014) |
src/blobs.rs | cache of small blobs, addressed by hash |
src/device.rs | the device registry and the Event and PeerRequest types the daemon consumes |
src/paths.rs | XDG directories |
src/error.rs | the crate’s error type |
src/discovery/ | avahi.rs (mDNS through Avahi’s D-Bus API), beacon.rs (UDP beacon), mod.rs (merged events, manual addresses) |
src/core/mod.rs | Core: owns identity, trust, transport, discovery and the registry; dispatches received frames |
src/core/net.rs | listening, accepting, dialling |
src/core/pair_flow.rs | the pairing state machine |
src/core/notif_flow.rs | device information, battery, notifications, blobs |
src/core/feature_flow.rs | Milestone 2 frames and their send helpers, intentional disconnect |
src/core/call_flow.rs | calls, call log, Bluetooth identity |
src/core/enhance_flow.rs | enhanced tier frames and the app list |
src/core/state.rs | the state shared by the core’s tasks |
tests/ | integration tests between two in-process cores: pairing, QR, disconnect and hold, messages and contacts, streams, calls, enhanced tier |
examples/fake_phone.rs | a fake phone for developing against the real daemon |
tetherd
The daemon. Owns the connection to the phone and the D-Bus name
org.tether.Daemon on the session bus. Cargo features audio and webcam
(both default) pull in GStreamer.
| Path | Contents |
|---|---|
src/main.rs | start-up |
src/config.rs | config.toml |
src/db.rs | the SQLite cache per device (ADR-0013) |
src/dbus/mod.rs | the bridge from core events to D-Bus signals and property changes |
src/dbus/daemon.rs | interface org.tether.Daemon1 |
src/dbus/device.rs | interface org.tether.Device1 |
src/dbus/dicts.rs | builders for the a{sv} values of the D-Bus API |
src/notify.rs | phone notifications as desktop notifications, and the daemon’s own notifications |
src/battery.rs | the low-battery alert |
src/mpris.rs | one MPRIS player per phone with an active media session |
src/media_pause.rs | pauses desktop players during a call |
src/ringtone.rs | the desktop ringtone for incoming calls |
src/call_tracker.rs | the call state machine |
src/bluetooth.rs | BlueZ: adapter, guided pairing, hands-free connection |
src/pipewire.rs | PipeWire graph logic for call audio |
src/adb.rs | adb: the binary, the private server, a command runner that parses output, device tracking (ADR-0016) |
src/shell.rs | supervisor of the shell helper (ADR-0017) |
src/phone_audio.rs | playback of the phone’s audio through GStreamer |
src/webcam.rs | the camera pipeline into the v4l2loopback device (ADR-0019) |
src/webcam_setup.rs | state of v4l2loopback on the machine; runs the set-up script through pkexec |
src/features/mod.rs | Features, the per-device state, routing of core events to features |
src/features/messages.rs, contacts.rs, vcard.rs | message sync and sending; contact sync; the vCard parser |
src/features/media.rs | media sessions and phone volume |
src/features/misc.rs | Do Not Disturb, ring, connectivity, clipboard, share |
src/features/files.rs, photos.rs | file transfer; gallery index, thumbnails, originals, deletion |
src/features/calls.rs, calllog.rs, bt.rs, audio.rs | calls; call log; Bluetooth glue; call audio routing and echo cancellation |
src/features/enhance.rs | the enhanced tier: adb servers, Wireless debugging pairing, linking, the state machine per device |
src/features/apps.rs, phone_audio.rs, webcam.rs | the app list; the phone audio switch; the webcam switch and the virtual camera |
tether-cli
| Path | Contents |
|---|---|
src/main.rs | the clap command tree and every command |
src/proxies.rs | zbus proxies for org.tether.Daemon1 and org.tether.Device1 |
tether-gtk
The desktop app. The crate is tether-gtk, the binary is tether. Cargo
features: tray and mirror (default), mock (the in-process fake daemon,
tether --mock).
| Path | Contents |
|---|---|
src/main.rs, application.rs, window.rs | entry point; the application object; the main window |
src/backend/mod.rs | the Backend trait and the typed data the interface uses |
src/backend/dbus.rs | the Backend implementation over D-Bus |
src/backend/mock.rs, mock/, mock_data.rs | the fake daemon and its generated data |
src/backend/calls.rs, enhance.rs, apps.rs, webcam.rs | typed forms of the Milestone 3 and 4 parts of the D-Bus API |
src/models/ | GObject models the widgets bind to |
src/widgets/ | the pages and rows: overview, notifications, messages, photos, files, calls, apps, webcam group |
src/dialogs/ | pairing QR, add address, preferences, per-app settings, file offer, image viewer, Bluetooth pairing, webcam set-up |
src/calls/ | incoming-call banner and in-call window |
src/enhance/ | enhanced tier status row and set-up wizard |
src/mirror/ | the mirror window: stream framing, decode pipeline, input mapping (ADR-0018) |
src/apps/ | app windows and “pin to desktop” |
src/clipboard.rs, tray.rs, config.rs, util.rs | clipboard sync; tray icon; gtk.toml and autostart; helpers |
data/ | style sheet, GResource manifest, desktop entry, AppStream metainfo, icons, sample streams for the fake daemon (data/mock/) |
build.rs | compiles the GResource bundle |
desktop/packaging/
Everything that turns the workspace into the single Debian package tether
and into the tarball for other distributions
(ADR-0008). The package metadata is in
[package.metadata.deb] at the end of desktop/crates/tetherd/Cargo.toml.
| Path | Contents |
|---|---|
build-deb.sh | builds the release binaries and the .deb |
build-tarball.sh | builds the release binaries and tether-<version>-linux-<arch>.tar.gz |
tarball/install.sh | the install script inside the tarball: dependency check, install, uninstall |
tarball/README.md | the short instructions inside the tarball |
debian/postinst, prerm, postrm | maintainer scripts |
systemd/tetherd.service | the systemd user unit |
dbus/org.tether.Daemon.service | session bus activation |
ufw/tether | the ufw application profile Tether (port 7360, TCP and UDP) |
webcam/tether-webcam-setup | root helper that creates the v4l2loopback device |
webcam/org.tether.webcam-setup.policy | the polkit action for that helper |
wireplumber/ | optional WirePlumber drop-ins for call audio, installed as documentation only |
README.md | what is installed where |
android/
A Gradle build (settings.gradle.kts, wrapper included) with two modules.
Dependency versions are in gradle/libs.versions.toml.
| Path | Contents |
|---|---|
app/ | the application module: the Android app and the shell helper in one APK |
hidden-api/ | a compile-only Java stub of one hidden framework interface (android.content.IContentProvider), not packaged |
tools/helper_test.py | drives the shell helper on an attached phone without the daemon (Python 3, standard library only) |
android/app/src/main/java/org/tether/android/
The app. ADR-0005 describes its background model.
| Package | Contents |
|---|---|
| (root) | AppGraph (manual dependency injection), TetherApp (the Application) |
core | logging (TLog), byte helpers, Permissions, SettingsRepository, TrustedDesktopStore |
core.identity | the identity key in AndroidKeyStore and its certificate |
transport | Framing, Connection, Session, TetherEngine, the Feature interface, Protocol (constants and capabilities), HoldSet, StreamManager |
transport.tls | the TLS context and the trust manager |
pairing | Sas, QrPairingUri, PairingManager |
discovery | mDNS (NsdDiscovery), UDP beacon, the merged repository |
service | TetherService (foreground service), BootReceiver, NetworkMonitor, notification channels |
features.battery, features.deviceinfo | battery and device information |
features.notifications | the notification listener, the bridge with filtering, the wire mapping |
features.blobs | blob store and feature |
features.messages | SMS and MMS repository, diffing, senders, the MMS PDU encoder |
features.contacts | contacts repository, vCard writer, delta sync |
features.media | media sessions and volume |
features.misc | Do Not Disturb, ring, connectivity, clipboard (with the tile and the send activity) |
features.files, features.share | file transfer; the share target |
features.photos | MediaStore repository, the photos feature, the delete activity |
features.calls | call state and commands, the in-call service, call log, caller lookup |
features.bluetooth | Bluetooth identity and connect requests |
features.apps | the list of launchable apps |
enhance | the app side of the enhanced tier |
ui | Compose screens: MainActivity, navigation, onboarding, home, settings, qr, components, theme |
android/app/src/main/java/org/tether/shell/
The shell helper of the enhanced tier
(ADR-0017). It is in the same APK and runs
outside the app process: the daemon starts it through adb with
app_process, and it speaks shell.proto.
| File | Contents |
|---|---|
Main.kt | entry point, ability probes, the control channel |
ShellProtocol.kt, Geometry.kt | pure protocol and geometry code |
FakeContext.kt, Workarounds.kt, Hidden.kt | the system context as the shell package; access to hidden APIs |
MirrorSession.kt, CaptureTarget.kt | the H.264 encoder on the main display or a virtual display |
InputInjector.kt | touch, key, scroll and text input |
AudioCapture.kt, OpusConfig.kt | phone audio capture to Opus |
CameraCapture.kt, CameraSelect.kt | camera capture for the webcam |
ClipboardBridge.kt | clipboard read, write and watch |
Grants.kt, GrantTable.kt, Exec.kt | the fixed grant commands |
PanelPower.kt, CleanUp.kt | screen off while mirroring, and its restore if the helper dies |
ShellLog.kt | logging to stderr |
Other parts of the module: android/app/src/main/AndroidManifest.xml,
resources under android/app/src/main/res/, unit tests under
android/app/src/test/java/ (same packages), R8 rules in
android/app/proguard-rules.pro.
.github/
| Path | Contents |
|---|---|
workflows/desktop.yml | fmt, clippy and tests on every change to desktop/ or proto/. Builds the .deb and the tarball on a v* tag |
workflows/android.yml | unit tests and debug APK on every change to android/ or proto/. Builds the signed release APK on a v* tag |
workflows/docs.yml | checks links, builds this site, publishes it from main |
ISSUE_TEMPLATE/ | bug_report.yml, feature_request.yml, config.yml |
PULL_REQUEST_TEMPLATE.md | the pull request checklist |
docs/
The source of this site.
| Path | Contents |
|---|---|
introduction.md, SUMMARY.md | the landing page and the table of contents. A page that SUMMARY.md does not list is not built |
tutorials/, how-to/, reference/, explanation/ | the user guide, by kind of page |
adr/ | architecture decision records and their template |
contributing/ | this guide. checklists/ holds the device verification checklists per milestone |
roadmap.md | plan and status of every milestone |
notes/ | engineering notes: research reports and session records, not updated after they are written |
images/ | screenshots (desktop/, android/) |
tools/ | check_links.py, the link checker CI runs, and screenshots.sh, which takes the desktop screenshots |