mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
feat: add TUIC protocol (#781)
--------- Co-authored-by: 2022-blake3-chacha8-poly1305 <139959885+xchacha20-ietf-poly1305@users.noreply.github.com> Co-authored-by: arm64v8a <48624112+arm64v8a@users.noreply.github.com>
This commit is contained in:
@@ -169,36 +169,47 @@ namespace NekoGui_fmt {
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreObjOutboundBuildResult HysteriaBean::BuildCoreObjSingBox() {
|
||||
CoreObjOutboundBuildResult QUICBean::BuildCoreObjSingBox() {
|
||||
CoreObjOutboundBuildResult result;
|
||||
|
||||
QJsonObject coreTlsObj{
|
||||
{"enabled", true},
|
||||
{"disable_sni", disableSni},
|
||||
{"insecure", allowInsecure},
|
||||
{"certificate", caText.trimmed()},
|
||||
{"server_name", sni},
|
||||
};
|
||||
if (!alpn.trimmed().isEmpty()) coreTlsObj["alpn"] = QJsonArray{alpn};
|
||||
if (!alpn.trimmed().isEmpty()) coreTlsObj["alpn"] = QList2QJsonArray(alpn.split(","));
|
||||
|
||||
QJsonObject coreHysteriaObj{
|
||||
{"type", "hysteria"},
|
||||
QJsonObject outbound{
|
||||
{"server", serverAddress},
|
||||
{"server_port", serverPort},
|
||||
{"obfs", obfsPassword},
|
||||
{"disable_mtu_discovery", disableMtuDiscovery},
|
||||
{"recv_window", streamReceiveWindow},
|
||||
{"recv_window_conn", connectionReceiveWindow},
|
||||
{"up_mbps", uploadMbps},
|
||||
{"down_mbps", downloadMbps},
|
||||
{"tls", coreTlsObj},
|
||||
};
|
||||
|
||||
if (!hopPort.trimmed().isEmpty()) coreHysteriaObj["hop_ports"] = hopPort;
|
||||
if (proxy_type == proxy_Hysteria) {
|
||||
outbound["type"] = "hysteria";
|
||||
outbound["obfs"] = obfsPassword;
|
||||
outbound["disable_mtu_discovery"] = disableMtuDiscovery;
|
||||
outbound["recv_window"] = streamReceiveWindow;
|
||||
outbound["recv_window_conn"] = connectionReceiveWindow;
|
||||
outbound["up_mbps"] = uploadMbps;
|
||||
outbound["down_mbps"] = downloadMbps;
|
||||
|
||||
if (authPayloadType == hysteria_auth_base64) coreHysteriaObj["auth"] = authPayload;
|
||||
if (authPayloadType == hysteria_auth_string) coreHysteriaObj["auth_str"] = authPayload;
|
||||
if (!hopPort.trimmed().isEmpty()) outbound["hop_ports"] = hopPort;
|
||||
if (authPayloadType == hysteria_auth_base64) outbound["auth"] = authPayload;
|
||||
if (authPayloadType == hysteria_auth_string) outbound["auth_str"] = authPayload;
|
||||
} else if (proxy_type == proxy_TUIC) {
|
||||
outbound["type"] = "tuic";
|
||||
outbound["uuid"] = uuid;
|
||||
outbound["password"] = password;
|
||||
outbound["congestion_control"] = congestionControl;
|
||||
outbound["udp_relay_mode"] = udpRelayMode;
|
||||
outbound["zero_rtt_handshake"] = zeroRttHandshake;
|
||||
if (!heartbeat.trimmed().isEmpty()) outbound["heartbeat"] = heartbeat;
|
||||
}
|
||||
|
||||
result.outbound = coreHysteriaObj;
|
||||
result.outbound = outbound;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user