Open-source Rust reimplementation of the CCZU WebVPN tunnel client.
The project currently provides both:
- a Windows-oriented CLI client path for direct usage
- a Rust library and UniFFI bindings for embedding and integration
tun-rsbased cross-platform TUN device integration- Windows Wintun CLI client path
- Split-tunnel route installation from WebVPN rule data
- UniFFI exports for Kotlin, Swift, Python, and Ruby
tracingbased diagnostics for both CLI and library consumers
The CLI entrypoint in src/main.rs can be used directly, especially on Windows. At the moment, Windows is the most complete path because it configures Wintun, DNS, and split-tunnel routes automatically.
- Windows users who want to run the tunnel client directly
- Developers validating protocol behavior against the real service
- Integrators who want to smoke-test the native tunnel path locally
- Rust toolchain installed
- Administrator privileges on Windows
- Network access to
zmvpn.cczu.edu.cn
PowerShell:
$env:RUST_LOG = "info"
cargo run --release- Checks whether WebVPN appears to be available.
- Prompts for username and password.
- Starts the tunnel session.
- Creates a
tun-rsdevice namedCCZU-VPN-PROTO. - On Windows:
- materializes
wintun.dllin the working directory when needed - sets the VPN DNS server on the virtual interface
- installs split-tunnel routes for the campus network ranges returned by WebVPN
- materializes
- Bridges packets between the TUN device and the custom VPN protocol.
- The CLI uses the library default TLS option, which currently means
no_verification = true. - Split-tunnel routes are removed on clean shutdown.
- Packet and routing logs respect
RUST_LOG. - If you are embedding this project into another application, the library API and UniFFI bindings are usually a better fit than shelling out to the CLI.
Add the crate:
cargo add --git https://github.com/CCZU-OSSA/cczu-vpn-proto.gitMinimal async example:
use anyhow::Result;
use cczuvpnproto::{
diag,
types::StartOptions,
vpn::service,
};
#[tokio::main]
async fn main() -> Result<()> {
diag::init_tracing("info")?;
service::start_service_with_options(
"user",
"password",
StartOptions {
no_verification: true,
},
)
.await?;
let server = service::proxy_server().expect("proxy server should exist after login");
println!("{server:?}");
Ok(())
}The exported API lives in src/bindings.rs. Supported generated bindings:
- Kotlin
- Swift
- Python
- Ruby
Published releases include:
- native libraries (
.dll,.so,.dylib,.a,.libwhen available) - UniFFI binding archives for each supported language
- src/main.rs: CLI test entrypoint
- src/bindings.rs: UniFFI exported surface
- src/types.rs: shared records and options
- src/vpn/service.rs: session actor and runtime state
- src/vpn/protocol: custom protocol reader and writer
- src/diag.rs: tracing initialization helpers
Format:
cargo fmtCheck:
cargo check --lockedBuild release artifacts:
cargo build --release --lockedCompile test targets without running them:
cargo test --locked --no-runEnable the bindgen feature first:
cargo build --release --locked --features bindgen
cargo build --locked --features bindgen --bin uniffi-bindgenThen generate bindings one language at a time from the host library:
Windows host:
.\target\debug\uniffi-bindgen.exe generate -n -l kotlin -o .\dist\bindings\kotlin .\target\release\cczuvpnproto.dll
.\target\debug\uniffi-bindgen.exe generate -n -l swift -o .\dist\bindings\swift .\target\release\cczuvpnproto.dll
.\target\debug\uniffi-bindgen.exe generate -n -l python -o .\dist\bindings\python .\target\release\cczuvpnproto.dll
.\target\debug\uniffi-bindgen.exe generate -n -l ruby -o .\dist\bindings\ruby .\target\release\cczuvpnproto.dllLinux host:
target/debug/uniffi-bindgen generate -n -l kotlin -o ./dist/bindings/kotlin ./target/release/libcczuvpnproto.somacOS host:
target/debug/uniffi-bindgen generate -n -l swift -o ./dist/bindings/swift ./target/release/libcczuvpnproto.dylib- nightly.yml: scheduled or manual pre-release build for the
pre-releasetag - release.yml: stable release workflow triggered by pushing a
v*tag
Both workflows publish:
- native libraries for each target in the matrix
- UniFFI binding archives for Kotlin, Swift, Python, and Ruby
