config.example.json 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. "api": {
  3. "url": "https://example.com/api/domains",
  4. "method": "GET",
  5. "headers": {
  6. "Authorization": "Bearer <token>"
  7. },
  8. "params": {
  9. "page": 1
  10. },
  11. "body": null,
  12. "timeout_sec": 10
  13. },
  14. "parser": {
  15. "field_paths": [
  16. "data.good[].ip"
  17. ],
  18. "json_paths": [],
  19. "regex": "[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
  20. },
  21. "record_mapping": {
  22. "_comment_required": "必填。记录白名单注册表:所有在过滤/排序里会用到的 API 字段都必须先在 field_map 注册,否则会 fail-fast。",
  23. "records_path": "data.good[]",
  24. "field_map": {
  25. "domain": "ip",
  26. "created_at": "createdTime",
  27. "avg_score": "avgScore",
  28. "yd_score": "ydScore",
  29. "dx_score": "dxScore",
  30. "lt_score": "ltScore",
  31. "avg_latency": "avgLatency",
  32. "avg_pkg_lost_rate": "avgPkgLostRate",
  33. "yd_latency": "ydLatency",
  34. "yd_pkg_lost_rate": "ydPkgLostRate",
  35. "lt_latency": "ltLatency",
  36. "lt_pkg_lost_rate": "ltPkgLostRate",
  37. "dx_latency": "dxLatency",
  38. "dx_pkg_lost_rate": "dxPkgLostRate",
  39. "location_country": "locationCountry",
  40. "location_city": "locationCity"
  41. },
  42. "created_time_formats": [
  43. "%Y-%m-%d %H:%M:%S"
  44. ],
  45. "created_time_timezone": "UTC"
  46. },
  47. "record_filter": {
  48. "_comment": "可选。按记录字段排除候选(字段名必须来自 record_mapping.field_map)。",
  49. "enabled": false,
  50. "exclude_if_any": [
  51. {
  52. "field": "location_country",
  53. "contains": "泛播",
  54. "case_sensitive": false
  55. },
  56. {
  57. "field": "location_city",
  58. "contains": "泛播",
  59. "case_sensitive": false
  60. },
  61. {
  62. "field": "domain",
  63. "regex": "(test|staging)",
  64. "case_sensitive": false
  65. }
  66. ]
  67. },
  68. "domain_filter": {
  69. "include_suffixes": [],
  70. "exclude_regex": [
  71. "^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}$"
  72. ]
  73. },
  74. "scoring": {
  75. "_comment_required": "enabled=true 时必须配置 strategy。weighted_average 需 weighted_fields;lexicographic 需 lexicographic_fields。",
  76. "enabled": true,
  77. "strategy": "weighted_average",
  78. "weighted_fields": [
  79. {
  80. "field": "avg_score",
  81. "weight": 0.5
  82. },
  83. {
  84. "field": "yd_score",
  85. "weight": 0.2
  86. },
  87. {
  88. "field": "dx_score",
  89. "weight": 0.1
  90. },
  91. {
  92. "field": "lt_score",
  93. "weight": 0.2
  94. }
  95. ],
  96. "lexicographic_fields": [
  97. {
  98. "field": "avg_score",
  99. "order": "desc"
  100. },
  101. {
  102. "field": "created_at",
  103. "order": "desc"
  104. }
  105. ],
  106. "prefer_lower": false,
  107. "within_hours": 24,
  108. "tie_breakers": [
  109. {
  110. "field": "created_at",
  111. "order": "desc"
  112. },
  113. {
  114. "field": "domain",
  115. "order": "asc"
  116. }
  117. ]
  118. },
  119. "healthcheck": {
  120. "enabled": false,
  121. "attempts": 2,
  122. "timeout_ms": 1800,
  123. "port": 443,
  124. "tls_verify": true
  125. },
  126. "selection": {
  127. "top_n": 3
  128. },
  129. "output": {
  130. "runtime_dir": "./runtime",
  131. "current_domain_file": "current_domain.txt",
  132. "current_domain_json": "current_domain.json",
  133. "state_file": "state.json",
  134. "substore_vars_file": "substore_vars.json"
  135. },
  136. "v2ray": {
  137. "template_file": "",
  138. "output_file": "",
  139. "replace_token": "__AUTO_DOMAIN__"
  140. },
  141. "notify": {
  142. "command": ""
  143. }
  144. }