mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-20 13:59:10 +00:00
Bump version 0.2.14
This commit is contained in:
parent
eab795e61c
commit
4adc38c726
4 changed files with 12 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tun2proxy"
|
name = "tun2proxy"
|
||||||
version = "0.2.13"
|
version = "0.2.14"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/blechschmidt/tun2proxy"
|
repository = "https://github.com/blechschmidt/tun2proxy"
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub unsafe extern "C" fn Java_com_github_shadowsocks_bg_Tun2proxy_run(
|
||||||
|
|
||||||
let mut args = Args::default();
|
let mut args = Args::default();
|
||||||
args.proxy(proxy).tun_fd(Some(tun_fd)).dns(dns).verbosity(verbosity);
|
args.proxy(proxy).tun_fd(Some(tun_fd)).dns(dns).verbosity(verbosity);
|
||||||
crate::mobile_api::mobile_run(args, tun_mtu)
|
crate::mobile_api::mobile_run(args, tun_mtu, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
/// # Safety
|
||||||
|
|
|
@ -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
|
/// - tun_fd: the tun file descriptor
|
||||||
|
/// - 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
|
||||||
/// - verbosity: the verbosity level, see ArgVerbosity enum
|
/// - verbosity: the verbosity level, see ArgVerbosity enum
|
||||||
|
@ -19,6 +20,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,
|
||||||
|
packet_information: bool,
|
||||||
tun_mtu: c_ushort,
|
tun_mtu: c_ushort,
|
||||||
dns_strategy: ArgDns,
|
dns_strategy: ArgDns,
|
||||||
verbosity: ArgVerbosity,
|
verbosity: ArgVerbosity,
|
||||||
|
@ -32,7 +34,7 @@ pub unsafe extern "C" fn tun2proxy_with_fd_run(
|
||||||
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)).dns(dns_strategy).verbosity(verbosity);
|
||||||
|
|
||||||
crate::mobile_api::mobile_run(args, tun_mtu)
|
crate::mobile_api::mobile_run(args, tun_mtu, packet_information)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
/// # Safety
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub async fn desktop_run_async(_: Args, _: tokio_util::sync::CancellationToken)
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mobile_run(args: Args, tun_mtu: u16) -> c_int {
|
pub fn mobile_run(args: Args, tun_mtu: u16, _packet_information: bool) -> c_int {
|
||||||
let shutdown_token = tokio_util::sync::CancellationToken::new();
|
let shutdown_token = tokio_util::sync::CancellationToken::new();
|
||||||
{
|
{
|
||||||
if let Ok(mut lock) = TUN_QUIT.lock() {
|
if let Ok(mut lock) = TUN_QUIT.lock() {
|
||||||
|
@ -41,6 +41,12 @@ pub fn mobile_run(args: Args, tun_mtu: u16) -> c_int {
|
||||||
config.tun_name(tun);
|
config.tun_name(tun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
config.platform_config(|config| {
|
||||||
|
#[allow(deprecated)]
|
||||||
|
config.packet_information(_packet_information);
|
||||||
|
});
|
||||||
|
|
||||||
let device = tun2::create_as_async(&config).map_err(std::io::Error::from)?;
|
let device = tun2::create_as_async(&config).map_err(std::io::Error::from)?;
|
||||||
let join_handle = tokio::spawn(crate::run(device, tun_mtu, args, shutdown_token));
|
let join_handle = tokio::spawn(crate::run(device, tun_mtu, args, shutdown_token));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue