feat: автоопределение low-RAM роутеров и zram-swap, парсинг @ в URL query и устойчивость к отключенному IPv6

This commit is contained in:
Dushnilin
2026-09-06 14:31:45 +03:00
parent fd79c4e317
commit 85df236727
12 changed files with 210 additions and 31 deletions
+18
View File
@@ -62,4 +62,22 @@ assert_eq direct-1-out \
"$(ucode "$HELPERS_UC" outbound-tag direct-1)" \
"numbered direct outbound tag"
COMPLEX_URL="vless://my-uuid-123@proxy.example.com:8443?authority=user@channel&service_name=grpc-service#my-node"
assert_eq vless "$(ucode "$HELPERS_UC" url-get-scheme "$COMPLEX_URL")" "url-get-scheme"
assert_eq my-uuid-123 "$(ucode "$HELPERS_UC" url-get-userinfo "$COMPLEX_URL")" "url-get-userinfo"
assert_eq proxy.example.com "$(ucode "$HELPERS_UC" url-get-host "$COMPLEX_URL")" "url-get-host"
assert_eq 8443 "$(ucode "$HELPERS_UC" url-get-port "$COMPLEX_URL")" "url-get-port"
assert_eq grpc-service "$(ucode "$HELPERS_UC" url-get-query-param "$COMPLEX_URL" service_name)" "url-get-query-param"
# Verify core.url module directly
assert_eq proxy.example.com \
"$(ucode -e 'let u = require("core.url"); print(u.host(ARGV[0]));' "$COMPLEX_URL")" \
"core.url host"
assert_eq 8443 \
"$(ucode -e 'let u = require("core.url"); print(u.port(ARGV[0]));' "$COMPLEX_URL")" \
"core.url port"
assert_eq my-uuid-123 \
"$(ucode -e 'let u = require("core.url"); print(u.userinfo(ARGV[0]));' "$COMPLEX_URL")" \
"core.url userinfo"
printf 'core helpers checks passed\n'
+7
View File
@@ -44,6 +44,13 @@ assert(ip.ip_family("abc") == 0, "family of abc is 0");
// format_ipv6_tproxy_target
assert(ip.format_ipv6_tproxy_target("2001:db8::1", 1234) == "[2001:db8::1]:1234", "format IPv6 target");
// ipv6_supported function exists and returns boolean
assert(type(ip.ipv6_supported()) == "bool", "ipv6_supported returns bool");
'
# Test override environment variable
[ "$(TACHYON_ENABLE_IPV6=0 ucode -L "$TACHYON_LIB" -e 'let ip = require("core.ip"); print(ip.ipv6_supported() ? "true" : "false");')" = "false" ] || { echo "ipv6 override 0 failed" >&2; exit 1; }
[ "$(TACHYON_ENABLE_IPV6=1 ucode -L "$TACHYON_LIB" -e 'let ip = require("core.ip"); print(ip.ipv6_supported() ? "true" : "false");')" = "true" ] || { echo "ipv6 override 1 failed" >&2; exit 1; }
printf 'core/ip checks passed\n'
+7
View File
@@ -45,6 +45,13 @@ assert(url.github_to_jsdelivr("https://raw.githubusercontent.com/owner/repo/main
// download_candidates
let candidates = url.download_candidates("https://github.com/owner/repo/blob/main/hosts");
assert(candidates[0] == "https://raw.githubusercontent.com/owner/repo/main/hosts", "download_candidates first entry normalized");
// authority, host, port, userinfo with @ in query parameters
let complex = "vless://user-uuid@example.com:8443?authority=name@channel&mode=gun#my-fragment";
assert(url.authority(complex) == "example.com:8443", "authority strips userinfo and query with @");
assert(url.host(complex) == "example.com", "host with @ in query parameters");
assert(url.port(complex) == "8443", "port with @ in query parameters");
assert(url.userinfo(complex) == "user-uuid", "userinfo with @ in query parameters");
'
printf 'core/url checks passed\n'