fix packet encoding (#774)

* feat(sub): get packet encoding from Clash.Meta's sub

* fix: use "packetaddr" instead of "packet"

* fix

* fix

---------

Co-authored-by: 2022-blake3-chacha8-poly1305 <139959885+xchacha20-ietf-poly1305@users.noreply.github.com>
This commit is contained in:
HystericalDragon
2023-08-08 14:14:39 +08:00
committed by GitHub
parent d35867b7ab
commit df1c7cc8b4
3 changed files with 11 additions and 11 deletions

View File

@@ -270,11 +270,11 @@ namespace NekoGui_sub {
if (type == "vless") {
bean->flow = Node2QString(proxy["flow"]);
bean->password = Node2QString(proxy["uuid"]);
// meta vless xudp
auto xudp = proxy["xudp"];
if (xudp.IsDefined() && !xudp.IsNull() && Node2Bool(xudp) == false) {
bean->stream->packet_encoding = "";
// meta packet encoding
if (Node2Bool(proxy["packet-addr"])) {
bean->stream->packet_encoding = "packetaddr";
} else {
// For VLESS, default to use xudp
bean->stream->packet_encoding = "xudp";
}
} else {
@@ -323,6 +323,10 @@ namespace NekoGui_sub {
if (Node2Bool(proxy["tls"])) bean->stream->security = "tls";
if (Node2Bool(proxy["skip-cert-verify"])) bean->stream->allow_insecure = true;
// meta packet encoding
if (Node2Bool(proxy["xudp"])) bean->stream->packet_encoding = "xudp";
if (Node2Bool(proxy["packet-addr"])) bean->stream->packet_encoding = "packetaddr";
// opts
auto ws = NodeChild(proxy, {"ws-opts", "ws-opt"});
if (ws.IsMap()) {