pref.example.toml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. version = 1
  2. [common]
  3. # API mode, set to true to prevent loading local subscriptions or serving local files directly
  4. api_mode = false
  5. # Access token used for performing critical action through Web interface
  6. api_access_token = "password"
  7. # Default URLs, used when no URL is provided in request, use "|" to separate multiple subscription links, supports local files/URL
  8. default_url = []
  9. # Insert subscription links to requests. Can be used to add node(s) to all exported subscriptions.
  10. enable_insert = true
  11. # URLs to insert before subscription links, can be used to add node(s) to all exported subscriptions, supports local files/URL
  12. insert_url = [""]
  13. # Prepend inserted URLs to subscription links. Nodes in insert_url will be added to groups first with non-group-specific match pattern.
  14. prepend_insert_url = true
  15. # Exclude nodes which remarks match the following patterns. Supports regular expression.
  16. exclude_remarks = ["(到期|剩余流量|时间|官网|产品)"]
  17. # Only include nodes which remarks match the following patterns. Supports regular expression.
  18. #include_remarks = ["V3.*港"]
  19. # Enable script support for filtering nodes
  20. enable_filter = false
  21. # Script used for filtering nodes. Supports inline script and script path. A "filter" function with 1 argument which is a node should be defined in the script.
  22. # Example: Inline script: set value to content of script.
  23. # Script path: set value to "path:/path/to/script.js".
  24. #filter_script = '''
  25. #function filter(node) {
  26. # const info = JSON.parse(node.ProxyInfo);
  27. # if(info.EncryptMethod.includes('chacha20'))
  28. # return true;
  29. # return false;
  30. #}
  31. #'''
  32. # Setting an external config file as default when none is specified, supports local files/URL
  33. # default_external_config = "config/example_external_config.toml"
  34. # The file scope limit of the 'rule_base' options in external configs.
  35. base_path = "base"
  36. # Clash config base used by the generator, supports local files/URL
  37. clash_rule_base = "base/all_base.tpl"
  38. # Surge config base used by the generator, supports local files/URL
  39. surge_rule_base = "base/all_base.tpl"
  40. # Surfboard config base used by the generator, supports local files/URL
  41. surfboard_rule_base = "base/all_base.tpl"
  42. # Mellow config base used by the generator, supports local files/URL
  43. mellow_rule_base = "base/all_base.tpl"
  44. # Quantumult config base used by the generator, supports local files/URL
  45. quan_rule_base = "base/all_base.tpl"
  46. # Quantumult X config base used by the generator, supports local files/URL
  47. quanx_rule_base = "base/all_base.tpl"
  48. # Loon config base used by the generator, supports local files/URL
  49. loon_rule_base = "base/all_base.tpl"
  50. # Shadowsocks Android config base used by the generator, supports local files/URL
  51. sssub_rule_base = "base/all_base.tpl"
  52. # sing-box config base used by the generator, supports local files/URL
  53. singbox_rule_base = "base/all_base.tpl"
  54. # Proxy used to download rulesets or subscriptions, set to NONE or empty to disable it, set to SYSTEM to use system proxy.
  55. # Accept cURL-supported proxies (http:// https:// socks4a:// socks5://)
  56. proxy_config = "SYSTEM"
  57. proxy_ruleset = "SYSTEM"
  58. proxy_subscription = "NONE"
  59. # Append a proxy type string ([SS] [SSR] [VMess]) to node remark.
  60. append_proxy_type = false
  61. # When requesting /sub, reload this config file first.
  62. reload_conf_on_request = false
  63. [[userinfo.stream_rule]]
  64. # Rules to extract stream data from node
  65. # Format: full_match_regex|new_format_regex
  66. # where new_format_regex should be like "total=$1&left=$2&used=$3"
  67. match = '^剩余流量:(.*?)\|总流量:(.*)$'
  68. replace = 'total=$2&left=$1'
  69. [[userinfo.stream_rule]]
  70. match = '^剩余流量:(.*?) (.*)$'
  71. replace = 'total=$1&left=$2'
  72. [[userinfo.stream_rule]]
  73. match = '^Bandwidth: (.*?)/(.*)$'
  74. replace = 'used=$1&total=$2'
  75. [[userinfo.stream_rule]]
  76. match = '^.*剩余(.*?)(?:\s*?)@(?:.*)$'
  77. replace = 'total=$1'
  78. [[userinfo.time_rule]]
  79. # Rules to extract expire time data from node
  80. # Format: full_match_regex|new_format_regex
  81. # where new_format_regex should follow this example: yyyy:mm:dd:hh:mm:ss
  82. match = '^过期时间:(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)$'
  83. replace = '$1:$2:$3:$4:$5:$6'
  84. [[userinfo.time_rule]]
  85. match = '^到期时间:(\d+)-(\d+)-(\d+)$'
  86. replace = '$1:$2:$3:0:0:0'
  87. [[userinfo.time_rule]]
  88. match = '^Smart Access expire: (\d+)/(\d+)/(\d+)$'
  89. replace = '$1:$2:$3:0:0:0'
  90. [node_pref]
  91. #udp_flag = false
  92. #tcp_fast_open_flag = false
  93. #skip_cert_verify_flag = false
  94. #tls13_flag = false
  95. sort_flag = false
  96. # Script used for sorting nodes. A "compare" function with 2 arguments which are the 2 nodes to be compared should be defined in the script. Supports inline script and script path.
  97. # Examples can be seen at the filter_script option in [common] section.
  98. #sort_script = '''
  99. #function compare(node_a, node_b) {
  100. # return info_a.Remark > info_b.Remark;
  101. #}
  102. #'''
  103. filter_deprecated_nodes = false
  104. append_sub_userinfo = true
  105. clash_use_new_field_name = true
  106. # Generate style of the proxies and proxy groups section of Clash subscriptions.
  107. # Supported styles: block, flow, compact
  108. # Block: - name: name1 Flow: - {name: name1, key: value} Compact: [{name: name1, key: value},{name: name2, key: value}]
  109. # key: value - {name: name2, key: value}
  110. # - name: name2
  111. # key: value
  112. clash_proxies_style = "flow"
  113. clash_proxy_groups_style = "block"
  114. # add Clash mode to sing-box rules, and add a GLOBAL group to end of outbounds
  115. singbox_add_clash_modes = true
  116. [[node_pref.rename_node]]
  117. match = '\(?((x|X)?(\d+)(\.?\d+)?)((\s?倍率?)|(x|X))\)?'
  118. replace = "$1x"
  119. [managed_config]
  120. # Append a '#!MANAGED-CONFIG' info to Surge configurations
  121. write_managed_config = true
  122. # Address prefix for MANAGED-CONFIG info, without the trailing "/".
  123. managed_config_prefix = "http://127.0.0.1:25500"
  124. # Managed config update interval in seconds, determine how long the config will be updated.
  125. config_update_interval = 86400
  126. # If config_update_strict is set to true, Surge will require a force update after the interval.
  127. config_update_strict = false
  128. # Device ID to be written to rewrite scripts for some version of Quantumult X
  129. quanx_device_id = ""
  130. [surge_external_proxy]
  131. #surge_ssr_path = "/usr/bin/ssr-local"
  132. resolve_hostname = true
  133. [emojis]
  134. add_emoji = false
  135. remove_old_emoji = true
  136. [[emojis.emoji]]
  137. #match = '(流量|时间|应急)'
  138. #emoji = '🏳️‍🌈'
  139. import = "snippets/emoji.toml"
  140. # [[custom_groups]]
  141. # name = "Auto"
  142. # type = "url-test"
  143. # rule = [".*"]
  144. # url = "http://www.gstatic.com/generate_204"
  145. # interval = 300
  146. # tolerance = 150
  147. # lazy = true
  148. # [[custom_groups]]
  149. # name = "Proxy"
  150. # type = "select"
  151. # rule = [".*", "[]DIRECT"]
  152. # disable_udp = false
  153. # [[custom_groups]]
  154. # name = "LoadBalance"
  155. # type = "load-balance"
  156. # rule = [".*", "[]Proxy", "[]DIRECT"]
  157. # interval = 100
  158. # strategy = "consistent-hashing"
  159. # url = "http://www.gstatic.com/generate_204"
  160. [[custom_groups]]
  161. import = "snippets/groups.toml"
  162. [ruleset]
  163. # Enable generating rules with rulesets
  164. enabled = true
  165. # Overwrite the existing rules in rule_base
  166. overwrite_original_rules = false
  167. # Perform a ruleset update on request
  168. update_ruleset_on_request = false
  169. # [[rulesets]]
  170. # group = "Proxy"
  171. # ruleset = "https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Unbreak.list"
  172. # type = "surge-ruleset"
  173. # interval = 86400
  174. [[rulesets]]
  175. import = "snippets/rulesets.toml"
  176. [template]
  177. template_path = ""
  178. [[template.globals]]
  179. key = "clash.http_port"
  180. value = "7890"
  181. [[template.globals]]
  182. key = "clash.socks_port"
  183. value = "7891"
  184. [[template.globals]]
  185. key = "clash.allow_lan"
  186. value = "true"
  187. [[template.globals]]
  188. key = "clash.log_level"
  189. value = "info"
  190. [[template.globals]]
  191. key = "clash.external_controller"
  192. value = "127.0.0.1:9090"
  193. [[template.globals]]
  194. key = "singbox.allow_lan"
  195. value = "true"
  196. [[template.globals]]
  197. key = "singbox.mixed_port"
  198. value = "2080"
  199. [[aliases]]
  200. uri = "/clash"
  201. target = "/sub?target=clash"
  202. [[aliases]]
  203. uri = "/clashr"
  204. target = "/sub?target=clashr"
  205. [[aliases]]
  206. uri = "/surge"
  207. target = "/sub?target=surge"
  208. [[aliases]]
  209. uri = "/quan"
  210. target = "/sub?target=quan"
  211. [[aliases]]
  212. uri = "/quanx"
  213. target = "/sub?target=quanx"
  214. [[aliases]]
  215. uri = "/mellow"
  216. target = "/sub?target=mellow"
  217. [[aliases]]
  218. uri = "/surfboard"
  219. target = "/sub?target=surfboard"
  220. [[aliases]]
  221. uri = "/loon"
  222. target = "/sub?target=loon"
  223. [[aliases]]
  224. uri = "/singbox"
  225. target = "/sub?target=singbox"
  226. [[aliases]]
  227. uri = "/ss"
  228. target = "/sub?target=ss"
  229. [[aliases]]
  230. uri = "/ssd"
  231. target = "/sub?target=ssd"
  232. [[aliases]]
  233. uri = "/sssub"
  234. target = "/sub?target=sssub"
  235. [[aliases]]
  236. uri = "/ssr"
  237. target = "/sub?target=ssr"
  238. [[aliases]]
  239. uri = "/v2ray"
  240. target = "/sub?target=v2ray"
  241. [[aliases]]
  242. uri = "/trojan"
  243. target = "/sub?target=trojan"
  244. [[aliases]]
  245. uri = "/test"
  246. target = "/render?path=templates/test.tpl"
  247. #[[tasks]]
  248. #name = "tick"
  249. #cronexp = "0/10 * * * * ?"
  250. #path = "tick.js"
  251. #timeout = 3
  252. [server]
  253. listen = "0.0.0.0"
  254. port = 25500
  255. serve_file_root = "web"
  256. [advanced]
  257. log_level = "debug"
  258. print_debug_info = true
  259. max_pending_connections = 10240
  260. max_concurrent_threads = 4
  261. max_allowed_rulesets = 64
  262. max_allowed_rules = 0
  263. max_allowed_download_size = 0
  264. enable_cache = true
  265. cache_subscription = 60
  266. cache_config = 300
  267. cache_ruleset = 21600
  268. script_clean_context = true
  269. async_fetch_ruleset = false
  270. skip_failed_links = true