mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Merge pull request #927 from throneproj/fix-hysteria2-obfs
fix: fix hysteria2 obfs
This commit is contained in:
commit
0599f8640d
@ -11,7 +11,6 @@ namespace Configs
|
||||
QString hop_interval;
|
||||
int up_mbps = 0;
|
||||
int down_mbps = 0;
|
||||
QString obfsType = "salamander";
|
||||
QString obfsPassword;
|
||||
QString password;
|
||||
std::shared_ptr<TLS> tls = std::make_shared<TLS>();
|
||||
@ -22,7 +21,6 @@ namespace Configs
|
||||
_add(new configItem("hop_interval", &hop_interval, string));
|
||||
_add(new configItem("up_mbps", &up_mbps, integer));
|
||||
_add(new configItem("down_mbps", &down_mbps, integer));
|
||||
_add(new configItem("obfsType", &obfsType, string));
|
||||
_add(new configItem("obfsPassword", &obfsPassword, string));
|
||||
_add(new configItem("password", &password, string));
|
||||
_add(new configItem("tls", dynamic_cast<JsonStore *>(tls.get()), jsonStore));
|
||||
|
||||
@ -65,7 +65,6 @@ namespace Configs {
|
||||
if (object.contains("down_mbps")) down_mbps = object["down_mbps"].toInt();
|
||||
if (object.contains("obfs")) {
|
||||
auto obfsObj = object["obfs"].toObject();
|
||||
if (obfsObj.contains("type")) obfsType = obfsObj["type"].toString();
|
||||
if (obfsObj.contains("password")) obfsPassword = obfsObj["password"].toString();
|
||||
}
|
||||
if (object.contains("obfsPassword")) obfsPassword = object["obfsPassword"].toString();
|
||||
@ -131,10 +130,12 @@ namespace Configs {
|
||||
if (!hop_interval.isEmpty()) object["hop_interval"] = hop_interval;
|
||||
if (up_mbps > 0) object["up_mbps"] = up_mbps;
|
||||
if (down_mbps > 0) object["down_mbps"] = down_mbps;
|
||||
QJsonObject obfsObj;
|
||||
if (!obfsType.isEmpty()) obfsObj["type"] = obfsType;
|
||||
if (!obfsPassword.isEmpty()) obfsObj["password"] = obfsPassword;
|
||||
if (!obfsObj.isEmpty()) object["obfs"] = obfsObj;
|
||||
if (!obfsPassword.isEmpty()) {
|
||||
QJsonObject obfsObj;
|
||||
obfsObj["type"] = "salamander";
|
||||
obfsObj["password"] = obfsPassword;
|
||||
object["obfs"] = obfsObj;
|
||||
}
|
||||
if (!password.isEmpty()) object["password"] = password;
|
||||
if (tls->enabled) object["tls"] = tls->ExportToJson();
|
||||
return object;
|
||||
@ -149,10 +150,12 @@ namespace Configs {
|
||||
if (!hop_interval.isEmpty()) object["hop_interval"] = hop_interval;
|
||||
if (up_mbps > 0) object["up_mbps"] = up_mbps;
|
||||
if (down_mbps > 0) object["down_mbps"] = down_mbps;
|
||||
QJsonObject obfsObj;
|
||||
obfsObj["type"] = obfsType;
|
||||
obfsObj["password"] = obfsPassword;
|
||||
if (!obfsObj.isEmpty()) object["obfs"] = obfsObj;
|
||||
if (!obfsPassword.isEmpty()) {
|
||||
QJsonObject obfsObj;
|
||||
obfsObj["type"] = "salamander";
|
||||
obfsObj["password"] = obfsPassword;
|
||||
object["obfs"] = obfsObj;
|
||||
}
|
||||
if (!password.isEmpty()) object["password"] = password;
|
||||
if (tls->enabled) object["tls"] = tls->Build().object;
|
||||
return {object, ""};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user