feat(ffi): add config server client bindings (#2320)

Add config server client support for the C FFI and Android JNI bindings.

Reuse the existing easytier::web_client::run_web_client path and 
NetworkInstanceManager; OHOS is unchanged.

Report successful remote config apply/delete operations through a 
callback, with one JSON event per affected instance.

Keep the config server client and FFI data plane mutually exclusive: once 
either side is in use, the other side returns an error instead of sharing
lifecycle state.
This commit is contained in:
KKRainbow
2026-06-06 01:52:27 +08:00
committed by GitHub
parent 9ba364ff60
commit 13f2ebfe12
27 changed files with 4662 additions and 1237 deletions
+12
View File
@@ -34,6 +34,7 @@ pub struct NetworkInstanceManager {
instance_error_messages: Arc<DashMap<uuid::Uuid, String>>,
config_dir: Option<PathBuf>,
guard_counter: Arc<()>,
remote_mutation_lock: Arc<tokio::sync::Mutex<()>>,
}
impl Default for NetworkInstanceManager {
@@ -51,6 +52,7 @@ impl NetworkInstanceManager {
instance_error_messages: Arc::new(DashMap::new()),
config_dir: None,
guard_counter: Arc::new(()),
remote_mutation_lock: Arc::new(tokio::sync::Mutex::new(())),
}
}
@@ -59,6 +61,10 @@ impl NetworkInstanceManager {
self
}
pub fn remote_mutation_lock(&self) -> Arc<tokio::sync::Mutex<()>> {
self.remote_mutation_lock.clone()
}
fn start_instance_task(&self, instance_id: uuid::Uuid) -> Result<(), anyhow::Error> {
if tokio::runtime::Handle::try_current().is_err() {
return Err(anyhow::anyhow!(
@@ -272,6 +278,12 @@ impl NetworkInstanceManager {
.map(|instance| instance.value().get_config_file_control().clone())
}
pub fn get_instance_config(&self, instance_id: &uuid::Uuid) -> Option<TomlConfigLoader> {
self.instance_map
.get(instance_id)
.map(|instance| instance.value().get_config())
}
pub fn get_instance_network_config_source(
&self,
instance_id: &uuid::Uuid,