Support hysteria2

This commit is contained in:
arm64v8a
2023-09-05 21:52:01 +09:00
parent aad4063ef7
commit 9efde1a59e
13 changed files with 119 additions and 54 deletions

View File

@@ -10,6 +10,8 @@ namespace NekoGui_fmt {
static constexpr int proxy_Hysteria2 = 3;
int proxy_type = proxy_Hysteria;
bool forceExternal = false;
// Hysteria
static constexpr int hysteria_protocol_udp = 0;
@@ -68,10 +70,12 @@ namespace NekoGui_fmt {
_add(new configItem("disableMtuDiscovery", &disableMtuDiscovery, itemType::boolean));
_add(new configItem("hopInterval", &hopInterval, itemType::integer));
_add(new configItem("hopPort", &hopPort, itemType::string));
if (proxy_type == proxy_Hysteria2) {
if (proxy_type == proxy_Hysteria) { // hy1
_add(new configItem("authPayloadType", &authPayloadType, itemType::integer));
_add(new configItem("protocol", &hyProtocol, itemType::integer));
} else {
} else { // hy2
uploadMbps = 0;
downloadMbps = 0;
_add(new configItem("username", &username, itemType::string));
}
@@ -84,6 +88,7 @@ namespace NekoGui_fmt {
_add(new configItem("heartbeat", &heartbeat, itemType::string));
_add(new configItem("uos", &uos, itemType::boolean));
}
_add(new configItem("forceExternal", &forceExternal, itemType::boolean));
// TLS
_add(new configItem("allowInsecure", &allowInsecure, itemType::boolean));
_add(new configItem("sni", &sni, itemType::string));
@@ -97,7 +102,17 @@ namespace NekoGui_fmt {
return ::DisplayAddress(serverAddress, serverPort);
}
QString DisplayCoreType() override { return NeedExternal(true) == 0 ? software_core_name : "Hysteria"; };
QString DisplayCoreType() override {
if (NeedExternal(true) == 0) {
return software_core_name;
} else if (proxy_type == proxy_TUIC) {
return "tuic";
} else if (proxy_type == proxy_Hysteria) {
return "hysteria";
} else {
return "hysteria2";
}
}
QString DisplayType() override { return proxy_type == proxy_TUIC ? "TUIC" : "Hysteria"; };