Skip to content

Commit

Permalink
Allow password in addition for Hysteria2.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhuang committed Dec 7, 2023
1 parent facae2c commit 93bdc4f
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/parser/subparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ void explodeHysteria(std::string hysteria, Proxy &node)

void explodeHysteria2(std::string hysteria2, Proxy &node)
{
printf("explodeHysteria2\n");
hysteria2 = urlSafeBase64Decode(regReplace(hysteria2, "(hysteria2|hy2)://", "hysteria2://"));
if(regMatch(hysteria2, "hysteria2://(.*?)@(.*?)[:](.*)"))
hysteria2 = regReplace(hysteria2, "(hysteria2|hy2)://", "hysteria2://");
if(regMatch(hysteria2, "hysteria2://(.*?)[:](.*)"))
{
explodeStdHysteria2(hysteria2, node);
return;
Expand Down Expand Up @@ -1354,7 +1353,7 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes)

bool skipCertVerify;
singleproxy["skip-cert-verify"] >> skipCertVerify;
if (skipCertVerify) {
if (skipCertVerify == true) {
insecure = "1";
} else {
insecure = "0";
Expand Down Expand Up @@ -1479,21 +1478,15 @@ void explodeStdHysteria2(std::string hysteria2, Proxy &node)
{
password = getUrlArg(addition,"password");
if(password.empty())
return;
return;

if(strFind(hysteria2, ":"))
{
if(regGetMatch(hysteria2, R"(^(.*)[:](\d+)$)", 3, 0, &add, &port))
return;
}
else
{
port = getUrlArg(addition,"port");
if(port.empty())
if(!strFind(hysteria2, ":"))
return;

add = hysteria2;
}
if(regGetMatch(hysteria2, R"(^(.*)[:](\d+)$)", 3, 0, &add, &port))
return;

add = hysteria2;
}

insecure = getUrlArg(addition, "insecure");
Expand Down

0 comments on commit 93bdc4f

Please sign in to comment.