tindy2013 / subconverter

Utility to convert between various subscription format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] <title>使用action编译最新版本,转换的route规则中geoip拼写会变成“eoip”

TaoRone opened this issue · comments

确认版本最新

  • 我已经确认在最新Action编译的版本中复现

检索issue

  • 我已经确认之前没有issue涉及此BUG

subconverter版本

action 编译的x86-64版本 https://github.com/tindy2013/subconverter/actions/runs/8537758368

转换过程

任意协议配置

转换设置

[common]
# API mode, set to true to prevent loading local subscriptions or serving local files directly
api_mode = true

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

# 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"

# sing-box config base used by the generator, supports local files/URL
singbox_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

# When requesting /sub, reload this config file first.
reload_conf_on_request = 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"

# add Clash mode to sing-box rules, and add a GLOBAL group to end of outbounds
singbox_add_clash_modes = true

[[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.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"

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

[[template.globals]]
key = "singbox.mixed_port"
value = "2080"

[[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 = "/singbox"
target = "/sub?target=singbox"

[[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 = "127.0.0.1"
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

复现步骤

通过自行部署的 https://github.com/youshandefeiyang/sub-web-modify 项目必定复现

期望结果

{
"route": {
"rules": [
{
"clash_mode": "Global",
"outbound": "GLOBAL"
},
{
"clash_mode": "Direct",
"outbound": "DIRECT"
},
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"geoip": "cn",
"outbound": "🎯 全球直连"
}
],
"auto_detect_interface": true,
"final": "🐟 漏网之鱼"
}
}

实际结果

{
"route": {
"rules": [
{
"clash_mode": "Global",
"outbound": "GLOBAL"
},
{
"clash_mode": "Direct",
"outbound": "DIRECT"
},
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"eoip": "cn",
"outbound": "🎯 全球直连"
}
],
"auto_detect_interface": true,
"final": "🐟 漏网之鱼"
}
}

错误信息

No response

Fixed in referenced commit.

谢谢大大!
问题已解决!