subconverter
subconverter copied to clipboard
v2ray订阅链接转clash后丢失h2协议节点
v2ray订阅链接转clash后丢失
现象
转换前两个节点
{
"v": "2",
"ps": " 香港#224",
"add": "104.17.38.9",
"port": "443",
"id": "a3-d706-3ac5-87e2-fb564394",
"aid": "1",
"net": "ws",
"type": "none",
"host": "nodes224.xyz",
"path": "/panel",
"tls": "tls"
}
{
"v": "2",
"ps": " 新加坡#81",
"add": "s81.xyz",
"port": "25496",
"id": "a33-d706-3ac5-87e2-fb564394",
"aid": "1",
"net": "h2",
"type": "none",
"host": "s81.xyz",
"path": "",
"tls": "tls"
}
使用默认参数转换成clash后只有1个节点
socks-port: 7891
allow-lan: true
mode: Rule
log-level: info
external-controller: :9090
proxies:
- {name: 🇭🇰 香港#224, server: 104.17.38.9, port: 443, type: vmess, uuid: a3-d706-3ac5-87e2-fb564394, alterId: 1, ciph>
proxy-groups:
- name: 🔰 节点选择
type: select
proxies:
- ♻️ 自动选择
- 🎯 全球直连
- 🇭🇰 香港#224
.......
.......
DEBUG日志:
2021/07/15 Thu 23:02:42.561159 [8161 140380266756920][VERB] Parsing subscription data...
2021/07/15 Thu 23:02:42.561666 [8161 140380266756920][VERB] Node V2RayProvider - 🇭🇰 香港#224 has been added.
2021/07/15 Thu 23:02:42.561713 [8161 140380266756920][VERB] Node V2RayProvider - 🇸🇬 新加坡#81 has been added.
2021/07/15 Thu 23:02:42.561754 [8161 140380266756920][VERB] Filter done.
2021/07/15 Thu 23:02:42.562215 [8161 140380266756920][INFO] Generate target: Clash
2021/07/15 Thu 23:02:42.583284 [8161 140380266756920][INFO] Generate completed.
但查看subconverter的DEBUG日志可以看到两个节点都已经被添加,但最终结果只有1个节点。
注:配置中未启用filter参数,其他参数除了端口号、日志等级、调试模式外均使用默认参数。
enable_filter: false
filter_script: ""
请问问题出在哪儿呢,应该怎么解决?
复现步骤
v2ray订阅链接: https://gist.githubusercontent.com/m2kar/6fbfd6352447378d7951453d45421bf5/raw/85a5bcaaa22f5554c82785a20d3f5606d3f754f2/v2ray-sub
使用我临时建的订阅服务器 http://sub.ctgfw.ml:25501
curl "http://sub.ctgfw.ml:25501/sub?target=clash&url=https://gist.githubusercontent.com/m2kar/6fbfd6352447378d7951453d45421bf5/raw/85a5bcaaa22f5554c82785a20d3f5606d3f754f2/v2ray-sub"
即可复现
环境信息
- subconverter 最新版,手动编译得到(之前的版本也存在这样的问题)
# git log信息
commit fc2a5902d2841b3d1eb4c8b7b2e573237045d2ca (HEAD -> master, origin/master, origin/HEAD)
Author: Tindy X <[email protected]>
Date: Sat Jun 12 14:45:32 2021 +0800
Update Windows patch
- Linux
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
日志信息
### subconverter日志
2021/07/15 Thu 23:02:41.952214 [8161 140380266756920][DEBG] Accept connection from client 124.16.141.242:31711
2021/07/15 Thu 23:02:41.952404 [8161 140380266756920][VERB] handle_cmd: GET handle_uri: /sub?target=clash&url=https://gist.githubusercontent.com/m2kar/6fbfd6352447378d7951453d45421bf5/raw/85a5bcaaa22f5554c82785a20d3f5606d3f754f2/v2ray-sub
2021/07/15 Thu 23:02:41.952472 [8161 140380266756920][INFO] Reading preference settings...
2021/07/15 Thu 23:02:41.954506 [8161 140380266756920][VERB] Imported 0 item(s).
2021/07/15 Thu 23:02:41.954613 [8161 140380266756920][VERB] Imported 0 item(s).
2021/07/15 Thu 23:02:41.954728 [8161 140380266756920][VERB] Trying to import items from snippets/rename_node.txt
2021/07/15 Thu 23:02:41.954818 [8161 140380266756920][VERB] Imported 1 item(s).
2021/07/15 Thu 23:02:41.954932 [8161 140380266756920][VERB] Trying to import items from snippets/emoji.txt
2021/07/15 Thu 23:02:41.955031 [8161 140380266756920][VERB] Imported 41 item(s).
2021/07/15 Thu 23:02:41.955114 [8161 140380266756920][VERB] Trying to import items from snippets/rulesets.txt
2021/07/15 Thu 23:02:41.955180 [8161 140380266756920][VERB] Imported 19 item(s).
2021/07/15 Thu 23:02:41.955253 [8161 140380266756920][VERB] Trying to import items from snippets/groups.txt
2021/07/15 Thu 23:02:41.955356 [8161 140380266756920][VERB] Imported 10 item(s). 🇰 24 a e d.
2021/07/15 Thu 23:02:41.955946 [8161 140380266756920][VERB] Imported 0 item(s). 🇬 81 a e d.
2021/07/15 Thu 23:02:41.956045 [8161 140380266756920][INFO] Fetching node data from url 'https://gist.githubusercontent.com/m2kar/6fbfd6352447378d7951453d45421bf5/raw/85a5bcaaa22f5554c82785a20d3f5606d3f754f2/v2ray-sub'.
2021/07/15 Thu 23:02:41.958079 [8161 140380266756920][VERB] Received Link.
2021/07/15 Thu 23:02:41.958144 [8161 140380266756920][VERB] Downloading subscription data...
* Trying 185.199.111.133:443...
* Connected to gist.githubusercontent.com (185.199.111.133) port 443 (#0)
* mbedTLS: Connecting to gist.githubusercontent.com:443
* mbedTLS: Set min SSL version to TLS 1.0
* mbedTLS: Handshake complete, cipher is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256
* Dumping cert info: * cert. version : 3
* serial number : 02:49:3E:07:FA:9E:37:5A:2D:BB:C6:1D:94:43:0F:CF
* issuer name : C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert SHA2 High Assurance Server CA
* subject name : C=US, ST=California, L=San Francisco, O=GitHub, Inc., CN=www.github.com
* issued on : 2020-05-06 00:00:00
* expires on : 2022-04-14 12:00:00
* signed using : RSA with SHA-256
* RSA key size : 2048 bits
* basic constraints : CA=false
* subject alt name : www.github.com, *.github.com, github.com, *.github.io, github.io, *.githubusercontent.com, githubusercontent.com
* key usage : Digital Signature, Key Encipherment
* ext key usage : TLS Web Server Authentication, TLS Web Client Authentication
* SSL connected
> GET /m2kar/6fbfd6352447378d7951453d45421bf5/raw/85a5bcaaa22f5554c82785a20d3f5606d3f754f2/v2ray-sub HTTP/1.1
Host: gist.githubusercontent.com
Accept: */*
Content-Type: application/json;charset='utf-8'
X-Client-IP: 124.16.141.242
User-Agent: curl/7.64.0
SubConverter-Request: 1
SubConverter-Version: v0.6.4
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Length: 888
< Cache-Control: max-age=300
< Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
< Content-Type: text/plain; charset=utf-8
< ETag: "71ba255e66e2093267b487482962ce7b98fc87f14c0c23bc1549a3ee38468f79"
< Strict-Transport-Security: max-age=31536000
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-XSS-Protection: 1; mode=block
< X-GitHub-Request-Id: 552A:22EC:2D4091:35CFBE:60F0F6CE
< Accept-Ranges: bytes
< Date: Fri, 16 Jul 2021 03:02:42 GMT
< Via: 1.1 varnish
< X-Served-By: cache-hkg17927-HKG
< X-Cache: HIT
< X-Cache-Hits: 1
< X-Timer: S1626404563.557737,VS0,VE0
< Vary: Authorization,Accept-Encoding
< Access-Control-Allow-Origin: *
< X-Fastly-Request-ID: 7ad456c6acfbe0bc8d90a78be72fe3fc10b024af
< Expires: Fri, 16 Jul 2021 03:07:42 GMT
< Source-Age: 4
<
* Connection #0 to host gist.githubusercontent.com left intact
2021/07/15 Thu 23:02:42.561159 [8161 140380266756920][VERB] Parsing subscription data...
2021/07/15 Thu 23:02:42.561666 [8161 140380266756920][VERB] Node V2RayProvider - 🇭🇰 香港#224 has been added.
2021/07/15 Thu 23:02:42.561713 [8161 140380266756920][VERB] Node V2RayProvider - 🇸🇬 新加坡#81 has been added.
2021/07/15 Thu 23:02:42.561754 [8161 140380266756920][VERB] Filter done.
2021/07/15 Thu 23:02:42.562215 [8161 140380266756920][INFO] Generate target: Clash
2021/07/15 Thu 23:02:42.583284 [8161 140380266756920][INFO] Generate completed.
从日志中可以看到 香港#224和新加坡#81都已经被添加,但是最后的订阅地址只有一个。
### pref.yml
$ cat pref.yml
common:
api_mode: false
api_access_token: password
default_url: []
enable_insert: true
insert_url: []
prepend_insert_url: true
exclude_remarks: ["(到期|剩余流量|时间|官网|产品|平台)"]
include_remarks: []
enable_filter: false
filter_script: ""
default_external_config: "" # config/example_external_config.yml
base_path: base
clash_rule_base: base/all_base.tpl
surge_rule_base: base/all_base.tpl
surfboard_rule_base: base/all_base.tpl
mellow_rule_base: base/all_base.tpl
quan_rule_base: base/all_base.tpl
quanx_rule_base: base/all_base.tpl
loon_rule_base: base/all_base.tpl
sssub_rule_base: base/all_base.tpl
proxy_config: SYSTEM
proxy_ruleset: SYSTEM
proxy_subscription: NONE
append_proxy_type: false
userinfo:
stream_rule:
- {match: "^剩余流量:(.*?)\\|总流量:(.*)$", replace: "total=$2&left=$1"}
- {match: "^剩余流量:(.*?) (.*)$", replace: "total=$1&left=$2"}
- {match: "^Bandwidth: (.*?)/(.*)$", replace: "used=$1&total=$2"}
- {match: "^.*剩余(.*?)(?:\\s*?)@(?:.*)$", replace: "total=$1"}
- {match: "^.*?流量:(.*?) 剩:(?:.*)$", replace: "total=$1"}
time_rule:
- {match: "^过期时间:(\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)$", replace: "$1:$2:$3:$4:$5:$6"}
- {match: "^到期时间(:|:)(\\d+)-(\\d+)-(\\d+)$", replace: "$1:$2:$3:0:0:0"}
- {match: "^Smart Access expire: (\\d+)/(\\d+)/(\\d+)$", replace: "$1:$2:$3:0:0:0"}
- {match: "^.*?流量:(?:.*?) 剩:(.*?)天$", replace: "left=$1d"}
node_pref:
# udp_flag: false
# tcp_fast_open_flag: false
# skip_cert_verify_flag: false
# tls13_flag: false
sort_flag: false
sort_script: ""
filter_deprecated_nodes: false
append_sub_userinfo: true
clash_use_new_field_name: true
clash_proxies_style: flow
rename_node:
# - {match: "\\(?((x|X)?(\\d+)(\\.?\\d+)?)((\\s?倍率?)|(x|X))\\)?", replace: "$1x"}
# - {script: "function rename(node){}"}
# - {script: "path:/path/to/script.js"}
- {import: snippets/rename_node.txt}
managed_config:
write_managed_config: true
managed_config_prefix: "http://127.0.0.1:25500"
config_update_interval: 86400
config_update_strict: false
quanx_device_id: ""
surge_external_proxy:
surge_ssr_path: "" # /usr/bin/ssr-local
resolve_hostname: true
emojis:
add_emoji: true
remove_old_emoji: true
rules:
# - {match: "(流量|时间|应急)", emoji: "🏳️🌈"}
# - {script: "function getEmoji(node){}"}
# - {script: "path:/path/to/script.js"}
- {import: snippets/emoji.txt}
rulesets:
enabled: true
overwrite_original_rules: false
update_ruleset_on_request: false
rulesets:
# - {rule: "GEOIP,CN", group: "DIRECT"}
# - {ruleset: "rules/LocalAreaNetwork.list", group: "DIRECT"}
# - {ruleset: "surge:rules/LocalAreaNetwork.list", group: "DIRECT"}
# - {ruleset: "quanx:https://raw.githubusercontent.com/ConnersHua/Profiles/master/Quantumult/X/Filter/Advertising.list", group: "Advertising", interval: 86400}
# - {ruleset: "clash-domain:https://ruleset.dev/clash_domestic_services_domains", group: "Domestic Services", interval: 86400}
# - {ruleset: "clash-ipcidr:https://ruleset.dev/clash_domestic_services_ips", group: "Domestic Services", interval: 86400}
# - {ruleset: "clash-classic:https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/China.yaml", group: "DIRECT", interval: 86400}
- {import: snippets/rulesets.txt}
proxy_groups:
custom_proxy_group:
# - {name: UrlTest, type: url-test, rule: [".*"], url: http://www.gstatic.com/generate_204, interval: 300, tolerance: 100, timeout: 5}
# - {name: Proxy, type: select, rule: [".*"]}
# - {name: group1, type: select, rule: ["!!GROUPID=0"]}
# - {name: v2ray, type: select, rule: ["!!GROUP=V2RayProvider"]}
# - {import: snippets/groups_forcerule.txt}
# - {name: ssid group, type: ssid, rule: ["default_group", "celluar=group0,ssid1=group1,ssid2=group2"]}
- {import: snippets/groups.txt}
template:
template_path: "templates"
globals:
- {key: clash.http_port, value: 7890}
- {key: clash.socks_port, value: 7891}
- {key: clash.allow_lan, value: true}
- {key: clash.log_level, value: info}
aliases:
- {uri: /v, target: /version}
- {uri: /clash, target: "/sub?target=clash"}
- {uri: /clashr, target: "/sub?target=clashr"}
- {uri: /surge, target: "/sub?target=surge"}
- {uri: /quan, target: "/sub?target=quan"}
- {uri: /quanx, target: "/sub?target=quanx"}
- {uri: /mellow, target: "/sub?target=mellow"}
- {uri: /surfboard, target: "/sub?target=surfboard"}
- {uri: /loon, target: "/sub?target=loon"}
- {uri: /ss, target: "/sub?target=ss"}
- {uri: /ssd, target: "/sub?target=ssd"}
- {uri: /sssub, target: "/sub?target=sssub"}
- {uri: /ssr, target: "/sub?target=ssr"}
- {uri: /v2ray, target: "/sub?target=v2ray"}
- {uri: /trojan, target: "/sub?target=trojan"}
tasks:
# - name: tick
# cronexp: "0/10 * * * * ?"
# path: tick.js
# timeout: 3
server:
listen: 0.0.0.0
port: 25501
serve_file_root: ""
advanced:
log_level: debug
# log_level: info
print_debug_info: true
# print_debug_info: false
max_pending_connections: 10240
max_concurrent_threads: 2
max_allowed_rulesets: 0
max_allowed_rules: 0
max_allowed_download_size: 0
enable_cache: false
cache_subscription: 60
cache_config: 300
cache_ruleset: 21600
script_clean_context: true
async_fetch_ruleset: false
skip_failed_links: false
注: 节点经过匿名处理,仅供测试使用
同问 只有ws传输协议的 非常难受
是否因为这部分代码中关于vmess to clash的导出,没有提到关于h2协议的代码?
https://github.com/tindy2013/subconverter/blob/e21f511ddb26ac5e021741d739f633eb44fd4387/src/generator/config/subexport.cpp#L358-L388
烦请 @tindy2013 予以解答。