# eljaja/bibavpn architecture

> Architecture diagram of the GitHub repository eljaja/bibavpn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eljaja/bibavpn
- Repository: https://github.com/eljaja/bibavpn

## Overview

BibaVPN is a self-hosted Rust proxy tunnel with a shared desktop/Android app. A user configures a profile or imports an encrypted invitation, then connects through local SOCKS5 or HTTP CONNECT endpoints; the client carries traffic over TLS and WebSocket to a user-operated server and onward to the internet. The app also exposes platform VPN and split-tunnel settings. The README documents the end-to-end workflow and major capabilities; source excerpts show selected UI and TLS-profile details, but most runtime internals were not sampled, so undocumented links are omitted.

Main entry points: [`bibavpn/src/local_client.rs`](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/local_client.rs) (Local proxy client), [`apps/bibavpn-desktop/ui/src/App.jsx`](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/App.jsx) (App interface), [`bibavpn/src/ws_bridge.rs`](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/ws_bridge.rs) (WebSocket bridge), [`bibavpn/src/bin/server.rs`](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/bin/server.rs) (VPN server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Client app"]
  node_ui["App interface<br/>[App.jsx]"]
  node_profiles["Profiles and settings<br/>[SettingsScreen.jsx]"]
  node_app_types["UI localization and types<br/>[i18n.js]"]
  node_tauri["Desktop backend<br/>[lib.rs]"]
  node_android_vpn["Android VPN service<br/>[BibaVpnService.kt]"]
  node_ios_tunnel["iOS tunnel extension"]
  node_ffi["Native FFI<br/>[lib.rs]"]
  node_jni["Android JNI<br/>[lib.rs]"]
end

subgraph group_client["Client runtime"]
  node_local_proxy["Local proxy client<br/>[local_client.rs]"]
  node_socks["SOCKS5 and HTTP CONNECT<br/>[socks5.rs]"]
  node_invite["Encrypted invitations<br/>[invite_uri.rs]"]
  node_policy["TLS profile policy<br/>[client_policy.rs]"]
end

subgraph group_wire["Tunnel protocol"]
  node_tls["TLS profiles<br/>[tls_util.rs]"]
  node_stealth["Traffic shaping<br/>[stealth_v12.rs]"]
  node_crypto["Encrypted frames<br/>[crypto_layer.rs]"]
  node_frame["Frame and padding<br/>[frame.rs]"]
  node_tcp_mux["TCP multiplexing<br/>[tcp_mux.rs]"]
  node_udp_mux["UDP relay<br/>[udp_mux.rs]"]
  node_websocket["WebSocket bridge<br/>[ws_bridge.rs]"]
  node_biba["ClientHello profiles<br/>[parrot.rs]"]
end

subgraph group_server["Server runtime"]
  node_camouflage["Camouflage site<br/>[camouflage.rs]"]
  node_server["VPN server<br/>[server.rs]"]
end

node_user(("User and apps"))
node_internet(("Internet destinations"))

node_user -->|"configures and connects"| node_ui
node_ui -->|"renders"| node_profiles
node_ui -->|"uses localization"| node_app_types
node_ui -->|"invokes commands"| node_tauri
node_profiles -->|"invokes package picker"| node_tauri
node_tauri -.->|"starts client"| node_local_proxy
node_android_vpn -->|"calls native client"| node_jni
node_jni -.->|"wraps shared client"| node_local_proxy
node_ffi -.->|"exposes client"| node_local_proxy
node_ios_tunnel -.->|"forwards tunnel"| node_local_proxy
node_user -->|"sends proxy traffic"| node_socks
node_local_proxy -->|"accepts proxy requests"| node_socks
node_local_proxy -->|"imports invitation"| node_invite
node_local_proxy -->|"resolves TLS settings"| node_policy
node_policy -->|"selects profile"| node_tls
node_tls -.->|"uses ClientHello profiles"| node_biba
node_local_proxy -->|"opens tunnel sessions"| node_websocket
node_websocket -->|"carries multiplexed streams"| node_tcp_mux
node_websocket -->|"carries UDP session"| node_udp_mux
node_local_proxy -->|"encrypts tunnel traffic"| node_crypto
node_crypto -->|"frames and pads traffic"| node_frame
node_local_proxy -->|"applies traffic profiles"| node_stealth
node_websocket -->|"connects over TLS"| node_server
node_server -->|"serves camouflage site"| node_camouflage
node_server -->|"routes tunnel traffic"| node_internet

click node_ui "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/App.jsx"
click node_profiles "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/screens/SettingsScreen.jsx"
click node_app_types "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/i18n.js"
click node_tauri "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/src/lib.rs"
click node_android_vpn "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/android-bibavpn-extras/java/dev/bibavpn/BibaVpnService.kt"
click node_ios_tunnel "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/ios-bibavpn-extras/BibaVpnTunnel/PacketTunnelProvider.swift"
click node_ffi "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-ffi/src/lib.rs"
click node_jni "https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-jni/src/lib.rs"
click node_local_proxy "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/local_client.rs"
click node_socks "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/socks5.rs"
click node_invite "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/invite_uri.rs"
click node_policy "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/client_policy.rs"
click node_tls "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/tls_util.rs"
click node_stealth "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/stealth_v12.rs"
click node_crypto "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/crypto_layer.rs"
click node_frame "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/frame.rs"
click node_tcp_mux "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/tcp_mux.rs"
click node_udp_mux "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/udp_mux.rs"
click node_websocket "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/ws_bridge.rs"
click node_camouflage "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/camouflage.rs"
click node_server "https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/bin/server.rs"
click node_biba "https://github.com/eljaja/bibavpn/blob/main/biba/src/parrot.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_profiles,node_app_types,node_tauri,node_android_vpn,node_ios_tunnel,node_ffi,node_jni,node_user toneBlue
class node_local_proxy,node_socks,node_invite,node_policy toneAmber
class node_tls,node_stealth,node_crypto,node_frame,node_tcp_mux,node_udp_mux,node_websocket,node_biba toneMint
class node_camouflage,node_server toneRose
class node_internet toneIndigo
```

## Components

### Client app

- [App interface](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/App.jsx): `apps/bibavpn-desktop/ui/src/App.jsx`
- [Profiles and settings](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/screens/SettingsScreen.jsx): `apps/bibavpn-desktop/ui/src/screens/SettingsScreen.jsx`
- [UI localization and types](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/ui/src/i18n.js): `apps/bibavpn-desktop/ui/src/i18n.js`
- [Desktop backend](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/src/lib.rs): `apps/bibavpn-desktop/src-tauri/src/lib.rs`
- [Android VPN service](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/android-bibavpn-extras/java/dev/bibavpn/BibaVpnService.kt): `apps/bibavpn-desktop/src-tauri/android-bibavpn-extras/java/dev/bibavpn/BibaVpnService.kt`
- [iOS tunnel extension](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-desktop/src-tauri/ios-bibavpn-extras/BibaVpnTunnel/PacketTunnelProvider.swift): `apps/bibavpn-desktop/src-tauri/ios-bibavpn-extras/BibaVpnTunnel/PacketTunnelProvider.swift`
- [Native FFI](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-ffi/src/lib.rs): `apps/bibavpn-ffi/src/lib.rs`
- [Android JNI](https://github.com/eljaja/bibavpn/blob/main/apps/bibavpn-jni/src/lib.rs): `apps/bibavpn-jni/src/lib.rs`

### Client runtime

- [Local proxy client](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/local_client.rs): `bibavpn/src/local_client.rs`
- [SOCKS5 and HTTP CONNECT](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/socks5.rs): `bibavpn/src/socks5.rs`
- [Encrypted invitations](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/invite_uri.rs): `bibavpn/src/invite_uri.rs`
- [TLS profile policy](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/client_policy.rs): `bibavpn/src/client_policy.rs`

### Tunnel protocol

- [TLS profiles](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/tls_util.rs): `bibavpn/src/tls_util.rs`
- [Traffic shaping](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/stealth_v12.rs): `bibavpn/src/stealth_v12.rs`
- [Encrypted frames](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/crypto_layer.rs): `bibavpn/src/crypto_layer.rs`
- [Frame and padding](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/frame.rs): `bibavpn/src/frame.rs`
- [TCP multiplexing](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/tcp_mux.rs): `bibavpn/src/tcp_mux.rs`
- [UDP relay](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/udp_mux.rs): `bibavpn/src/udp_mux.rs`
- [WebSocket bridge](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/ws_bridge.rs): `bibavpn/src/ws_bridge.rs`
- [ClientHello profiles](https://github.com/eljaja/bibavpn/blob/main/biba/src/parrot.rs): `biba/src/parrot.rs`

### Server runtime

- [Camouflage site](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/camouflage.rs): `bibavpn/src/camouflage.rs`
- [VPN server](https://github.com/eljaja/bibavpn/blob/main/bibavpn/src/bin/server.rs): `bibavpn/src/bin/server.rs`

### Other components

- **User and apps**
- **Internet destinations**

## Connections

- User and apps → App interface: configures and connects (evidence: `README.md`)
- App interface → Profiles and settings: renders (evidence: `apps/bibavpn-desktop/ui/src/App.jsx`)
- App interface → UI localization and types: uses localization (evidence: `apps/bibavpn-desktop/ui/src/App.jsx`)
- App interface → Desktop backend: invokes commands (evidence: `apps/bibavpn-desktop/ui/src/App.jsx`)
- Profiles and settings → Desktop backend: invokes package picker (evidence: `apps/bibavpn-desktop/ui/src/screens/SettingsScreen.jsx`)
- Desktop backend → Local proxy client: starts client
- Android VPN service → Android JNI: calls native client (evidence: `apps/bibavpn-desktop/src-tauri/android-bibavpn-extras/java/dev/bibavpn/BibaVpnService.kt`)
- Android JNI → Local proxy client: wraps shared client
- Native FFI → Local proxy client: exposes client
- iOS tunnel extension → Local proxy client: forwards tunnel
- User and apps → SOCKS5 and HTTP CONNECT: sends proxy traffic (evidence: `README.md`)
- Local proxy client → SOCKS5 and HTTP CONNECT: accepts proxy requests (evidence: `README.md`)
- Local proxy client → Encrypted invitations: imports invitation (evidence: `bibavpn/src/local_client.rs`)
- Local proxy client → TLS profile policy: resolves TLS settings (evidence: `bibavpn/src/client_policy.rs`)
- TLS profile policy → TLS profiles: selects profile (evidence: `bibavpn/src/client_policy.rs`)
- TLS profiles → ClientHello profiles: uses ClientHello profiles
- Local proxy client → WebSocket bridge: opens tunnel sessions (evidence: `README.md`)
- WebSocket bridge → TCP multiplexing: carries multiplexed streams (evidence: `README.md`)
- WebSocket bridge → UDP relay: carries UDP session (evidence: `README.md`)
- Local proxy client → Encrypted frames: encrypts tunnel traffic (evidence: `README.md`)
- Encrypted frames → Frame and padding: frames and pads traffic (evidence: `README.md`)
- Local proxy client → Traffic shaping: applies traffic profiles (evidence: `bibavpn/src/local_client.rs`)
- WebSocket bridge → VPN server: connects over TLS (evidence: `README.md`)
- VPN server → Camouflage site: serves camouflage site (evidence: `README.md`)
- VPN server → Internet destinations: routes tunnel traffic (evidence: `README.md`)
