|
|
3 viikkoa sitten | |
|---|---|---|
| runtime | 3 viikkoa sitten | |
| scripts | 3 viikkoa sitten | |
| substore | 3 viikkoa sitten | |
| systemd | 3 viikkoa sitten | |
| AGENTS.md | 3 viikkoa sitten | |
| README.md | 3 viikkoa sitten | |
| config.json | 3 viikkoa sitten |
This repo provides a first working version of an automated pipeline:
config.json directly (single runtime config file).For your sample response (data.good[].ip), parser config can be:
"parser": {
"field_paths": ["data.good[].ip"],
"json_paths": [],
"regex": "[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
}
For vps789 Top20 ranking, if you want "directly use first ranked domain":
"scoring": {
"enabled": true,
"records_path": "data.good[]",
"ip_field": "ip",
"created_time_field": "createdTime",
"within_hours": 24,
"use_api_order": true
}
Then set:
"healthcheck": { "enabled": false }
Run once:
python3 scripts/domain_updater.py --config config.json
Check output files:
runtime/current_domain.txtruntime/current_domain.jsonruntime/state.jsoncurrent_domain.txt: plain text domain.current_domain.json: machine-readable payload:
{
"domain": "best.example.com",
"updated_at": "2026-04-13T07:00:00Z",
"status": "ok",
"source_count": 15,
"checked_count": 10
}
state.json: includes last_good_domain for automatic fallback.
If you need Sub-Store to fetch these files over HTTP, you can expose runtime/ via nginx or caddy.
Two practical modes:
current_domain.json.substore/operator_template.js is a starter operator script showing how to replace VMess server fields by regex match on node names.
Minimal smoke test (local):
python3 -m http.server 8080 --directory runtime
Then test:
curl http://127.0.0.1:8080/current_domain.json
If you maintain a template config (containing __AUTO_DOMAIN__ token), this script can render a real config file with the selected domain.
Then reload service:
systemctl reload v2ray
If your node list uses vmess://<base64-json>, use:
python3 scripts/update_vmess_links.py \
--input ./nodes.txt \
--output ./nodes.updated.txt \
--domain-file ./runtime/current_domain.txt
Only update specific node names (ps) 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)"
If the whole subscription file is itself base64-encoded, add:
--subscription-base64
0 */12 * * * /bin/bash /opt/vmess-domain-rotator/scripts/run_update_and_commit.sh /opt/vmess-domain-rotator/config.json >> /var/log/vmess-domain-rotator.log 2>&1
Use files under systemd/ and adjust paths/user.
Default timer interval in this repo is 12h.
Install on a Debian server (creates systemd service+timer):
sudo bash scripts/install_debian.sh
This installer also initializes a git repo under app dir (if missing) and configures the service to auto-commit only when selected domain changes.
Uninstall:
sudo bash scripts/uninstall_debian.sh
Useful options:
sudo bash scripts/install_debian.sh --user root --group root --interval 5min
sudo bash scripts/uninstall_debian.sh --keep-app-dir
parser.json_paths (preferred)parser.regex fallbackhealthcheck.enabled=true.healthcheck.tls_verify=false.If you use Sub-Store web UI, rules are usually stored in backend data storage (sqlite/json), not a simple editable config file.
Common deployment cases:
data/ or database file.In practice, you can avoid touching backend db files directly:
current_domain.json from this project.current_domain.json publicly.runtime/state.json persisted (for fallback).