From 709c932158298462b7a9ab1c4986ae5c1256ce12 Mon Sep 17 00:00:00 2001 From: Yuwei B Date: Sun, 17 Sep 2023 00:11:39 +1000 Subject: [PATCH] tun up --- clash/tests/data/config/rules.yaml | 2 +- clash_lib/src/proxy/transport/tls.rs | 1 - clash_lib/src/proxy/tun/inbound.rs | 15 +-------------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/clash/tests/data/config/rules.yaml b/clash/tests/data/config/rules.yaml index f466897c..57deb77b 100644 --- a/clash/tests/data/config/rules.yaml +++ b/clash/tests/data/config/rules.yaml @@ -4,7 +4,7 @@ socks-port: 8889 mixed-port: 8899 tun: - enable: false + enable: true device-id: "dev://utun1989" dns: diff --git a/clash_lib/src/proxy/transport/tls.rs b/clash_lib/src/proxy/transport/tls.rs index 16d68185..5890c30f 100644 --- a/clash_lib/src/proxy/transport/tls.rs +++ b/clash_lib/src/proxy/transport/tls.rs @@ -3,7 +3,6 @@ use std::{io, sync::Arc}; use rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName}; use serde::Serialize; use tokio_rustls::TlsConnector; -use tracing::warn; use crate::{common::tls, proxy::AnyStream}; diff --git a/clash_lib/src/proxy/tun/inbound.rs b/clash_lib/src/proxy/tun/inbound.rs index 421a98b0..b222bc60 100644 --- a/clash_lib/src/proxy/tun/inbound.rs +++ b/clash_lib/src/proxy/tun/inbound.rs @@ -162,20 +162,7 @@ pub fn get_runner( } } - let network = cfg - .network - .as_ref() - .unwrap_or(&"198.19.0.0/16".to_owned()) - .parse::()?; - - tun_cfg - .address( - network.hosts().nth(0).expect( - format!("tun network {:?} doesn't contain any address", cfg.network).as_str(), - ), - ) - .netmask(network.netmask()) - .up(); + tun_cfg.up(); let tun = tun::create_as_async(&tun_cfg).map_err(map_io_error)?;