| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #!/usr/bin/env python3
- """domain_updater.py
- Facade entry point for vmess-domain-rotator.
- Delegates implementation to the modular rotator package while maintaining 100% backward compatibility
- for command line arguments and external python callers.
- """
- import sys
- import os
- # 确保可以直接导入同目录下的 rotator 包
- SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
- if SCRIPT_DIR not in sys.path:
- sys.path.insert(0, SCRIPT_DIR)
- from rotator.config import (
- build_output_settings,
- build_url,
- get_source_type,
- parse_timezone,
- print_output_settings,
- resolve_path,
- to_float_or_none,
- validate_config,
- )
- from rotator.filter import (
- DOMAIN_RE,
- IPV4_RE,
- apply_filter,
- collect_excluded_domains,
- flatten_values,
- get_by_json_path,
- get_values_by_path,
- normalize_domain,
- resolve_field,
- rule_matches,
- )
- from rotator.main import main, run_updater
- from rotator.notify import run_notify
- from rotator.scoring import (
- base_top_candidate,
- build_api_candidate,
- build_cfst_candidate,
- build_lexicographic_descriptors,
- build_top_candidates,
- choose_domain,
- choose_top_candidate_domains,
- cmp_scalar,
- get_sort_field_value,
- maybe_resolve_field,
- parse_created_time,
- parse_scored_records,
- rank_scored_records,
- set_if_nonempty_text,
- text_or_blank,
- )
- from rotator.sources import (
- extract_records,
- fetch_api_json,
- load_cfst_rows,
- parse_domains,
- )
- from rotator.storage import (
- _atomic_write,
- read_json_file,
- utc_now_iso,
- write_json_file,
- write_text_file,
- )
- __all__ = [
- "DOMAIN_RE",
- "IPV4_RE",
- "_atomic_write",
- "apply_filter",
- "base_top_candidate",
- "build_api_candidate",
- "build_cfst_candidate",
- "build_lexicographic_descriptors",
- "build_output_settings",
- "build_top_candidates",
- "build_url",
- "choose_domain",
- "choose_top_candidate_domains",
- "cmp_scalar",
- "collect_excluded_domains",
- "extract_records",
- "fetch_api_json",
- "flatten_values",
- "get_by_json_path",
- "get_sort_field_value",
- "get_source_type",
- "get_values_by_path",
- "load_cfst_rows",
- "main",
- "maybe_resolve_field",
- "normalize_domain",
- "parse_created_time",
- "parse_domains",
- "parse_scored_records",
- "parse_timezone",
- "print_output_settings",
- "rank_scored_records",
- "read_json_file",
- "resolve_field",
- "resolve_path",
- "rule_matches",
- "run_notify",
- "run_updater",
- "set_if_nonempty_text",
- "text_or_blank",
- "to_float_or_none",
- "utc_now_iso",
- "validate_config",
- "write_json_file",
- "write_text_file",
- ]
- if __name__ == "__main__":
- main()
|