Skip to content

Windows UWP VPN plugin — first slice: native Windows build + C-ABI FFI + plugin skeleton #1

Open

Description

@tsuckow2

Windows UWP VPN plugin — first slice: native Windows build of the Rust core + C-ABI FFI + plugin skeleton

Context

Bonded is a multipath VPN (wifi + cellular bonding). The Rust core (crates/bonded-client: session, transports, peer sharing, grading, diagnostics) is platform-independent except for small Linux-gated pieces (crates/bonded-client/src/lib.rs lines ~9–52, 251, 2729–2772: TUN setup + pnet_datalink interface enumeration). The tun crate already knows Windows (wintun) and macOS (utun). The transports (QUIC, WSS, WireGuard via boringtun, NaiveTCP) are pure-Rust/tokio with no Android dependency.

What does NOT reuse, and is the work here:

  1. The FFI layer. crates/bonded-ffi (5,927 lines) is JNI throughout (JNI_OnLoad, Java_com_bonded_bonded_1app_*, jni 0.21) and is cfg(any(target_os = "android", test)) gated. A desktop client needs a new plain C-ABI surface over the same core (a bonded-ffi-desktop crate, or a cfg-gated C export module next to the JNI one). bonded_ffi_api_version is already extern "C" — the versioning precedent exists, the session API does not.
  2. The Dart native bridge / Flutter shell. The project is Android-only today (android/ + lib/, no windows/ runner). Generating the Windows runner is cheap (flutter create --platforms windows); making the app run on it is the per-service port in (1) plus desktop packaging. The Flutter UI is NOT the first slice — see below.

This issue's scope (first slice)

Work in small vertical slices that produce a runnable checkpoint. This issue is the first slice:

  1. Native Windows build of the Rust core. Get cargo build -p bonded-client (and its tests) passing on a Windows runner (x86_64-pc-windows-msvc). The Linux cross-compile attempt (x86_64-pc-windows-gnu) stopped at the C toolchain before any Rust code was type-checked (ring's build script needs x86_64-w64-mingw32-gcc), so the real porting surface (which Linux-gated modules need a Windows arm, which deps don't support the target) is still unmeasured. Measure it natively and fix what fails. The core must build with no Android dependency.
  2. C-ABI FFI surface. Design and implement the session-start / stop / status / diagnostics surface the desktop shells need, mirroring what the JNI layer exposes today. Decide whether it is a new crate (bonded-ffi-desktop) or a cfg-gated module in bonded-ffi, and record the decision in docs/design/implementation-plan.md under Key Implementation Decisions.
  3. Windows plugin skeleton. A C++/WinRT project that loads the core DLL through the new C ABI and implements the VPN plugin interfaces (Windows.Networking.Vpn) as stubs, packaged as MSIX. This proves packaging + capability declarations before any tunnel logic lands. The plugin runs brokered under UWP sandboxing: the Rust core must not assume a writable home directory or raw sockets outside the declared capabilities.

Out of scope for this issue: tunnel packet flow, the Flutter Windows UI, peer sharing on desktop, Store submission, and any server-side change.

Acceptance criteria

  • cargo build -p bonded-client and the bonded-client test suite pass on a Windows runner.
  • The C-ABI surface builds as a DLL and a minimal harness can start/stop a session through it (no server required for the smoke check, or document what the harness needs).
  • The plugin skeleton builds as MSIX and loads the core DLL (stub interfaces are acceptable for this slice).
  • docs/design/implementation-plan.md is updated: status, notes, blockers, and the FFI design decision.

Constraints

  • Do not expand scope beyond this slice without updating the plan.
  • The implementation plan (docs/design/implementation-plan.md) is the live checkpoint and MUST be updated during implementation.
  • A checkpoint is complete only if: the code builds, the tests for the changed area pass, the plan is updated, and the work can be resumed by another agent from the docs alone.
  • Do not use git stash (stashes are repo-global across linked worktrees).
  • Commits go out as MrBig tsuckow2@gmail.com.

Background reading

  • docs/design/desktop-clients-scope.md — the full desktop scope note (Windows UWP shape, macOS shapes, open questions).
  • docs/design/implementation-plan.md — the live checkpoint; read before starting.
  • docs/requirements/product-requirements.md, docs/requirements/platform-requirements.md.

Open questions (for the maintainer, not blockers)

  • Is a Store listing required, or is sideloaded MSIX fine? (Store review is the long pole; sideloading skips it.)
  • Does the desktop client need peer sharing on day one, or is a single-device tunnel the v1?
  • Is there a Windows 11 machine (or VM) available for testing, or does that need provisioning first?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions