דלגו לתוכן

Architecture overview

תוכן זה אינו זמין עדיין בשפה שלך.

Ferry is one Rust core shared by both sides, with a thin platform layer on each: Kotlin on Android, a Windows service and a Tauri window on the computer.

flowchart LR
  subgraph Windows["Computer (Windows 10/11)"]
    direction TB
    win["Window (Tauri 2)<br/>runs as the user"]
    svc["Service (LocalSystem)<br/>Wi-Fi, adapter, routes, DNS"]
    pc["ferry-pcstack<br/>smoltcp over Wintun"]
    win -- "verified named pipe" --> svc
    svc --- pc
  end
  subgraph Android["Phone (Android 10+)"]
    direction TB
    ui_a["Kotlin app<br/>UI, foreground service, Wi-Fi Direct group"]
    core_p["ferry-phone (Rust, via JNI)<br/>Ferry Link server, port 1082"]
    socks["Opt-in SOCKS5, port 1083<br/>for devices without a client"]
    ui_a --- core_p
    core_p --- socks
  end
  Windows == "Ferry Link<br/>Noise over TCP<br/>Wi-Fi Direct" ==> Android
Crate Role
ferry-link The protocol: frames, multiplexing, flow control, Noise handshakes. The same code on both sides
ferry-phone The server: opens the real connections, forwards DNS, answers ping, reports status
ferry-android JNI glue that loads the server into the Android app
ferry-pcstack A user-space TCP/IP stack (smoltcp) that turns captured packets into link streams
  • A foreground service keeps sharing alive with the screen off, with wake and Wi-Fi low-latency locks.
  • A Wi-Fi Direct group with its own name and WPA2 password. Windows sees an ordinary access point. The group prefers the channel of the phone’s own upstream Wi-Fi, then 5 GHz.
  • Ferry Link listens only on the group’s interface, so it is unreachable from mobile data or any other network.

One executable with two roles, the same split WireGuard and Tailscale use:

  • The service owns everything that changes the network: the Wi-Fi profile, a Wintun adapter, the routes, and a DNS policy rule. It recovers from a crash by undoing all of them on the next start.
  • The window runs with the user’s rights. It sends only requests like connect, pair and settings, never paths, routes or commands, and it checks that the pipe really belongs to the registered service before it says anything.
  • Routes 0.0.0.0/1 and 128.0.0.0/1 (minus the phone’s subnet), and ::/1 and 8000::/1, point at the adapter. They beat the default route without replacing it.
  • One DNS policy rule sends every name to the tunnel, where the stack forwards real queries to the phone. Other adapters’ resolvers are never asked. No fake IPs.
  • Fragmented packets are reassembled on the way in and large datagrams fragmented on the way out, so large DNS answers work.