Skip to content

Commit

Permalink
Fix scv not changed with skip_cert_verify_flag default value for Hyst…
Browse files Browse the repository at this point in the history
…eria and Trojan. (#12)

* Fix "insecure" param of Hysteria2 with Default skip_cert_verify_flag.

* Fix "allowInsecure" param of Trojan with Default skip_cert_verify_flag.
  • Loading branch information
dzhuang authored Jan 30, 2024
1 parent f0a9ffb commit f51dad6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/generator/config/subexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGr
singleproxy["sni"] = x.Host;
if (!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
if (!x.AllowInsecure.is_undef())
singleproxy["skip-cert-verify"] = x.AllowInsecure.get();
if (!x.Alpn.empty())
singleproxy["alpn"].push_back(x.Alpn);
if (!x.OBFSParam.empty())
Expand Down Expand Up @@ -495,6 +497,8 @@ void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGr
singleproxy["password"].SetTag("str");
if(!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
if (!x.AllowInsecure.is_undef())
singleproxy["skip-cert-verify"] = x.AllowInsecure.get();
switch(hash_(x.TransferProtocol))
{
case "tcp"_hash:
Expand Down
3 changes: 2 additions & 1 deletion src/parser/subparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes)
singleproxy["sni"] >>= host;
singleproxy["alpn"][0] >>= alpn;

scv = singleproxy["insecure"].IsDefined() ? singleproxy["insecure"].as<std::string>() == "1" : false;
hysteria2Construct(node, group, ps, server, port, password, host, up, down, alpn, obfsParam, obfsPassword, udp, tfo, scv);
break;
default:
Expand Down Expand Up @@ -1444,7 +1445,7 @@ void explodeStdHysteria(std::string hysteria, Proxy &node)

void explodeStdHysteria2(std::string hysteria2, Proxy &node)
{
std::string add, port, password, host, insecure, up, down, alpn, obfsParam, obfsPassword, remarks;
std::string add, port, password, host, up, down, alpn, obfsParam, obfsPassword, remarks;
std::string addition;
tribool scv;
hysteria2 = hysteria2.substr(12);
Expand Down
2 changes: 1 addition & 1 deletion src/parser/subparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum class ConfType
};

void hysteriaConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &auth, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &password, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &obfsPassword, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &password, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &obfsPassword, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool());
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls, const std::string &sni, const std::string &alpn, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &flow, const std::string &mode, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls,const std::string &pkd, const std::string &sid, const std::string &fp, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &protocol, const std::string &method, const std::string &obfs, const std::string &password, const std::string &obfsparam, const std::string &protoparam, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool());
Expand Down

0 comments on commit f51dad6

Please sign in to comment.