Add support for Hysteria2 ports.

This commit is contained in:
asdlokj1qpi23
2024-03-13 18:12:36 +08:00
parent 1ff018c47b
commit a8292b1fc6
4 changed files with 10 additions and 6 deletions

View File

@@ -484,6 +484,8 @@ proxyToClash(std::vector<Proxy> &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";

View File

@@ -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<Proxy> &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<Proxy> &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;

View File

@@ -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);

View File

@@ -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