mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Add PacketEncoding parameter
This commit is contained in:
@@ -31,6 +31,8 @@ public class Outbound
|
||||
|
||||
public StreamSettings streamSettings { get; set; }
|
||||
|
||||
public string packetEncoding { get; set; }
|
||||
|
||||
public Mux mux { get; set; }
|
||||
}
|
||||
|
||||
@@ -54,6 +56,8 @@ public class Mux
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
|
||||
public string packetEncoding { get; set; }
|
||||
|
||||
public int concurrency { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ public static class V2rayConfigUtils
|
||||
}
|
||||
};
|
||||
|
||||
outbound.packetEncoding = vless.PacketEncoding ?? "none";
|
||||
outbound.mux.packetEncoding = vless.PacketEncoding ?? "none";
|
||||
|
||||
outbound.streamSettings = boundStreamSettings(vless);
|
||||
|
||||
if (vless.TLSSecureType == "xtls")
|
||||
@@ -125,6 +128,9 @@ public static class V2rayConfigUtils
|
||||
}
|
||||
};
|
||||
|
||||
outbound.packetEncoding = vmess.PacketEncoding ?? "none";
|
||||
outbound.mux.packetEncoding = vmess.PacketEncoding ?? "none";
|
||||
|
||||
outbound.streamSettings = boundStreamSettings(vmess);
|
||||
|
||||
outbound.mux.enabled = vmess.UseMux ?? Global.Settings.V2RayConfig.UseMux;
|
||||
|
||||
@@ -22,6 +22,7 @@ public static class V2rayUtils
|
||||
var parameter = HttpUtility.ParseQueryString(text.Split('?')[1]);
|
||||
text = text.Substring(0, text.IndexOf("?", StringComparison.Ordinal));
|
||||
server.TransferProtocol = parameter.Get("type") ?? "tcp";
|
||||
server.PacketEncoding = parameter.Get("packetEncoding") ?? "xudp";
|
||||
server.EncryptMethod = parameter.Get("encryption") ?? scheme switch { "vless" => "none", _ => "auto" };
|
||||
switch (server.TransferProtocol)
|
||||
{
|
||||
@@ -79,6 +80,7 @@ public static class V2rayUtils
|
||||
// protocol-specific fields
|
||||
parameter.Add("type", server.TransferProtocol);
|
||||
parameter.Add("encryption", server.EncryptMethod);
|
||||
parameter.Add("packetEncoding", server.PacketEncoding);
|
||||
|
||||
// transport-specific fields
|
||||
switch (server.TransferProtocol)
|
||||
|
||||
@@ -23,6 +23,11 @@ internal class VLESSForm : ServerForm
|
||||
VLESSGlobal.TransferProtocols,
|
||||
s => server.TransferProtocol = s,
|
||||
server.TransferProtocol);
|
||||
CreateComboBox("PacketEncoding",
|
||||
"Packet Encoding",
|
||||
VMessGlobal.PacketEncodings,
|
||||
s => server.PacketEncoding = s,
|
||||
server.PacketEncoding);
|
||||
|
||||
CreateComboBox("FakeType", "Fake Type", VLESSGlobal.FakeTypes, s => server.FakeType = s, server.FakeType);
|
||||
CreateTextBox("Host", "Host", s => true, s => server.Host = s, server.Host);
|
||||
|
||||
@@ -20,9 +20,9 @@ public class VMessForm : ServerForm
|
||||
server.TransferProtocol);
|
||||
CreateComboBox("PacketEncoding",
|
||||
"Packet Encoding",
|
||||
VMessGlobal.TransferProtocols,
|
||||
s => server.TransferProtocol = s,
|
||||
server.TransferProtocol);
|
||||
VMessGlobal.PacketEncodings,
|
||||
s => server.PacketEncoding = s,
|
||||
server.PacketEncoding);
|
||||
|
||||
|
||||
CreateComboBox("FakeType", "Fake Type", VMessGlobal.FakeTypes, s => server.FakeType = s, server.FakeType);
|
||||
|
||||
@@ -125,7 +125,7 @@ public class VMessGlobal
|
||||
"none",
|
||||
"packet", // requires v2fly/v2ray-core v5.0.2+ or SagerNet/v2ray-core
|
||||
"xudp" // requires XTLS/Xray-core or SagerNet/v2ray-core
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// V2Ray 传输协议
|
||||
|
||||
@@ -60,7 +60,7 @@ if ( -Not ( Test-Path ".\Netch\bin\$Configuration" ) ) {
|
||||
-c $Configuration `
|
||||
-r 'win-x64' `
|
||||
-p:Platform='x64' `
|
||||
-p:SelfContained=$SelfContained `
|
||||
-p:SelfContained=$False `
|
||||
-p:PublishTrimmed=$PublishReadyToRun `
|
||||
-p:PublishSingleFile=$PublishSingleFile `
|
||||
-p:PublishReadyToRun=$PublishReadyToRun `
|
||||
|
||||
Reference in New Issue
Block a user