blob: 61c47803a40547ded038e28e96d31df85e5fbeb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#![cfg(target_os = "ios")]
mod encrypted_dns_proxy;
mod ephemeral_peer_proxy;
mod shadowsocks_proxy;
pub mod tunnel_obfuscator_proxy;
#[repr(C)]
pub struct ProxyHandle {
pub context: *mut std::ffi::c_void,
pub port: u16,
}
#[no_mangle]
pub static CONFIG_SERVICE_PORT: u16 = talpid_tunnel_config_client::CONFIG_SERVICE_PORT;
mod ios {
use std::sync::OnceLock;
use tokio::runtime::{Builder, Handle, Runtime};
static RUNTIME: OnceLock<Result<Runtime, String>> = OnceLock::new();
pub fn mullvad_ios_runtime() -> Result<Handle, String> {
match RUNTIME.get_or_init(|| {
Builder::new_multi_thread()
.enable_all()
.build()
.map_err(|error| ToString::to_string(&error))
}) {
Ok(runtime) => Ok(runtime.handle().clone()),
Err(error) => Err(error.clone()),
}
}
}
use ios::*;
|