How orbien-org/orbien works
Purpose and Executables
Orbien is a Rust/Tokio reverse-tunneling system for exposing private services through a public server. Primary binaries are the client (client/src/main.rs) and server (server/src/main.rs), configured through TOML examples in conf/orbien.toml and conf/orbien-server.toml. It also ships a native desktop client, Java client library, and server dashboard UI.
Shared Protocol and Runtime Core
The core crate defines contracts shared by client and server: configuration, token authentication, framed control messages, network metadata, TLS, rate limiting, and transports. Key boundaries are core/src/msg/codec.rs, core/src/auth/token.rs, and core/src/transport/mod.rs. Supported transport implementations include TCP, KCP, QUIC, WebSocket, TLS, and Yamux TCP multiplexing.
Client Control Plane
The Rust client establishes and maintains a server control session, handles server requests for data connections, and owns tunnel lifecycle. Main control/session orchestration is in client/src/control/session.rs; tunnel registration and dispatch live in client/src/tunnel/manager.rs and client/src/handle.rs. Client configuration maps declared local services and tunnel types to outgoing registrations through client/src/service.rs.
Client Data Plane and Local Services
After control-plane negotiation, the client creates data connections and relays inbound public traffic to configured private services. Connector and tunnel implementations separate stream setup from protocol-specific forwarding: client/src/connector.rs, client/src/tunnel/udp.rs, and client/src/tunnel/mod.rs. The TLS-termination plugin (client/src/plugin/tls_term.rs) is a distinct boundary for client-side HTTPS termination.
Server Registration, Routing, and Tunnel Ingress
The server accepts authenticated client sessions, registers their tunnel definitions, maintains a pool of data connections, and routes public ingress to the owning client session. These stages are centered in server/src/control/session/register.rs, server/src/control/session/data_pool.rs, and server/src/service/ingress.rs. Protocol-specific public listeners/gateways are implemented under server/src/tunnel/, notably tcp.rs, udp.rs, http.rs, https.rs, and gw.rs.
Operations and Interfaces
The server exposes dashboard routes backed by in-memory client/tunnel and traffic state: server/src/dashboard/routes.rs, server/src/service/session_registry.rs, and server/src/metrics/mod.rs. The separate Vue/Vite dashboard consumes this API via server-ui/src/api/client.ts, with monitoring and inventory views in server-ui/src/views/Monitor.vue and server-ui/src/views/Clients.vue. This UI is an operations consumer, not part of forwarding-path correctness.
Additional Consumers and Deployment
desktop/src/main.rs hosts the native Slint GUI and launches/manages the Rust client runtime through desktop/src/runtime.rs and desktop/src/config_bridge.rs. Java integrations implement the same wire/control/data concepts using Netty (client-java/orbien-client/src/main/java/io/github/lxien/orbien/client/OrbienClient.java, .../netty/ControlHandler.java) and Spring Boot auto-configuration (client-java/orbien-spring-boot-starter/src/main/java/io/github/lxien/orbien/boot/OrbienAutoConfiguration.java). Docker builds target independent client/server images in docker/Dockerfile.client and docker/Dockerfile.server.
Main entry points: register.rs Session registration · session.rs Control session · connector.rs Data connector · ingress.rs Ingress router
Components 25
Shared Core
Contracts and transport primitives shared by Rust client and server.
- Config and protocol · Configuration, framed messages, network metadata, TLS, and rate limits.
- Token authentication
core/src/auth/token.rs - Control codec
core/src/msg/codec.rs - Transport layer · TCP, KCP, QUIC, WebSocket, TLS, and Yamux implementations.
core/src/transport/mod.rs
Rust Client
Private-network control and forwarding runtime.
- Client binary
client/src/main.rs - Control session · Maintains the authenticated server control connection.
client/src/control/session.rs - Service declarations · Maps local services and tunnel types to registrations.
client/src/service.rs - Tunnel manager
client/src/tunnel/manager.rs - Data connector
client/src/connector.rs - Tunnel forwarding · Stream and UDP tunnel implementations relay to local services.
client/src/tunnel/mod.rs - TLS termination plugin · Performs client-side HTTPS termination.
client/src/plugin/tls_term.rs
Rust Server
Public ingress, registration, and routing runtime.
- Server binary
server/src/main.rs - Session registration · Authenticates clients and registers tunnel definitions.
server/src/control/session/register.rs - Data connection pool
server/src/control/session/data_pool.rs - Ingress router · Routes public traffic to its owning client session.
server/src/service/ingress.rs - Public gateways · TCP, UDP, HTTP, HTTPS, and gateway listeners.
- Session registry · In-memory client and tunnel inventory.
server/src/service/session_registry.rs - Traffic metrics
server/src/metrics/mod.rs - Dashboard API routes
server/src/dashboard/routes.rs
Operations UI
Observability and server administration surface.
- Vue dashboard · Monitoring and client inventory views consume the server API.
server-ui/src/api/client.ts
Additional Consumers
Alternative client integrations and deployment targets.
- Desktop client · Hosts and manages the Rust client runtime.
desktop/src/main.rs - Java client library · Implements the same control and data concepts for Java integrations.
client-java/orbien-client/src/main/java/io/github/lxien/orbien/client/OrbienClient.java - Spring Boot starter
client-java/orbien-spring-boot-starter/src/main/java/io/github/lxien/orbien/boot/OrbienAutoConfiguration.java - Client image
docker/Dockerfile.client - Server image
docker/Dockerfile.server
Connections 26
- Client binary → Control session: starts
- Service declarations → Tunnel manager: declares tunnels
- Control session → Tunnel manager: dispatches requests
- Tunnel manager → Data connector: opens data connections
- Data connector → Tunnel forwarding: supplies streams
- Tunnel forwarding → TLS termination plugin: uses for HTTPS
- Control session → Control codec: control frames
- Control session → Token authentication: authenticates with
- Data connector → Transport layer: uses
- Server binary → Session registration: accepts sessions
- Session registration → Session registry: records tunnels
- Session registration → Data connection pool: manages
- Public gateways → Ingress router: public traffic
- Ingress router → Data connection pool: selects connection
- Ingress router → Session registry: resolves owner
- Session registration → Token authentication: validates tokens
- Session registration → Control codec: control frames
- Data connection pool → Transport layer: uses
- Session registry → Dashboard API routes: inventory
- Traffic metrics → Dashboard API routes: traffic state
- Dashboard API routes → Vue dashboard: operations API
- Desktop client → Client binary: manages runtime
- Spring Boot starter → Java client library: configures
- Java client library → Session registration: control session
- Client image → Client binary: packages
- Server image → Server binary: packages