Add device HWID support to sing-box subscriptions

This commit is contained in:
2026-07-08 20:31:21 +03:00
parent 7316e932f0
commit 42b85cc8fa
12 changed files with 450 additions and 19 deletions

View File

@@ -59,6 +59,7 @@ fn roundtrips_local_singbox_config_and_subscription_cache() {
let storage = JsonStorage::new(root.clone());
let config = LocalSingBoxConfig {
subscription_url: Some("https://sub.example.test/path?token=secret".to_string()),
device_hwid: Some("hwid-abcdef1234".to_string()),
selected_server_tag: Some("nl-1".to_string()),
listen_host: "127.0.0.1".to_string(),
listen_port: 1080,
@@ -91,6 +92,10 @@ fn roundtrips_local_singbox_config_and_subscription_cache() {
config.subscription_display_url(),
Some("https://sub.example.test/...".to_string())
);
assert_eq!(
config.device_hwid_display(),
Some("hwid...1234".to_string())
);
cleanup(&root);
}
@@ -104,6 +109,7 @@ fn missing_local_singbox_config_defaults_to_optional_empty_state() {
.expect("read default local sing-box config");
assert_eq!(config.subscription_url, None);
assert_eq!(config.device_hwid, None);
assert_eq!(config.selected_server_tag, None);
assert_eq!(config.listen_host, "127.0.0.1");
assert_eq!(config.listen_port, 1080);