Refactor VPN proxy routing and session handling
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#[path = "../src/models.rs"]
|
||||
mod models;
|
||||
#[path = "../src/adapters/proxy_router.rs"]
|
||||
mod proxy_router;
|
||||
#[path = "../src/adapters/proxifyre.rs"]
|
||||
mod proxifyre;
|
||||
#[path = "../src/adapters/proxy_router.rs"]
|
||||
mod proxy_router;
|
||||
#[path = "../src/adapters/singbox.rs"]
|
||||
mod singbox;
|
||||
|
||||
@@ -14,8 +14,8 @@ use models::{
|
||||
use proxifyre::{ProxiFyreAdapter, ProxiFyreConfig};
|
||||
use proxy_router::{ProxyRouterAdapter, ProxyRouterRequest};
|
||||
use singbox::{
|
||||
SingBoxAdapter, SingBoxCheckResult, SingBoxConfig, SingBoxConfigChecker,
|
||||
SingBoxConfigError, SingBoxConfigErrorKind, SingBoxGenerationRequest, SINGBOX_OUTPUT_FILE,
|
||||
SingBoxAdapter, SingBoxCheckResult, SingBoxConfig, SingBoxConfigChecker, SingBoxConfigError,
|
||||
SingBoxConfigErrorKind, SingBoxGenerationRequest, SINGBOX_OUTPUT_FILE,
|
||||
};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
@@ -116,7 +116,10 @@ fn blocks_local_singbox_config_when_component_is_not_running() {
|
||||
)
|
||||
.expect_err("local sing-box target requires running component");
|
||||
|
||||
assert_eq!(error.kind, SingBoxConfigErrorKind::RequiredComponentNotRunning);
|
||||
assert_eq!(
|
||||
error.kind,
|
||||
SingBoxConfigErrorKind::RequiredComponentNotRunning
|
||||
);
|
||||
assert!(checker.calls.borrow().is_empty());
|
||||
}
|
||||
|
||||
@@ -129,11 +132,7 @@ fn propagates_failed_singbox_check_as_structured_error() {
|
||||
|
||||
let error = adapter
|
||||
.generate_config(
|
||||
SingBoxGenerationRequest::new(
|
||||
&targets,
|
||||
&components,
|
||||
Some(Path::new("sing-box.exe")),
|
||||
),
|
||||
SingBoxGenerationRequest::new(&targets, &components, Some(Path::new("sing-box.exe"))),
|
||||
&checker,
|
||||
)
|
||||
.expect_err("failed sing-box check should block generated config");
|
||||
@@ -156,7 +155,10 @@ fn external_proxifyre_apply_does_not_require_singbox_component() {
|
||||
serde_json::from_str(&generated.contents).expect("generated proxifyre json");
|
||||
|
||||
assert_eq!(config.proxies.len(), 1);
|
||||
assert_eq!(config.proxies[0].socks5_proxy_endpoint, "192.168.50.111:8080");
|
||||
assert_eq!(
|
||||
config.proxies[0].socks5_proxy_endpoint,
|
||||
"192.168.50.111:8080"
|
||||
);
|
||||
}
|
||||
|
||||
struct RecordingChecker {
|
||||
|
||||
Reference in New Issue
Block a user