diff --git a/src/generator/config/subexport.cpp b/src/generator/config/subexport.cpp index e58fa8d..11d53dd 100644 --- a/src/generator/config/subexport.cpp +++ b/src/generator/config/subexport.cpp @@ -484,6 +484,8 @@ proxyToClash(std::vector &nodes, YAML::Node &yamlnode, const ProxyGroupCo singleproxy["obfs"] = x.OBFSParam; if (!x.OBFSPassword.empty()) singleproxy["obfs-password"] = x.OBFSPassword; + if (!x.Ports.empty()) + singleproxy["ports"] = x.Ports; break; case ProxyType::VLESS: singleproxy["type"] = "vless"; diff --git a/src/parser/subparser.cpp b/src/parser/subparser.cpp index 031567a..d2c07a5 100644 --- a/src/parser/subparser.cpp +++ b/src/parser/subparser.cpp @@ -223,7 +223,7 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string 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 &sni, - const std::string &publicKey, + const std::string &publicKey, const std::string &ports, tribool udp, tribool tfo, tribool scv) { commonConstruct(node, ProxyType::Hysteria2, group, remarks, add, port, udp, tfo, scv, tribool()); @@ -236,6 +236,7 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string node.OBFSPassword = obfsPassword; node.ServerName = sni; node.PublicKey = publicKey; + node.Ports = ports; } void explodeVmess(std::string vmess, Proxy &node) { @@ -1355,9 +1356,10 @@ void explodeClash(Node yamlnode, std::vector &nodes) { singleproxy["obfs-password"] >>= obfsPassword; singleproxy["sni"] >>= host; singleproxy["alpn"][0] >>= alpn; + singleproxy["ports"] >> ports; sni = host; hysteria2Construct(node, group, ps, server, port, password, host, up, down, alpn, obfsParam, - obfsPassword, sni, public_key, udp, tfo, scv); + obfsPassword, sni, public_key, ports, udp, tfo, scv); break; default: continue; @@ -1490,7 +1492,7 @@ void explodeStdHysteria2(std::string hysteria2, Proxy &node) { remarks = add + ":" + port; hysteria2Construct(node, HYSTERIA2_DEFAULT_GROUP, remarks, add, port, password, host, up, down, alpn, obfsParam, - obfsPassword, host, "", tribool(), tribool(), scv); + obfsPassword, host, "", "", tribool(), tribool(), scv); return; } @@ -2690,7 +2692,7 @@ void explodeSingbox(rapidjson::Value &outbounds, std::vector &nodes) { obfsPassword = GetMember(obfsOpt, "password"); } hysteria2Construct(node, group, ps, server, port, password, host, up, down, alpn, obfsParam, - obfsPassword, sni,public_key, udp, tfo, scv); + obfsPassword, sni, public_key, "", udp, tfo, scv); break; default: continue; diff --git a/src/parser/subparser.h b/src/parser/subparser.h index fb06723..a552115 100644 --- a/src/parser/subparser.h +++ b/src/parser/subparser.h @@ -31,7 +31,7 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string 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 &sni, - const std::string &publicKey, + const std::string &publicKey, const std::string &ports, tribool udp, tribool tfo, tribool scv); diff --git a/src/version.h b/src/version.h index 8fc6e24..f5aa416 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,6 @@ #ifndef VERSION_H_INCLUDED #define VERSION_H_INCLUDED -#define VERSION "v0.9.3" +#define VERSION "v0.9.4" #endif // VERSION_H_INCLUDED