feat: support vmess, trojan, and hysteria2

This commit is contained in:
zhom committed 2026-10-05 20:13:47 +04:00
1 parent c098f82806
commit 4ee54cf9f4
52 files changed
+4325 -1191

No files matched your search

+11 -1
View File
@@ -1338,6 +1338,9 @@ fn manager_error_response(err: impl std::fmt::Display) -> (StatusCode, String) {
// two things that don't go together, not a fault of this machine.
|| lower.contains("is not compatible with")
|| lower.contains("not supported for browser")
// A proxy import body that is not JSON is the caller's input, not a fault
// here; the spec for /v1/proxies/import already promises 400 for it.
|| lower.contains("invalid json format")
{
StatusCode::BAD_REQUEST
} else {
@@ -1587,7 +1590,7 @@ async fn create_profile(
// Apply tags if provided
if let Some(tags) = &request.tags {
if profile_manager
.update_profile_tags(&state.app_handle, &profile.name, tags.clone())
.update_profile_tags(&state.app_handle, &profile.id.to_string(), tags.clone())
.is_err()
{
return Err((
@@ -6103,6 +6106,13 @@ mod tests {
assert_eq!(status, StatusCode::NOT_FOUND);
}
#[test]
fn a_proxy_import_body_that_is_not_json_is_a_bad_request() {
let (status, _) =
manager_error_response("Invalid JSON format: expected value at line 1 column 1");
assert_eq!(status, StatusCode::BAD_REQUEST);
}
#[test]
fn an_extension_write_names_exactly_one_source() {
use base64::Engine as _;