mirror of
https://github.com/MetaCubeX/subconverter.git
synced 2025-11-04 18:19:42 +08:00
Add support for parsing some Shadowrocket links
This commit is contained in:
parent
2c4fedc33d
commit
519207ae9a
@ -989,27 +989,41 @@ void explodeClash(Node yamlnode, std::string custom_port, int local_port, std::v
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void explodeShadowrocket(std::string kit, std::string custom_port, int local_port, nodeInfo &node)
|
void explodeShadowrocket(std::string rocket, std::string custom_port, int local_port, nodeInfo &node)
|
||||||
{
|
{
|
||||||
std::string add, port, type, id, aid, net = "tcp", path, host, tls, cipher, remarks;
|
std::string add, port, type, id, aid, net = "tcp", path, host, tls, cipher, remarks;
|
||||||
|
std::string obfs; //for other style of link
|
||||||
std::string addition;
|
std::string addition;
|
||||||
string_array userinfo;
|
string_array userinfo;
|
||||||
kit = replace_all_distinct(kit, "vmess://", "");
|
rocket = rocket.substr(8);
|
||||||
|
|
||||||
addition = kit.substr(kit.find("?") + 1);
|
addition = rocket.substr(rocket.find("?") + 1);
|
||||||
kit = kit.substr(0, kit.find("?"));
|
rocket = rocket.substr(0, rocket.find("?"));
|
||||||
|
|
||||||
userinfo = split(regReplace(urlsafe_base64_decode(kit), "(.*?):(.*?)@(.*):(.*)", "$1,$2,$3,$4"), ",");
|
userinfo = split(regReplace(urlsafe_base64_decode(rocket), "(.*?):(.*?)@(.*):(.*)", "$1,$2,$3,$4"), ",");
|
||||||
cipher = userinfo[0];
|
cipher = userinfo[0];
|
||||||
id = userinfo[1];
|
id = userinfo[1];
|
||||||
add = userinfo[2];
|
add = userinfo[2];
|
||||||
port = userinfo[3];
|
port = userinfo[3];
|
||||||
remarks = UrlDecode(getUrlArg(addition, "remark"));
|
remarks = UrlDecode(getUrlArg(addition, "remark"));
|
||||||
|
obfs = getUrlArg(addition, "obfs");
|
||||||
|
if(obfs.size())
|
||||||
|
{
|
||||||
|
if(obfs == "websocket")
|
||||||
|
{
|
||||||
|
net = "ws";
|
||||||
|
host = getUrlArg(addition, "obfsParam");
|
||||||
|
path = getUrlArg(addition, "path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
net = getUrlArg(addition, "network");
|
net = getUrlArg(addition, "network");
|
||||||
aid = getUrlArg(addition, "aid");
|
|
||||||
tls = getUrlArg(addition, "tls") == "1" ? "tls" : "";
|
|
||||||
host = getUrlArg(addition, "wsHost");
|
host = getUrlArg(addition, "wsHost");
|
||||||
path = getUrlArg(addition, "wspath");
|
path = getUrlArg(addition, "wspath");
|
||||||
|
}
|
||||||
|
tls = getUrlArg(addition, "tls") == "1" ? "tls" : "";
|
||||||
|
aid = getUrlArg(addition, "aid");
|
||||||
|
|
||||||
if(aid == "")
|
if(aid == "")
|
||||||
aid = "0";
|
aid = "0";
|
||||||
@ -1030,7 +1044,7 @@ void explodeKitsunebi(std::string kit, std::string custom_port, int local_port,
|
|||||||
std::string add, port, type, id, aid = "0", net = "tcp", path, host, tls, cipher = "auto", remarks;
|
std::string add, port, type, id, aid = "0", net = "tcp", path, host, tls, cipher = "auto", remarks;
|
||||||
std::string addition;
|
std::string addition;
|
||||||
string_array userinfo;
|
string_array userinfo;
|
||||||
kit = replace_all_distinct(kit, "vmess1://", "");
|
kit = kit.substr(9);
|
||||||
|
|
||||||
if(strFind(kit, "#"))
|
if(strFind(kit, "#"))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user