Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 允许转换非 Base64“正常”订阅 #825

Open
3 tasks done
iliya-pro opened this issue Feb 19, 2025 · 0 comments
Open
3 tasks done

[Feature] 允许转换非 Base64“正常”订阅 #825

iliya-pro opened this issue Feb 19, 2025 · 0 comments

Comments

@iliya-pro
Copy link

verify

  • 我已经仔细阅读项目文档,确认现有功能无法解决我的需求
  • 我已经检索过现有issue,确认与现有issue的内容并不重复
  • 我已经尝试自行解决,确认自己没有能力解决

功能描述

令人惊讶的是,子转换器无法与非 Base64 “正常”订阅配合使用。

例如,以下命令:
http://127.0.0.1:25500/sub?target=clash&url=https%3A%2F%2Fraw.githubusercontent.com%2FSoliSpirit%2Fv2ray-configs%2Frefs%2Fheads%2Fmain%2FCountries%2FBelgium.txt

Belgium.txt内容:

ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:989#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:805#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:44208#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:989#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:809#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:801#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
ss://[email protected]:40093#🔥Join+Telegram:@FarahVPN🟣
vless://[email protected]:8443?security=tls&sni=bru-be-01.fromblancwithlove.com&type=tcp&alpn=h2&allowInsecure=1#🔥Join+Telegram:@FarahVPN🟣
vless://[email protected]:80?security=none&type=ws&host=game.baziha0098.ir&path=%2F%3Fed%3D2048#🔥Join+Telegram:@FarahVPN🟣

显示错误:

2025/02/18 Tue 22:37:00.448597 [1 Thread-3][VERB] Invalid subscription: 'https://raw.githubusercontent.com/SoliSpirit/v2ray-configs/refs/heads/main/Countries/Belgium.txt'!
2025/02/18 Tue 22:37:00.448617 [1 Thread-3][WARN] The following link doesn't contain any valid node info: https://raw.githubusercontent.com/SoliSpirit/v2ray-configs/refs/heads/main/Countries/Belgium.txt

可能的解决方案

也许我错过了什么,而子转换器已经有了针对此问题的解决方案?

但是,我仔细阅读了手册,却一无所获。

然后,我在子转换器代码中做了一些调查,这个问题的解决方案似乎很简单。您只需要在explodeSub()函数中添加额外的检查:

// File: src/parser/subparser.cpp
...
void explodeSub(std::string sub, std::vector<Proxy> &nodes)
{
    ...
    //try to parse as normal subscription
    if(!processed)
    {
        // >>> Modification start <<<
        if(!regFind(sub, "[^a-zA-Z0-9+/=]") // probably Base64-encoded string?
        {
            sub = urlSafeBase64Decode(sub);
        }
        // >>> Modification end <<<
        if(regFind(sub, "(vmess|shadowsocks|http|trojan)\\s*?="))
        {
            ...
        }
        ...
    }
}

这可能不是一个理想的解决方案,但仍然比当前的行为好得多。

@iliya-pro iliya-pro changed the title [Feature] Allow to convert non-Base64 "normal" subscriptions [Feature] 允许转换非 Base64“正常”订阅 Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant