init
Some checks failed
CI / Rust (push) Successful in 20s
CI / Android (push) Failing after 8m35s

This commit is contained in:
2026-05-31 15:36:07 +03:30
commit 4ffbc3bffe
61 changed files with 2760 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
[package]
name = "vpnshare-ffi"
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
[lib]
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[dependencies]
vpnshare-core = { path = "../vpnshare-core" }
vpnshare-proto = { path = "../vpnshare-proto" }

View File

@@ -0,0 +1,28 @@
//! C ABI surface for Android and future desktop bindings.
use std::os::raw::c_char;
static VERSION: &[u8] = b"0.1.0\0";
#[no_mangle]
pub extern "C" fn vpnshare_core_version() -> *const c_char {
VERSION.as_ptr().cast()
}
#[no_mangle]
pub extern "C" fn vpnshare_protocol_version() -> u8 {
vpnshare_proto::PROTOCOL_VERSION
}
#[cfg(test)]
mod tests {
use super::*;
use std::ffi::CStr;
#[test]
fn exposes_version() {
let raw = vpnshare_core_version();
let version = unsafe { CStr::from_ptr(raw) };
assert_eq!(version.to_str().unwrap(), "0.1.0");
}
}