mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-10 00:27:46 +00:00
Ffi (#89)
This commit is contained in:
parent
e9c378099e
commit
a26621bbcd
11 changed files with 224 additions and 26 deletions
|
@ -10,7 +10,7 @@ use std::os::raw::{c_char, c_int, c_ushort};
|
|||
///
|
||||
/// Run the tun2proxy component with some arguments.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn tun2proxy_run(
|
||||
pub unsafe extern "C" fn tun2proxy_run_with_fd(
|
||||
proxy_url: *const c_char,
|
||||
tun_fd: c_int,
|
||||
tun_mtu: c_ushort,
|
||||
|
@ -23,7 +23,8 @@ pub unsafe extern "C" fn tun2proxy_run(
|
|||
let proxy_url = std::ffi::CStr::from_ptr(proxy_url).to_str().unwrap();
|
||||
let proxy = ArgProxy::from_url(proxy_url).unwrap();
|
||||
|
||||
let args = Args::new(Some(tun_fd), proxy, dns_strategy, verbosity);
|
||||
let mut args = Args::default();
|
||||
args.proxy(proxy).tun_fd(Some(tun_fd)).dns(dns_strategy).verbosity(verbosity);
|
||||
|
||||
crate::api::tun2proxy_internal_run(args, tun_mtu)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue