fix: update workflow fixes

This commit is contained in:
fufsob committed 2026-10-06 05:04:50 +00:00
1 parent a435942b4f
commit 41d3575345
6 files changed
+92 -5

No files matched your search

+13
View File
@@ -15,6 +15,7 @@ import os
import secrets
import urllib.parse
import inbound_runtime
from awg_inbound import client_entries
from proxy_parsing import build_outbound
@@ -222,10 +223,22 @@ def render_xray_inbound(listener: dict) -> dict:
if len(users) == 1:
settings["password"] = _user_secret(users[0], listener_type, tag)
settings["email"] = users[0].get("name") or f"{tag}-0"
keys = [(settings["email"], settings["password"])]
else:
# Multi-user is 2022-blake3-aes only: the server key, then one key per user.
settings["password"] = _server_secret(listener, tag)
settings["clients"] = _clients(listener, tag)
keys = [("server", settings["password"])] + [(c["email"], c["password"]) for c in settings["clients"]]
# Keys from files are only seen here; XRay refuses one of another length with a bare
# "bad key" and does not start at all.
method = listener["method"]
if method in inbound_runtime.SS2022_KEY_BYTES:
for name, key in keys:
if not inbound_runtime._ss2022_key_ok(key, method):
raise ValueError(
f"listener '{tag}': the {name} key is not base64 of "
f"{inbound_runtime.SS2022_KEY_BYTES[method]} bytes, as {method} needs"
)
elif listener_type in ("socks", "http"):
settings = {"auth": "password", "accounts": _accounts(listener, tag)}
if listener_type == "socks":
+13
View File
@@ -242,6 +242,19 @@ class RenderInboundTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, "no server password"):
render_xray_inbound(multi_user_shadowsocks(serverPassword=None))
def test_shadowsocks_2022_key_of_wrong_length_is_rejected(self):
# 20 bytes for a 16-byte method: XRay would fail its whole start on it.
with tempfile.TemporaryDirectory() as tmp:
key_path = os.path.join(tmp, "password")
with open(key_path, "w", encoding="utf-8") as handle:
handle.write("dGhpcy1pcy1hLTE2Ynl0ZS1rZXk=\n")
with self.assertRaisesRegex(ValueError, "the ss key is not base64 of 16 bytes"):
render_xray_inbound(
listener(type="shadowsocks", users=[{"name": "ss", "password": None, "passwordFile": key_path}])
)
with self.assertRaisesRegex(ValueError, "the server key is not base64 of 16 bytes"):
render_xray_inbound(multi_user_shadowsocks(serverPassword="c2hvcnQ="))
def test_socks_accounts_and_udp(self):
ib = render_xray_inbound(
listener(type="socks", users=[{"name": "me", "password": "pw", "passwordFile": None}])