Bug fixes

Fix compatibility issue for parsing Shadowrocket links.
Fix incorrect generation for Surge rules.
Tweak default rulesets and groups.
This commit is contained in:
Tindy X
2019-11-22 11:41:08 +08:00
parent 2885627c4b
commit 2d9eb3a696
4 changed files with 14 additions and 9 deletions

View File

@@ -174,7 +174,7 @@ surge_ruleset=🍎 苹果服务,rules/ConnersHua/Surge/Ruleset/Apple.list
surge_ruleset=🎯 全球直连,rules/ConnersHua/Surge/Ruleset/China.list
surge_ruleset=🎯 全球直连,rules/NobyDa/Surge/Download.list
surge_ruleset=🎯 全球直连,[]GEOIP,CN
surge_ruleset=🐟 漏网之鱼,[]MATCH
surge_ruleset=🐟 漏网之鱼,[]FINAL
[clash_proxy_group]
;Generate Clash Proxy Group with the following patterns. Node filterting rule supports regular expression.
@@ -214,7 +214,7 @@ custom_proxy_group=🎥 NETFLIX`select`[]🔰 节点选择`[]♻️ 自动选择
;custom_proxy_group=🚫 运营劫持`select`[]🛑 全球拦截`[]🎯 全球直连`[]🔰 节点选择
custom_proxy_group=🌍 国外媒体`select`[]♻️ 自动选择`[]🎯 全球直连`.*
custom_proxy_group=🌏 国内媒体`select`[]🎯 全球直连`(HGC|HKBN|PCCW|HKT|深台|彰化|新北|台|hk|香港|tw)`[]🔰 节点选择
custom_proxy_group=📲 电报信息`select`(美|新加坡|sg|us)`[]🔰 节点选择
custom_proxy_group=📲 电报信息`select`[]🔰 节点选择`.*
custom_proxy_group=🍎 苹果服务`select`[]🔰 节点选择`[]🎯 全球直连`[]♻️ 自动选择`.*
custom_proxy_group=🎯 全球直连`select`[]DIRECT
custom_proxy_group=🛑 全球拦截`select`[]REJECT`[]DIRECT

View File

@@ -153,12 +153,12 @@ void explodeVmess(std::string vmess, std::string custom_port, int local_port, no
std::vector<std::string> vArray;
if(regMatch(vmess, "vmess://(.*?)\\?(.*)")) //kitsunebi style link
{
explodeKitsunebi(vmess, custom_port, local_port, node);
explodeShadowrocket(vmess, custom_port, local_port, node);
return;
}
else if(regMatch(vmess, "vmess1://(.*?)\\?(.*)")) // new kitsunebi style link
{
explodeKitsunebiNew(vmess, custom_port, local_port, node);
explodeKitsunebi(vmess, custom_port, local_port, node);
return;
}
vmess = urlsafe_base64_decode(regReplace(vmess, "(vmess|vmess1)://", ""));
@@ -971,7 +971,7 @@ void explodeClash(Node yamlnode, std::string custom_port, int local_port, std::v
return;
}
void explodeKitsunebi(std::string kit, std::string custom_port, int local_port, nodeInfo &node)
void explodeShadowrocket(std::string kit, std::string custom_port, int local_port, nodeInfo &node)
{
std::string ps, add, port, type, id, aid, net = "tcp", path, host, tls, cipher, remarks;
std::string addition;
@@ -993,6 +993,9 @@ void explodeKitsunebi(std::string kit, std::string custom_port, int local_port,
host = getUrlArg(addition, "wsHost");
path = getUrlArg(addition, "wspath");
if(aid == "")
aid = "0";
if(remarks == "")
remarks = add + ":" + port;
@@ -1004,7 +1007,7 @@ void explodeKitsunebi(std::string kit, std::string custom_port, int local_port,
node.proxyStr = vmessConstruct(add, port, type, id, aid, net, cipher, path, host, tls, local_port);
}
void explodeKitsunebiNew(std::string kit, std::string custom_port, int local_port, nodeInfo &node)
void explodeKitsunebi(std::string kit, std::string custom_port, int local_port, nodeInfo &node)
{
std::string ps, add, port, type, id, aid = "0", net = "tcp", path, host, tls, cipher = "auto", remarks;
std::string addition;

View File

@@ -15,8 +15,8 @@ void explodeVmess(std::string vmess, std::string custom_port, int local_port, no
void explodeSSR(std::string ssr, bool ss_libev, bool libev, std::string custom_port, int local_port, nodeInfo &node);
void explodeSS(std::string ss, bool libev, std::string custom_port, int local_port, nodeInfo &node);
void explodeQuan(std::string quan, std::string custom_port, int local_port, nodeInfo &node);
void explodeShadowrocket(std::string kit, std::string custom_port, int local_port, nodeInfo &node);
void explodeKitsunebi(std::string kit, std::string custom_port, int local_port, nodeInfo &node);
void explodeKitsunebiNew(std::string kit, std::string custom_port, int local_port, nodeInfo &node);
void explode(std::string link, bool sslibev, bool ssrlibev, std::string custom_port, int local_port, nodeInfo &node);
void explodeSSD(std::string link, bool libev, std::string custom_port, int local_port, std::vector<nodeInfo> &nodes);
void explodeSub(std::string sub, bool sslibev, bool ssrlibev, std::string custom_port, int local_port, std::vector<nodeInfo> &nodes);

View File

@@ -318,9 +318,11 @@ void rulesetToSurge(INIReader &base_rule, std::vector<ruleset_content> &ruleset_
strLine = replace_all_distinct(strLine, "\r", ""); //remove line break
if(!strLine.size() || strLine.find("#") == 0 || strLine.find(";") == 0) //remove comments
continue;
if(surge_ver < 4 && strLine.find("IP-CIDR") == 0)
strLine = replace_all_distinct(strLine, ",no-resolve", "");
strLine += "," + rule_group;
if(strLine.find("IP-CIDR") == 0)
strLine = regReplace(strLine, "^(.*)(,no-resolve)(.*)$", "$1$3$2");
else if(strLine.find("DOMAIN-SUFFIX") == 0)
strLine = regReplace(strLine, "^(.*)(,force-remote-dns)(.*)$", "$1$3$2");
allRules.emplace_back(strLine);
}
}