fix(stealth): pass proxy config to StealthHttpClient (#141)

When --stealth is enabled, StealthHttpClient was created without
the proxy URL from --proxy, causing all stealth-mode requests to
bypass the proxy.

Also convert SOCKS5 proxy URL to HTTP when passing to wreq-based
StealthHttpClient, because wreq does not support SOCKS5 protocol
(Clash mixed port supports both protocols on the same port).

Fixes proxy connectivity for 'obscura serve --stealth --proxy socks5://...'

Co-authored-by: handsome.cheng <[email protected]>
This commit is contained in:
cpp1992andhandsome.cheng authored and GitHub committed 2026-05-13 22:25:18 +02:00
1 parent 5596c79490
commit c6f6ce2cc2
2 files changed
+9 -2

No files matched your search

+8 -1
View File
@@ -54,7 +54,14 @@ impl Page {
let frame_id = id.clone();
#[cfg(feature = "stealth")]
let stealth_client = if context.stealth {
Some(Arc::new(StealthHttpClient::new(context.cookie_jar.clone())))
// wreq doesn't support SOCKS5; Clash mixed port handles both.
let stealth_proxy = context.proxy_url.as_ref().map(|u| {
u.replacen("socks5://", "http://", 1)
});
Some(Arc::new(StealthHttpClient::with_proxy(
context.cookie_jar.clone(),
stealth_proxy.as_deref(),
)))
} else {
None
};