修自定义配置

null、导入、mixin ignore
This commit is contained in:
2026-10-30 23:40:05 +08:00
parent 2582f9ba3e
commit 544a68bbd4
9 changed files with 429 additions and 79 deletions
+17
View File
@@ -24,6 +24,15 @@ use tun_rs::BorrowedAsyncDevice;
static ROOT_STORE: OnceLock<Arc<RootCertStore>> = OnceLock::new();
const BLOCKED_HOSTS: &[&str] = &["submit.backtrace.io"];
fn is_blocked_host(host: &str) -> bool {
let host = host.trim_end_matches('.');
BLOCKED_HOSTS
.iter()
.any(|blocked| host.eq_ignore_ascii_case(blocked))
}
const SNIFF_TIMEOUT: Duration = Duration::from_secs(5);
const TEARDOWN_DRAIN_TIMEOUT: Duration = Duration::from_secs(3);
const TEARDOWN_SETTLE: Duration = Duration::from_millis(50);
@@ -136,6 +145,14 @@ where
return passthrough_cancel_wrapped(io, dst, None, upstream, &cancel).await;
};
// 崩溃上报之类的域名直接拒绝,不建立上游连接
if let Some(host) = sni.as_deref() {
if is_blocked_host(host) {
warn!("blocked host {host} ({dst:?}), connection rejected");
return Ok(());
}
}
let host_matched = sni
.as_deref()
.map(|s| target_hosts.iter().any(|h| s.eq_ignore_ascii_case(h)))