This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
VMess domain rotator - automated pipeline that fetches preferred domains from an API, selects the best candidate, and exports runtime files for Sub-Store and V2Ray integration.
# Syntax check Python scripts
python3 -m py_compile scripts/domain_updater.py
python3 -m py_compile scripts/update_vmess_links.py
# Manual run (single update)
python3 scripts/domain_updater.py --config config.json
# Manual run with conditional git commit (commits only if domain changed)
bash scripts/run_update_and_commit.sh config.json
# Update VMess base64 links with selected domain
python3 scripts/update_vmess_links.py --input ./nodes.txt --output ./nodes.updated.txt --domain-file ./runtime/current_domain.txt
# Update specific nodes by regex
python3 scripts/update_vmess_links.py --input ./nodes.txt --output ./nodes.updated.txt --domain-file ./runtime/current_domain.txt --name-regex "(argo|cf|vm)"
# Local smoke test HTTP endpoint for runtime outputs
python3 -m http.server 8080 --directory runtime
# Install systemd service+timer (uses current git repo directory)
sudo bash scripts/install_debian.sh
# Install with custom timer interval
sudo bash scripts/install_debian.sh --interval 5min
# Uninstall (keeps git repository and files)
sudo bash scripts/uninstall_debian.sh
scripts/domain_updater.py - Main entrypoint that:
config.json)last_good_domain from state.json if all checks failscripts/run_update_and_commit.sh - Scheduler entrypoint that:
runtime-state branch if domain changedscripts/update_vmess_links.py - Post-processor for VMess subscription links:
add field with selected domainconfig.json - Single runtime config file containing:
api: endpoint URL, method, headers, timeoutparser: JSON paths (field_paths) or regex for extracting domainsdomain_filter: include/exclude patterns (e.g., filter out IPv4 addresses)scoring: ranking logic based on API fields or API orderhealthcheck: TLS handshake verification settingsselection: top_n candidates to consideroutput: runtime directory and file pathsv2ray: template file token replacement (optional)All runtime outputs are written to runtime/:
current_domain.txt - Plain text domaincurrent_domain.json - JSON payload with domain, timestamp, status, source_countstate.json - Persistent state including last_good_domain for fallbacksubstore_vars.json - Variables for Sub-Store operator scriptssubstore/operator_template.js - Operator script that:
current_domain.json via HTTP using $substore.http.getserver field for nodes matching NODE_NAME_REGEXrun_update_and_commit.sh oneshotruntime-state branchlast_good_domain from runtime/state.jsonrun_update_and_commit.sh only commits when domain actually changesruntime-state branch via git worktreescoring.use_api_order=true to trust API rankingdomain_filter.exclude_regex to filter out IPv4 addresses when API returns mixed resultsscriptResourceCache with TTL to avoid excessive HTTP requestsFor vps789 Top20 API specifically:
parser.field_paths: ["data.good[].ip"]scoring.use_api_order: true to respect API rankinghealthcheck.enabled: false if you want pure API-based selectiondomain_filter.exclude_regex to filter out IP addressesmain (source code)runtime-state (auto-committed domain updates)vmess-domain-rotator@localhost