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:
1 parent
e5323284a8
commit
6e431d875e
25 files changed
+310
-227
No files matched your search
+22
-16
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user