refactor(proxy-client): переименован интерфейс прокси

- Зачем:
  - прежнее имя выпячивало Xray, хотя клиент поддерживает также внешний прокси, а два каталога конфигурации были неочевидны.
- Что:
  - пакет, CLI, конфигурация, состояние, тесты и документация переименованы в proxy-client.
  - машинный конфиг, профиль и два явных примера собраны в одном пользовательском каталоге.
  - свежая установка защищена от сворачивания каталога конфигурации внутрь репозитория.
- Проверка:
  - bash tests/test_proxy_client_full.sh.
  - bash tests/test_install.sh.
  - ручные start, status и xray run -test; незавершённая сетевая приёмка записана в handoff.
This commit is contained in:
ddadmin committed 2026-07-21 09:31:21 -04:00
1 parent e5323284a8
commit 6e431d875e
25 files changed
+310 -227

No files matched your search

+22 -16
View File
@@ -38,7 +38,7 @@ setup_fixture() {
# stow конфликтами, поэтому в тестовое дерево не попадает.
git -C "$REPO_ROOT" ls-files -z --cached -- \
install.sh bash tmux vim zed vscode agents opencode codex gemini \
claude xray-proxy scripts \
claude proxy-client scripts \
| tar -C "$REPO_ROOT" --null -T - -cf - \
| tar -xf - -C "$repo_root"
@@ -97,8 +97,13 @@ test_fresh_install_uses_home_target() {
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >"$fixture/install.out"
[ -L "$home_dir/.bash_custom" ] || fail "Expected .bash_custom symlink in HOME"
[ -x "$home_dir/.local/bin/xray-proxy" ] || fail "Expected executable xray-proxy CLI in HOME"
[ -f "$home_dir/.config/xray-proxy/shell.bash" ] || fail "Expected xray-proxy shell module"
[ -x "$home_dir/.local/bin/proxy-client" ] || fail "Expected executable proxy-client CLI in HOME"
[ -d "$home_dir/.config/proxy-client" ] || fail "Expected proxy-client config directory"
[ ! -L "$home_dir/.config/proxy-client" ] || fail "Expected proxy-client config to stay outside the repository"
[ -f "$home_dir/.config/proxy-client/shell.bash" ] || fail "Expected proxy-client shell module"
[ -f "$home_dir/.config/proxy-client/examples/config.external" ] || fail "Expected external proxy config example"
[ -f "$home_dir/.config/proxy-client/examples/config.xray" ] || fail "Expected managed Xray config example"
assert_not_exists "$home_dir/.config/proxy-client/examples/config"
[ ! -e "$home_dir/README.md" ] || fail "Package README must not be stowed into HOME"
[ -L "$home_dir/.claude/skills" ] || fail "Expected ~/.claude/skills symlink"
assert_file_contains "$home_dir/.bashrc" "[ -f ~/.bash_custom ] && source ~/.bash_custom"
@@ -113,7 +118,7 @@ test_fresh_install_does_not_fold_config_into_zed() {
mkdir -p "$home_dir"
# Неполный клон: zed остаётся единственным stow-пакетом с каталогом .config.
mv "$repo_root/xray-proxy" "$fixture/xray-proxy-disabled"
mv "$repo_root/proxy-client" "$fixture/proxy-client-disabled"
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >"$fixture/install.out"
@@ -131,10 +136,10 @@ test_migrates_legacy_zed_config_symlink() {
repo_root="$fixture/repo"
home_dir="$fixture/home"
legacy_config="$repo_root/zed/.config"
mkdir -p "$home_dir" "$legacy_config/btop" "$legacy_config/xray-proxy"
mkdir -p "$home_dir" "$legacy_config/btop" "$legacy_config/proxy-client"
printf '%s\n' 'btop settings' > "$legacy_config/btop/btop.conf"
printf '%s\n' 'VLESS_PROFILE_SENTINEL' > "$legacy_config/xray-proxy/default.url"
chmod 600 "$legacy_config/xray-proxy/default.url"
printf '%s\n' 'VLESS_PROFILE_SENTINEL' > "$legacy_config/proxy-client/default.url"
chmod 600 "$legacy_config/proxy-client/default.url"
ln -s "$legacy_config" "$home_dir/.config"
if ! output="$(
@@ -149,19 +154,19 @@ test_migrates_legacy_zed_config_symlink() {
[ -L "$home_dir/.config/zed" ] || fail "Expected managed ~/.config/zed symlink"
[ -d "$home_dir/.config/btop" ] || fail "Expected btop config to be migrated"
[ ! -L "$home_dir/.config/btop" ] || fail "Expected btop config outside the repository"
[ -f "$home_dir/.config/xray-proxy/default.url" ] || fail "Expected profile to be migrated"
[ ! -L "$home_dir/.config/xray-proxy/default.url" ] || fail "Expected profile outside the repository"
mode="$(stat -c '%a' "$home_dir/.config/xray-proxy/default.url")"
[ -f "$home_dir/.config/proxy-client/default.url" ] || fail "Expected profile to be migrated"
[ ! -L "$home_dir/.config/proxy-client/default.url" ] || fail "Expected profile outside the repository"
mode="$(stat -c '%a' "$home_dir/.config/proxy-client/default.url")"
[ "$mode" = "600" ] || fail "Expected profile mode 600, got $mode"
assert_file_contains "$home_dir/.config/xray-proxy/default.url" "VLESS_PROFILE_SENTINEL"
assert_file_contains "$home_dir/.config/proxy-client/default.url" "VLESS_PROFILE_SENTINEL"
assert_not_exists "$legacy_config/btop"
assert_not_exists "$legacy_config/xray-proxy"
assert_not_exists "$legacy_config/proxy-client"
if printf '%s' "$output" | grep -Fq 'VLESS_PROFILE_SENTINEL'; then
fail "Secret profile leaked into install output"
fi
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >"$fixture/install.out"
assert_file_contains "$home_dir/.config/xray-proxy/default.url" "VLESS_PROFILE_SENTINEL"
assert_file_contains "$home_dir/.config/proxy-client/default.url" "VLESS_PROFILE_SENTINEL"
}
test_stops_legacy_migration_when_listing_fails() {
@@ -170,8 +175,8 @@ test_stops_legacy_migration_when_listing_fails() {
repo_root="$fixture/repo"
home_dir="$fixture/home"
legacy_config="$repo_root/zed/.config"
mkdir -p "$home_dir" "$legacy_config/xray-proxy"
printf '%s\n' 'VLESS_PROFILE_SENTINEL' > "$legacy_config/xray-proxy/default.url"
mkdir -p "$home_dir" "$legacy_config/proxy-client"
printf '%s\n' 'VLESS_PROFILE_SENTINEL' > "$legacy_config/proxy-client/default.url"
ln -s "$legacy_config" "$home_dir/.config"
cat > "$fixture/bin/find" <<'EOF'
@@ -190,7 +195,7 @@ EOF
target="$(readlink -f "$home_dir/.config")"
expected="$(readlink -f "$legacy_config")"
[ "$target" = "$expected" ] || fail "Legacy ~/.config target changed after listing failure"
assert_file_contains "$legacy_config/xray-proxy/default.url" "VLESS_PROFILE_SENTINEL"
assert_file_contains "$legacy_config/proxy-client/default.url" "VLESS_PROFILE_SENTINEL"
}
test_does_not_migrate_unrelated_config_symlink() {
@@ -213,6 +218,7 @@ test_does_not_migrate_unrelated_config_symlink() {
expected="$(readlink -f "$unrelated_config")"
[ "$target" = "$expected" ] || fail "Unrelated ~/.config symlink target changed"
assert_file_contains "$unrelated_config/local.conf" "keep me"
assert_not_exists "$unrelated_config/proxy-client"
}
test_settings_local_is_symlinked_to_repo() {
@@ -16,7 +16,7 @@ from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
CLI = REPO_ROOT / "xray-proxy/.local/bin/xray-proxy"
CLI = REPO_ROOT / "proxy-client/.local/bin/proxy-client"
class FakeUrlResponse:
@@ -71,7 +71,7 @@ SUCCESSFUL_SOCKET_SETUP = checking_socket_setup()
REFUSED_SOCKET_SETUP = checking_socket_setup("refused")
class XrayProxyCliTest(unittest.TestCase):
class ProxyClientCliTest(unittest.TestCase):
def setUp(self):
self.temp_dir = tempfile.TemporaryDirectory()
self.config_home = Path(self.temp_dir.name)
@@ -90,7 +90,7 @@ class XrayProxyCliTest(unittest.TestCase):
address="127.0.0.1",
no_proxy_extra=".example.test",
):
config_dir = self.config_home / "proxy"
config_dir = self.config_home / "proxy-client"
config_dir.mkdir(exist_ok=True)
(config_dir / "config").write_text(
"[proxy]\n"
@@ -105,7 +105,7 @@ class XrayProxyCliTest(unittest.TestCase):
)
def write_raw_config(self, content):
config_dir = self.config_home / "proxy"
config_dir = self.config_home / "proxy-client"
config_dir.mkdir(exist_ok=True)
path = config_dir / "config"
if isinstance(content, bytes):
@@ -167,7 +167,7 @@ class XrayProxyCliTest(unittest.TestCase):
self.assertEqual(2, result.returncode)
self.assertEqual("", result.stdout)
self.assertIn("укажите явную подкоманду", result.stderr)
self.assertFalse((self.config_home / "proxy").exists())
self.assertFalse((self.config_home / "proxy-client").exists())
def test_old_python_version_gets_clear_error_before_main_program(self):
code = (
@@ -269,7 +269,7 @@ class XrayProxyCliTest(unittest.TestCase):
self.assertEqual(7654321, wait_for_starttime(child))
def test_broken_config_symlink_is_not_treated_as_missing_config(self):
config_dir = self.config_home / "proxy"
config_dir = self.config_home / "proxy-client"
config_dir.mkdir()
(config_dir / "config").symlink_to(self.config_home / "missing-config")
result = self.run_cli("start")
@@ -651,7 +651,7 @@ class XrayInstallTest(unittest.TestCase):
def tree_snapshot_without_install_lock(self):
snapshot = self.tree_snapshot()
for path in ("state/xray-proxy/lock", "state/xray-proxy", "state"):
for path in ("state/proxy-client/lock", "state/proxy-client", "state"):
snapshot.pop(path, None)
return snapshot
@@ -662,7 +662,7 @@ class XrayInstallTest(unittest.TestCase):
)
def assert_install_lock_released(self):
lock_path = self.state_home / "xray-proxy/lock"
lock_path = self.state_home / "proxy-client/lock"
with lock_path.open("r+", encoding="ascii") as lock:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
@@ -692,8 +692,8 @@ class XrayInstallTest(unittest.TestCase):
"home/.local/bin",
"home/.local/bin/xray",
"state",
"state/xray-proxy",
"state/xray-proxy/lock",
"state/proxy-client",
"state/proxy-client/lock",
},
set(self.tree_snapshot()),
)
@@ -983,7 +983,7 @@ class XrayInstallTest(unittest.TestCase):
downloader = mock.Mock(side_effect=AssertionError("network used"))
guard = mock.Mock(
side_effect=self.module["ProxyError"](
"managed Xray работает; сначала выполните xray-proxy stop"
"managed Xray работает; сначала выполните proxy-client stop"
)
)
globals_ = self.module["command_install"].__globals__
@@ -1129,14 +1129,14 @@ class XrayInstallTest(unittest.TestCase):
self.assertEqual(sentinel, self.destination.read_bytes())
self.assert_no_staging()
lock_path = self.state_home / "xray-proxy/lock"
lock_path = self.state_home / "proxy-client/lock"
with lock_path.open("r+", encoding="ascii") as lock:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
self.assertEqual(before, self.tree_snapshot_without_install_lock())
def test_start_lock_is_held_during_download_and_through_replace(self):
downloader, _calls = self.downloader()
lock_path = self.state_home / "xray-proxy/lock"
lock_path = self.state_home / "proxy-client/lock"
def assert_lock_held():
with lock_path.open("r+", encoding="ascii") as competing:
@@ -1213,7 +1213,7 @@ class XrayInstallTest(unittest.TestCase):
def test_install_dispatches_before_machine_config_loading(self):
self.write_destination()
config = self.root / "config/proxy"
config = self.root / "config/proxy-client"
config.mkdir(parents=True)
(config / "config").write_text("not an ini\n", encoding="ascii")
environment = os.environ.copy()
File renamed without changes.
@@ -15,7 +15,7 @@ from urllib.parse import quote
REPO_ROOT = Path(__file__).resolve().parents[1]
CLI = REPO_ROOT / "xray-proxy/.local/bin/xray-proxy"
CLI = REPO_ROOT / "proxy-client/.local/bin/proxy-client"
UUID = "11111111-2222-4333-8444-555555555555"
PBK = "PUBLIC_KEY_SENTINEL_7f8a"
SID = "SHORT_ID_SENTINEL_9b3c"
@@ -185,7 +185,7 @@ class ManagedXrayCliTest(unittest.TestCase):
"FAKE_XRAY_LOG": str(self.log),
"FAKE_XRAY_VERSION": "Xray 26.3.27 (fake)",
"PROXY_PREFLIGHT_TIMEOUT": "0.5",
"XRAY_PROXY_STOP_TIMEOUT": "2",
"PROXY_CLIENT_STOP_TIMEOUT": "2",
}
)
self.port = self.free_port()
@@ -201,7 +201,7 @@ class ManagedXrayCliTest(unittest.TestCase):
return listener.getsockname()[1]
def write_machine_config(self, proxy_type):
directory = self.config_home / "proxy"
directory = self.config_home / "proxy-client"
directory.mkdir(parents=True, exist_ok=True)
(directory / "config").write_text(
"[proxy]\n"
@@ -217,7 +217,7 @@ class ManagedXrayCliTest(unittest.TestCase):
if explicit:
path = self.root / "chosen.url"
else:
path = self.config_home / "xray-proxy/default.url"
path = self.config_home / "proxy-client/default.url"
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(url + "\n", encoding="utf-8")
path.chmod(0o600)
@@ -257,7 +257,7 @@ class ManagedXrayCliTest(unittest.TestCase):
)
def wait_for_state(self, process):
state = self.state_home / "xray-proxy/state.json"
state = self.state_home / "proxy-client/state.json"
deadline = time.monotonic() + 5
while time.monotonic() < deadline:
if state.exists():
@@ -276,7 +276,7 @@ class ManagedXrayCliTest(unittest.TestCase):
return [json.loads(line) for line in self.log.read_text().splitlines()]
def managed_state_path(self):
return self.state_home / "xray-proxy/state.json"
return self.state_home / "proxy-client/state.json"
def read_state(self):
return json.loads(self.managed_state_path().read_text(encoding="utf-8"))
@@ -358,8 +358,8 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assertIn("ip-probe", kinds)
for entry in entries:
self.assertEqual(str(self.xray.resolve()), entry["executable"])
self.assertFalse((self.state_home / "xray-proxy/state.json").exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/state.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
self.assert_no_secrets(stdout + stderr + status.stdout + env.stdout, profile_text)
self.log.unlink()
self.port = self.free_port()
@@ -395,9 +395,9 @@ class ManagedXrayCliTest(unittest.TestCase):
profile_text = self.tcp_profile()
self.write_profile(profile_text)
process = self.start()
state_path = self.state_home / "xray-proxy/state.json"
config_path = self.state_home / "xray-proxy/client.json"
lock_path = self.state_home / "xray-proxy/lock"
state_path = self.state_home / "proxy-client/state.json"
config_path = self.state_home / "proxy-client/client.json"
lock_path = self.state_home / "proxy-client/lock"
state = json.loads(state_path.read_text(encoding="utf-8"))
config = json.loads(config_path.read_text(encoding="utf-8"))
self.assertEqual(0o600, state_path.stat().st_mode & 0o777)
@@ -456,7 +456,7 @@ class ManagedXrayCliTest(unittest.TestCase):
def test_held_lock_rejects_start_without_changing_managed_files(self):
profile_text = self.tcp_profile()
self.write_profile(profile_text)
state_dir = self.state_home / "xray-proxy"
state_dir = self.state_home / "proxy-client"
state_dir.mkdir(parents=True, mode=0o700)
state_path = state_dir / "state.json"
config_path = state_dir / "client.json"
@@ -496,7 +496,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.stop_and_collect(process)
def test_stale_cleanup_waits_for_start_lock_and_preserves_files(self):
state_dir = self.state_home / "xray-proxy"
state_dir = self.state_home / "proxy-client"
state_dir.mkdir(parents=True, mode=0o700)
state = {
"supervisor_pid": 999999998,
@@ -586,7 +586,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assertNotEqual(0, status.returncode)
self.assertIn("устаревшее", status.stderr)
self.assertFalse(self.managed_state_path().exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
self.assertTrue(Path("/proc/{}".format(state["xray_pid"])).exists())
os.kill(state["xray_pid"], signal.SIGKILL)
@@ -594,7 +594,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assert_no_secrets(stdout + stderr, profile_text)
def test_dead_pids_allow_stale_state_and_config_cleanup(self):
state_dir = self.state_home / "xray-proxy"
state_dir = self.state_home / "proxy-client"
state_dir.mkdir(parents=True, mode=0o700)
state = {
"supervisor_pid": 999999998,
@@ -638,7 +638,7 @@ class ManagedXrayCliTest(unittest.TestCase):
len([entry for entry in self.log_entries() if entry["kind"] == "run"]),
)
lock_path = self.state_home / "xray-proxy/lock"
lock_path = self.state_home / "proxy-client/lock"
with lock_path.open("r+", encoding="ascii") as lock:
with self.assertRaises(OSError):
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
@@ -662,7 +662,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assertEqual(0, stopped.returncode, stopped.stderr)
self.assertIn("сирот", stopped.stdout)
self.assertFalse(self.managed_state_path().exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
stdout, stderr = process.communicate(timeout=2)
self.assert_no_secrets(stdout + stderr + stopped.stdout, profile_text)
@@ -677,7 +677,7 @@ class ManagedXrayCliTest(unittest.TestCase):
def test_unverifiable_live_child_preserves_state_and_config(self):
profile_text = self.tcp_profile()
self.write_profile(profile_text)
self.environment["XRAY_PROXY_STOP_TIMEOUT"] = "0.2"
self.environment["PROXY_CLIENT_STOP_TIMEOUT"] = "0.2"
process = self.start()
state = self.read_state()
self.xray.unlink()
@@ -685,7 +685,7 @@ class ManagedXrayCliTest(unittest.TestCase):
os.kill(state["supervisor_pid"], signal.SIGTERM)
process.wait(timeout=3)
state_exists = self.managed_state_path().exists()
config_path = self.state_home / "xray-proxy/client.json"
config_path = self.state_home / "proxy-client/client.json"
config_exists = config_path.exists()
child_alive = Path("/proc/{}".format(state["xray_pid"])).exists()
if child_alive:
@@ -715,11 +715,11 @@ class ManagedXrayCliTest(unittest.TestCase):
process.wait(timeout=2)
stopped = self.run_cli(
"stop", environment={"XRAY_PROXY_STOP_TIMEOUT": "0.2"}
"stop", environment={"PROXY_CLIENT_STOP_TIMEOUT": "0.2"}
)
self.assertEqual(0, stopped.returncode, stopped.stderr)
self.assertFalse(self.managed_state_path().exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
signals = [
entry["signum"]
for entry in self.log_entries()
@@ -745,7 +745,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assertIn("занят", result.stderr)
self.assertEqual([], self.log_entries())
self.assertFalse(self.managed_state_path().exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
self.assert_no_secrets(result.stdout + result.stderr, profile_text)
def test_versions_and_profile_failures_stop_before_test_or_run_without_leaks(self):
@@ -930,8 +930,8 @@ class ManagedXrayCliTest(unittest.TestCase):
self.write_profile(profile_text)
process = self.start()
stdout, stderr = self.stop_and_collect(process)
self.assertFalse((self.state_home / "xray-proxy/state.json").exists())
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/state.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
self.assert_no_secrets(stdout + stderr, profile_text)
self.log.unlink()
self.port = self.free_port()
@@ -969,12 +969,12 @@ class ManagedXrayCliTest(unittest.TestCase):
self.assertNotEqual(0, result.returncode)
self.assertEqual(["version", "test"], [entry["kind"] for entry in self.log_entries()])
self.assert_no_secrets(result.stdout + result.stderr, profile_text)
self.assertFalse((self.state_home / "xray-proxy/client.json").exists())
self.assertFalse((self.state_home / "proxy-client/client.json").exists())
def test_xray_start_requires_loopback_before_selecting_binary(self):
profile_text = self.tcp_profile()
self.write_profile(profile_text)
config_path = self.config_home / "proxy/config"
config_path = self.config_home / "proxy-client/config"
config_path.write_text(
config_path.read_text(encoding="utf-8").replace(
"address = 127.0.0.1", "address = 192.0.2.10"
@@ -991,7 +991,7 @@ class ManagedXrayCliTest(unittest.TestCase):
listener = socket.socket()
listener.bind(("127.0.0.1", self.port))
listener.listen(1)
state_dir = self.state_home / "xray-proxy"
state_dir = self.state_home / "proxy-client"
state_dir.mkdir(parents=True)
state = {
"supervisor_pid": os.getpid(),
@@ -1021,7 +1021,7 @@ class ManagedXrayCliTest(unittest.TestCase):
listener = socket.socket()
listener.bind(("127.0.0.1", foreign_port))
listener.listen(1)
config_path = self.config_home / "proxy/config"
config_path = self.config_home / "proxy-client/config"
config_path.write_text(
config_path.read_text(encoding="utf-8").replace(
"port = {}".format(managed_port), "port = {}".format(foreign_port)
@@ -1056,7 +1056,7 @@ class ManagedXrayCliTest(unittest.TestCase):
self.write_profile(profile_text)
process = self.start()
state = json.loads(
(self.state_home / "xray-proxy/state.json").read_text(
(self.state_home / "proxy-client/state.json").read_text(
encoding="utf-8"
)
)
@@ -1077,12 +1077,12 @@ class ManagedXrayCliTest(unittest.TestCase):
def test_absolute_relative_and_path_symlink_cli_invocations_are_manageable(self):
proxy_bin = self.root / "proxy-bin"
proxy_bin.mkdir()
(proxy_bin / "xray-proxy").symlink_to(CLI)
(proxy_bin / "proxy-client").symlink_to(CLI)
invocations = (
([str(CLI)], self.root, self.environment),
([os.path.relpath(str(CLI), str(self.root))], self.root, self.environment),
(
["xray-proxy"],
["proxy-client"],
self.root,
dict(
self.environment,
@@ -1106,7 +1106,7 @@ class ManagedXrayCliTest(unittest.TestCase):
stderr=subprocess.PIPE,
env=environment,
)
state_path = self.state_home / "xray-proxy/state.json"
state_path = self.state_home / "proxy-client/state.json"
deadline = time.monotonic() + 3
while time.monotonic() < deadline and not state_path.exists():
if process.poll() is not None:
+3 -3
View File
@@ -4,7 +4,7 @@ set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
FUNCTIONS_FILE="$REPO_ROOT/bash/.bash_functions"
CUSTOM_FILE="$REPO_ROOT/bash/.bash_custom"
SHELL_MODULE="$REPO_ROOT/xray-proxy/.config/xray-proxy/shell.bash"
SHELL_MODULE="$REPO_ROOT/proxy-client/.config/proxy-client/shell.bash"
pass_count=0
@@ -52,10 +52,10 @@ assert_five_proxy_commands() {
# Обычная .bash_custom независимо подключает общие функции и proxy-модуль.
(
fixture="$(mktemp -d /tmp/proxy-bash-custom-test.XXXXXX)"
mkdir -p "$fixture/.config/xray-proxy"
mkdir -p "$fixture/.config/proxy-client"
ln -s "$CUSTOM_FILE" "$fixture/.bash_custom"
ln -s "$FUNCTIONS_FILE" "$fixture/.bash_functions"
ln -s "$SHELL_MODULE" "$fixture/.config/xray-proxy/shell.bash"
ln -s "$SHELL_MODULE" "$fixture/.config/proxy-client/shell.bash"
output="$(
HOME="$fixture" bash --noprofile --norc -ic '
source "$HOME/.bash_custom"