|
|
@ -12,6 +12,7 @@ use std::os::raw::{c_char, c_int, c_ushort}; |
|
|
/// Parameters:
|
|
|
/// Parameters:
|
|
|
/// - proxy_url: the proxy url, e.g. "socks5://127.0.0.1:1080"
|
|
|
/// - proxy_url: the proxy url, e.g. "socks5://127.0.0.1:1080"
|
|
|
/// - tun_fd: the tun file descriptor, it will be owned by tun2proxy
|
|
|
/// - tun_fd: the tun file descriptor, it will be owned by tun2proxy
|
|
|
|
|
|
/// - close_fd_on_drop: whether close the tun_fd on drop
|
|
|
/// - packet_information: whether exists packet information in tun_fd
|
|
|
/// - packet_information: whether exists packet information in tun_fd
|
|
|
/// - tun_mtu: the tun mtu
|
|
|
/// - tun_mtu: the tun mtu
|
|
|
/// - dns_strategy: the dns strategy, see ArgDns enum
|
|
|
/// - dns_strategy: the dns strategy, see ArgDns enum
|
|
|
@ -20,6 +21,7 @@ use std::os::raw::{c_char, c_int, c_ushort}; |
|
|
pub unsafe extern "C" fn tun2proxy_with_fd_run( |
|
|
pub unsafe extern "C" fn tun2proxy_with_fd_run( |
|
|
proxy_url: *const c_char, |
|
|
proxy_url: *const c_char, |
|
|
tun_fd: c_int, |
|
|
tun_fd: c_int, |
|
|
|
|
|
close_fd_on_drop: bool, |
|
|
packet_information: bool, |
|
|
packet_information: bool, |
|
|
tun_mtu: c_ushort, |
|
|
tun_mtu: c_ushort, |
|
|
dns_strategy: ArgDns, |
|
|
dns_strategy: ArgDns, |
|
|
@ -34,7 +36,11 @@ pub unsafe extern "C" fn tun2proxy_with_fd_run( |
|
|
let proxy = ArgProxy::try_from(proxy_url).unwrap(); |
|
|
let proxy = ArgProxy::try_from(proxy_url).unwrap(); |
|
|
|
|
|
|
|
|
let mut args = Args::default(); |
|
|
let mut args = Args::default(); |
|
|
args.proxy(proxy).tun_fd(Some(tun_fd)).dns(dns_strategy).verbosity(verbosity); |
|
|
args.proxy(proxy) |
|
|
|
|
|
.tun_fd(Some(tun_fd)) |
|
|
|
|
|
.close_fd_on_drop(close_fd_on_drop) |
|
|
|
|
|
.dns(dns_strategy) |
|
|
|
|
|
.verbosity(verbosity); |
|
|
|
|
|
|
|
|
crate::mobile_api::mobile_run(args, tun_mtu, packet_information) |
|
|
crate::mobile_api::mobile_run(args, tun_mtu, packet_information) |
|
|
} |
|
|
} |
|
|
|