lingxia-proxy
A local proxy runtime used by LingXia browser shells.
It provides:
- A local HTTP proxy listener bound on
127.0.0.1:* - Runtime-swappable routing between
Directand upstreamSOCKS5 - Optional rule-list based proxy routing with cached rule updates
- Optional HTTPS MITM capture for development/debugging
Scope
This crate is a low-level runtime component. It does not define product UI,
settings pages, or JS host APIs. In the current workspace those are owned by
lingxia-shell.
The main public types exported by this crate are:
LocalProxyProxyRouterFixedRouterProfileRouterProfileRouteDecisionUpstreamConfigSocks5CredentialsRuleListRouterwith featurerule-list-routingCaConfigand capture session types with featurecapture
Quick Start
use Arc;
use ;
let router = new;
let proxy = bind.await?;
let addr = proxy.local_addr;
let proxy_task = proxy.clone;
spawn;
LocalProxy accepts:
CONNECT host:porttunnel requests- Standard HTTP proxy requests for plain
http://traffic
Routing
Fixed Upstream
use Arc;
use ;
let router = new;
proxy.set_router;
Named Profiles
use Arc;
use ;
let mut router = new;
router.activate;
proxy.set_router;
Custom Router
use ;
;
Rule-List Routing
Enable feature rule-list-routing to use:
RuleListRouterfetch_encoded_from_url(...)validate_source_url(...)
This is intended for shells that want an "Auto Switch" style mode backed by a downloaded rule list plus their own higher-level settings/runtime logic. The current implementation supports gfwlist-compatible sources, but the Cargo feature is named after the product capability rather than a specific source.
HTTPS MITM Capture
Enable feature capture to use:
CaConfigsession_receiver()CapturedSessionand related capture types
Important notes:
- This is for development/debugging use.
- The caller must provide and install a CA certificate.
- Upstream HTTPS connections are validated against the system/native root store.
- If upstream TLS validation fails, interception fails instead of silently trusting the upstream certificate.
Feature Flags
rule-list-routingAdds rule-list routing and HTTPS download support for rule list refresh.captureAdds MITM interception and structured HTTP capture types.