Compare commits

...

4 Commits

Author SHA1 Message Date
asdlokj1qpi23
d22cd9b50a Merge pull request #56 from mi0e/anytls-conversion
feat: add anytls link parser
2025-08-27 17:29:48 +08:00
asdlokj1qpi23
d22cba4c69 Merge pull request #54 from greatcoolge/master
参数映射缺失
2025-08-27 17:29:14 +08:00
mi0e
dfa8188739 feat: add anytls link parser 2025-08-26 13:15:58 +08:00
greatcoolge
4bd91f89d8 subparser.cpp 2025-08-23 13:54:48 +08:00
2 changed files with 64 additions and 0 deletions

View File

@@ -943,6 +943,11 @@ void explodeTrojan(std::string trojan, Proxy &node) {
network = "ws";
}
else if (getUrlArg(addition, "type") == "grpc") {
path = getUrlArg(addition, "serviceName");
network = "grpc";
}
if (remark.empty())
remark = server + ":" + port;
if (group.empty())
@@ -3171,6 +3176,61 @@ void explodeTuic(const std::string &tuic, Proxy &node) {
return;
}
void explodeAnyTLS(std::string anytls, Proxy &node) {
std::string add, port, password, remarks, addition, sni, fp;
std::vector<std::string> alpnList;
tribool udp, tfo, scv;
anytls = anytls.substr(9);
string_size pos;
pos = anytls.rfind("#");
if (pos != anytls.npos) {
remarks = urlDecode(anytls.substr(pos + 1));
anytls.erase(pos);
}
pos = anytls.rfind("?");
if (pos != anytls.npos) {
addition = anytls.substr(pos + 1);
anytls.erase(pos);
}
pos = anytls.find("@");
if (pos != anytls.npos) {
password = anytls.substr(0, pos);
anytls = anytls.substr(pos + 1);
}
pos = anytls.find(":");
if (pos != anytls.npos) {
add = anytls.substr(0, pos);
port = anytls.substr(pos + 1);
}
if (remarks.empty())
remarks = add + ":" + port;
std::string alpn = getUrlArg(addition, "alpn");
if (!alpn.empty()) {
auto alpns = split(alpn, ",");
for (auto &item : alpns) {
if (!item.empty())
alpnList.emplace_back(item);
}
}
fp = getUrlArg(addition, "fp");
if (fp.empty())
fp = getUrlArg(addition, "fingerprint");
sni = getUrlArg(addition, "sni");
udp = getUrlArg(addition, "udp");
tfo = getUrlArg(addition, "tfo");
scv = getUrlArg(addition, "insecure");
anyTlSConstruct(node, ANYTLS_DEFAULT_GROUP, remarks, port, password, add, alpnList, fp, sni, udp, tfo, scv,
tribool(), "", 30, 30, 0);
}
void explode(const std::string &link, Proxy &node) {
if (startsWith(link, "ssr://"))
explodeSSR(link, node);
@@ -3192,6 +3252,8 @@ void explode(const std::string &link, Proxy &node) {
explodeHysteria(link, node);
else if (strFind(link, "tuic://"))
explodeTuic(link, node);
else if (strFind(link, "anytls://"))
explodeAnyTLS(link, node);
else if (strFind(link, "hysteria2://") || strFind(link, "hy2://"))
explodeHysteria2(link, node);
else if (strFind(link, "mierus://") || strFind(link, "mieru://"))

View File

@@ -130,6 +130,8 @@ void explodeHysteria(std::string hysteria, Proxy &node);
void explodeHysteria2(std::string hysteria2, Proxy &node);
void explodeAnyTLS(std::string anytls, Proxy &node);
/// Parse a link
void explode(const std::string &link, Proxy &node);