Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Update subconverter
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Sep 21, 2021
1 parent ff5793e commit 6fbedb0
Show file tree
Hide file tree
Showing 8 changed files with 934 additions and 0 deletions.
30 changes: 30 additions & 0 deletions subconverter/config/example_external_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version = 1
[custom]
enable_rule_generator = false
overwrite_original_rules = false

# Options for custom base configuration file
clash_rule_base = "base/forcerule.yml"
#surge_rule_base = "base/surge.conf"
#surfboard_rule_base = "base/surfboard.conf"
#mellow_rule_base = "base/mellow.conf"
#quan_rule_base = "base/quan.conf"
#quanx_rule_base = "base/quanx.conf"

# Options for adding emojis
#add_emoji = true
#remove_old_emoji = true

# Options for filtering nodes
#include_remarks = []
#exclude_remarks = []

[[custom_groups]]
import = "snippets/groups_forcerule.toml"

#[[rulesets]]
#import = ""

[[template_args]]
key = "clash.dns.port"
value = "5353"
322 changes: 322 additions & 0 deletions subconverter/pref.example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
version = 1
[common]
# API mode, set to true to prevent loading local subscriptions or serving local files directly
api_mode = false

# Access token used for performing critical action through Web interface
api_access_token = "password"

# Default URLs, used when no URL is provided in request, use "|" to separate multiple subscription links, supports local files/URL
default_url = []

# Insert subscription links to requests. Can be used to add node(s) to all exported subscriptions.
enable_insert = true
# URLs to insert before subscription links, can be used to add node(s) to all exported subscriptions, supports local files/URL
insert_url = [""]
# Prepend inserted URLs to subscription links. Nodes in insert_url will be added to groups first with non-group-specific match pattern.
prepend_insert_url = true

# Exclude nodes which remarks match the following patterns. Supports regular expression.
exclude_remarks = ["(到期|剩余流量|时间|官网|产品)"]

# Only include nodes which remarks match the following patterns. Supports regular expression.
#include_remarks = ["V3.*港"]

# Enable script support for filtering nodes
enable_filter = false
# 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.
# Example: Inline script: Set value to content of script.
# Script path: Set value to "path:/path/to/script.js".
#filter_script = '''
#function filter(node) {
# const info = JSON.parse(node.ProxyInfo);
# if(info.EncryptMethod.includes('chacha20'))
# return true;
# return false;
#}
#'''

# Setting an external config file as default when none is specified, supports local files/URL
# default_external_config = "config/example_external_config.toml"

# The file scope limit of the 'rule_base' options in external configs.
base_path = "base"

# Clash config base used by the generator, supports local files/URL
clash_rule_base = "base/all_base.tpl"

# Surge config base used by the generator, supports local files/URL
surge_rule_base = "base/all_base.tpl"

# Surfboard config base used by the generator, supports local files/URL
surfboard_rule_base = "base/all_base.tpl"

# Mellow config base used by the generator, supports local files/URL
mellow_rule_base = "base/all_base.tpl"

# Quantumult config base used by the generator, supports local files/URL
quan_rule_base = "base/all_base.tpl"

# Quantumult X config base used by the generator, supports local files/URL
quanx_rule_base = "base/all_base.tpl"

# Loon config base used by the generator, supports local files/URL
loon_rule_base = "base/all_base.tpl"

# Shadowsocks Android config base used by the generator, supports local files/URL
sssub_rule_base = "base/all_base.tpl"

# Proxy used to download rulesets or subscriptions, set to NONE or empty to disable it, set to SYSTEM to use system proxy.
# Accept cURL-supported proxies (http:// https:// socks4a:// socks5://)

proxy_config = "SYSTEM"
proxy_ruleset = "SYSTEM"
proxy_subscription = "NONE"

# Append a proxy type string ([SS] [SSR] [VMess]) to node remark.
append_proxy_type = false

[[userinfo.stream_rule]]
# Rules to extract stream data from node
# Format: full_match_regex|new_format_regex
# where new_format_regex should be like "total=$1&left=$2&used=$3"
match = '^剩余流量:(.*?)\|总流量:(.*)$'
replace = 'total=$2&left=$1'

[[userinfo.stream_rule]]
match = '^剩余流量:(.*?) (.*)$'
replace = 'total=$1&left=$2'

[[userinfo.stream_rule]]
match = '^Bandwidth: (.*?)/(.*)$'
replace = 'used=$1&total=$2'

[[userinfo.stream_rule]]
match = '^.*剩余(.*?)(?:\s*?)@(?:.*)$'
replace = 'total=$1'

[[userinfo.time_rule]]
# Rules to extract expire time data from node
# Format: full_match_regex|new_format_regex
# where new_format_regex should follow this example: yyyy:mm:dd:hh:mm:ss
match = '^过期时间:(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)$'
replace = '$1:$2:$3:$4:$5:$6'

[[userinfo.time_rule]]
match = '^到期时间:(\d+)-(\d+)-(\d+)$'
replace = '$1:$2:$3:0:0:0'

[[userinfo.time_rule]]
match = '^Smart Access expire: (\d+)/(\d+)/(\d+)$'
replace = '$1:$2:$3:0:0:0'

[node_pref]
udp_flag = true
tcp_fast_open_flag = false
skip_cert_verify_flag = true
tls13_flag = false

sort_flag = false
# 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.
# Examples can be seen at the filter_script option in [common] section.
#sort_script = '''
#function compare(node_a, node_b) {
# return info_a.Remark > info_b.Remark;
#}
#'''

filter_deprecated_nodes = false
append_sub_userinfo = true
clash_use_new_field_name = true

# Generate style of the proxies section of Clash subscriptions.
# Supported styles: block, flow, compact
# Block: - name: name1 Flow: - {name: name1, key: value} Compact: [{name: name1, key: value},{name: name2, key: value}]
# key: value - {name: name2, key: value}
# - name: name2
# key: value
clash_proxies_style = "flow"

[[node_pref.rename_node]]
match = '\(?((x|X)?(\d+)(\.?\d+)?)((\s?倍率?)|(x|X))\)?'
replace = "$1x"

[managed_config]
# Append a '#!MANAGED-CONFIG' info to Surge configurations
write_managed_config = true

# Address prefix for MANAGED-CONFIG info, without the trailing "/".
managed_config_prefix = "http://127.0.0.1:25500"

# Managed config update interval in seconds, determine how long the config will be updated.
config_update_interval = 86400

# If config_update_strict is set to true, Surge will require a force update after the interval.
config_update_strict = false

# Device ID to be written to rewrite scripts for some version of Quantumult X
quanx_device_id = ""

[surge_external_proxy]
#surge_ssr_path = "/usr/bin/ssr-local"
resolve_hostname = true

[emojis]
add_emoji = false
remove_old_emoji = true

[[emojis.emoji]]
#match = '(流量|时间|应急)'
#emoji = '🏳️‍🌈'
import = "snippets/emoji.toml"

# [[custom_groups]]
# name = "Auto"
# type = "url-test"
# rule = [".*"]
# url = "http://www.gstatic.com/generate_204"
# interval = 300
# tolerance = 150
# lazy = true

# [[custom_groups]]
# name = "Proxy"
# type = "select"
# rule = [".*", "[]DIRECT"]
# disable_udp = false

# [[custom_groups]]
# name = "LoadBalance"
# type = "load-balance"
# rule = [".*", "[]Proxy", "[]DIRECT"]
# interval = 100
# strategy = "consistent-hashing"
# url = "http://www.gstatic.com/generate_204"

[[custom_groups]]
import = "snippets/groups.toml"

[ruleset]
# Enable generating rules with rulesets
enabled = true

# Overwrite the existing rules in rule_base
overwrite_original_rules = false

# Perform a ruleset update on request
update_ruleset_on_request = false

# [[rulesets]]
# group = "Proxy"
# ruleset = "https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Unbreak.list"
# type = "surge-ruleset"
# interval = 86400

[[rulesets]]
import = "snippets/rulesets.toml"

[template]
template_path = "template"

[[template.globals]]
key = "clash.http_port"
value = "7890"

[[template.globals]]
key = "clash.socks_port"
value = "7891"

[[template.globals]]
key = "clash.allow_lan"
value = "true"

[[template.globals]]
key = "clash.log_level"
value = "info"

[[aliases]]
uri = "/clash"
target = "/sub?target=clash"

[[aliases]]
uri = "/clashr"
target = "/sub?target=clashr"

[[aliases]]
uri = "/surge"
target = "/sub?target=surge"

[[aliases]]
uri = "/quan"
target = "/sub?target=quan"

[[aliases]]
uri = "/quanx"
target = "/sub?target=quanx"

[[aliases]]
uri = "/mellow"
target = "/sub?target=mellow"

[[aliases]]
uri = "/surfboard"
target = "/sub?target=surfboard"

[[aliases]]
uri = "/loon"
target = "/sub?target=loon"

[[aliases]]
uri = "/ss"
target = "/sub?target=ss"

[[aliases]]
uri = "/ssd"
target = "/sub?target=ssd"

[[aliases]]
uri = "/sssub"
target = "/sub?target=sssub"

[[aliases]]
uri = "/ssr"
target = "/sub?target=ssr"

[[aliases]]
uri = "/v2ray"
target = "/sub?target=v2ray"

[[aliases]]
uri = "/trojan"
target = "/sub?target=trojan"

[[aliases]]
uri = "/test"
target = "/render?path=templates/test.tpl"

#[[tasks]]
#name = "tick"
#cronexp = "0/10 * * * * ?"
#path = "tick.js"
#timeout = 3

[server]
listen = "0.0.0.0"
port = 25500
serve_file_root = "web"

[advanced]
log_level = "debug"
print_debug_info = true
max_pending_connections = 10240
max_concurrent_threads = 4
max_allowed_rulesets = 64
max_allowed_rules = 0
max_allowed_download_size = 0
enable_cache = true
cache_subscription = 60
cache_config = 300
cache_ruleset = 21600
script_clean_context = true
async_fetch_ruleset = false
skip_failed_links = true
Loading

0 comments on commit 6fbedb0

Please sign in to comment.