From 6f19a5971313d1817ee692c4b9b64b02b267943a Mon Sep 17 00:00:00 2001 From: vladimir Date: Fri, 3 Jul 2026 03:25:00 +0300 Subject: [PATCH] =?UTF-8?q?test:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BE=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D1=81=D0=BE=D0=B1=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20ShadowsocksO?= =?UTF-8?q?utbound?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/shadowsocks_outbound_sandbox.py | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/shadowsocks_outbound_sandbox.py diff --git a/tests/shadowsocks_outbound_sandbox.py b/tests/shadowsocks_outbound_sandbox.py new file mode 100644 index 0000000..91bc6ff --- /dev/null +++ b/tests/shadowsocks_outbound_sandbox.py @@ -0,0 +1,47 @@ +from xray_manager.core.outbound import ( + OutboundFactory, + OutboundSpec, + ShadowsocksOutbound, +) +from xray_manager.core.xray_config import XrayConfig +from xray_manager.core.xray_manager_config import XrayManagerConfig + +inbound = { + "tag": "shadowsocks", + "xrm": True, + "listen": "0.0.0.0", + "port": 8443, + "protocol": "shadowsocks", + "settings": { + "method": "2022-blake3-aes-256-gcm", + "password": "Z8WtMeWzZVh1F6/5URGrs8vWdB3CLN5y7A9D1U0Q65E=", + "clients": [ + { + "email": "test-fr1", + "password": "zV3qwuj5TUng+mBMfqdInp0ih7i9ykSIzUig3v5d1Bg=", + }, + { + "email": "test2-us1", + "password": "ZNtMDJ5WuaGa2ko2jMbbZguddcMY2TTirsb9cNYHffw=", + }, + ], + "network": "tcp,udp", + }, +} + +if __name__ == "__main__": + DEV_CONFIG_PATH = "tests/mock_data/etc/xray-manager/config.json" + xray_manager_config = XrayManagerConfig(DEV_CONFIG_PATH) + + target = "us1" + target_pretty_name = xray_manager_config.targets.get(target, {}).get( + "pretty_name", target + ) + + outbound = ShadowsocksOutbound.from_scratch( + target, target_pretty_name, "127.0.0.1", inbound + ) + + link = outbound.to_link() + o = ShadowsocksOutbound.from_link(xray_manager_config.targets, link) + print(o)