Skip to content

Commit

Permalink
feat: add alpn compatible logics
Browse files Browse the repository at this point in the history
  • Loading branch information
lonelam committed Mar 23, 2024
1 parent f78bc0a commit 0739ea7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/parser/subparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ void hysteriaConstruct(
node.RecvWindow = to_int(recv_window);
node.DisableMtuDiscovery = disable_mtu_discovery;
node.HopInterval = to_int(hop_interval);
node.Alpn = StringArray {alpn};
if (!alpn.empty())
{
node.Alpn = StringArray {alpn};
}
}

void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port,const std::string &up, const std::string &down, const std::string &password, const std::string &obfs, const std::string &obfs_password, const std::string &sni, const std::string &fingerprint, const std::string &alpn, const std::string &ca, const std::string &ca_str, const std::string &cwnd, tribool tfo, tribool scv) {
Expand All @@ -190,7 +193,10 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string
node.OBFSParam = obfs_password;
node.SNI = sni;
node.Fingerprint = fingerprint;
node.Alpn = StringArray {alpn};
if (!alpn.empty())
{
node.Alpn = StringArray {alpn};
}
node.Ca = ca;
node.CaStr = ca_str;
node.CWND = to_int(cwnd);
Expand Down Expand Up @@ -1489,7 +1495,7 @@ void explodeStdHysteria2(std::string hysteria2, Proxy &node) {
if (remarks.empty())
remarks = add + ":" + port;

hysteria2Construct(node, HYSTERIA2_DEFAULT_GROUP, remarks, add, port, up, down, password, obfs, obfs_password, sni, fingerprint, {""}, "", "", "", tribool(), scv);
hysteria2Construct(node, HYSTERIA2_DEFAULT_GROUP, remarks, add, port, up, down, password, obfs, obfs_password, sni, fingerprint, "", "", "", "", tribool(), scv);
return;
}

Expand Down

0 comments on commit 0739ea7

Please sign in to comment.