mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
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:
@@ -70,12 +70,8 @@ namespace NekoGui_fmt {
|
|||||||
outbound->insert("tls", tls);
|
outbound->insert("tls", tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!packet_encoding.isEmpty()) {
|
if (outbound->value("type").toString() == "vmess" || outbound->value("type").toString() == "vless") {
|
||||||
auto pkt = packet_encoding;
|
outbound->insert("packet_encoding", packet_encoding);
|
||||||
if (pkt == "packet") pkt = "packetaddr";
|
|
||||||
outbound->insert("packet_encoding", pkt);
|
|
||||||
} else if (outbound->value("type").toString() == "vless") {
|
|
||||||
outbound->insert("packet_encoding", "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,11 +270,11 @@ namespace NekoGui_sub {
|
|||||||
if (type == "vless") {
|
if (type == "vless") {
|
||||||
bean->flow = Node2QString(proxy["flow"]);
|
bean->flow = Node2QString(proxy["flow"]);
|
||||||
bean->password = Node2QString(proxy["uuid"]);
|
bean->password = Node2QString(proxy["uuid"]);
|
||||||
// meta vless xudp
|
// meta packet encoding
|
||||||
auto xudp = proxy["xudp"];
|
if (Node2Bool(proxy["packet-addr"])) {
|
||||||
if (xudp.IsDefined() && !xudp.IsNull() && Node2Bool(xudp) == false) {
|
bean->stream->packet_encoding = "packetaddr";
|
||||||
bean->stream->packet_encoding = "";
|
|
||||||
} else {
|
} else {
|
||||||
|
// For VLESS, default to use xudp
|
||||||
bean->stream->packet_encoding = "xudp";
|
bean->stream->packet_encoding = "xudp";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -323,6 +323,10 @@ namespace NekoGui_sub {
|
|||||||
if (Node2Bool(proxy["tls"])) bean->stream->security = "tls";
|
if (Node2Bool(proxy["tls"])) bean->stream->security = "tls";
|
||||||
if (Node2Bool(proxy["skip-cert-verify"])) bean->stream->allow_insecure = true;
|
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
|
// opts
|
||||||
auto ws = NodeChild(proxy, {"ws-opts", "ws-opt"});
|
auto ws = NodeChild(proxy, {"ws-opts", "ws-opt"});
|
||||||
if (ws.IsMap()) {
|
if (ws.IsMap()) {
|
||||||
|
|||||||
@@ -271,7 +271,7 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">packet</string>
|
<string notr="true">packetaddr</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user