mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-13 08:45:00 +03:00
Refactor Transport (#9004)
* Refactor transport * Rename tcp to raw * Fix * Fix Fix raw http ui Fill xhttp default mode Fix share uri Remove RawHost Fix singbox tcp http path Fix vmess share uri * Tidy Resx * Fix * Rename TransportExtra to TransportExtraItem --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -236,9 +236,6 @@ public static class ConfigHandler
|
||||
item.Password = profileItem.Password;
|
||||
|
||||
item.Network = profileItem.Network;
|
||||
item.HeaderType = profileItem.HeaderType;
|
||||
item.RequestHost = profileItem.RequestHost;
|
||||
item.Path = profileItem.Path;
|
||||
|
||||
item.StreamSecurity = profileItem.StreamSecurity;
|
||||
item.Sni = profileItem.Sni;
|
||||
@@ -250,7 +247,6 @@ public static class ConfigHandler
|
||||
item.ShortId = profileItem.ShortId;
|
||||
item.SpiderX = profileItem.SpiderX;
|
||||
item.Mldsa65Verify = profileItem.Mldsa65Verify;
|
||||
item.Extra = profileItem.Extra;
|
||||
item.MuxEnabled = profileItem.MuxEnabled;
|
||||
item.Cert = profileItem.Cert;
|
||||
item.CertSha = profileItem.CertSha;
|
||||
@@ -258,6 +254,7 @@ public static class ConfigHandler
|
||||
item.EchForceQuery = profileItem.EchForceQuery;
|
||||
item.Finalmask = profileItem.Finalmask;
|
||||
item.ProtoExtra = profileItem.ProtoExtra;
|
||||
item.TransportExtra = profileItem.TransportExtra;
|
||||
}
|
||||
|
||||
var ret = item.ConfigType switch
|
||||
@@ -297,9 +294,6 @@ public static class ConfigHandler
|
||||
VmessSecurity = profileItem.GetProtocolExtra().VmessSecurity?.TrimEx()
|
||||
});
|
||||
profileItem.Network = profileItem.Network.TrimEx();
|
||||
profileItem.HeaderType = profileItem.HeaderType.TrimEx();
|
||||
profileItem.RequestHost = profileItem.RequestHost.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.StreamSecurity = profileItem.StreamSecurity.TrimEx();
|
||||
|
||||
if (!Global.VmessSecurities.Contains(profileItem.GetProtocolExtra().VmessSecurity))
|
||||
@@ -751,10 +745,12 @@ public static class ConfigHandler
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Network = string.Empty;
|
||||
|
||||
if (!Global.TuicCongestionControls.Contains(profileItem.HeaderType))
|
||||
var congestionControl = profileItem.GetProtocolExtra().CongestionControl;
|
||||
if (!Global.TuicCongestionControls.Contains(congestionControl))
|
||||
{
|
||||
profileItem.HeaderType = Global.TuicCongestionControls.FirstOrDefault()!;
|
||||
congestionControl = Global.TuicCongestionControls.FirstOrDefault()!;
|
||||
}
|
||||
profileItem.SetProtocolExtra(profileItem.GetProtocolExtra() with { CongestionControl = congestionControl });
|
||||
|
||||
if (profileItem.StreamSecurity.IsNullOrEmpty())
|
||||
{
|
||||
@@ -996,9 +992,6 @@ public static class ConfigHandler
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Network = profileItem.Network.TrimEx();
|
||||
profileItem.HeaderType = profileItem.HeaderType.TrimEx();
|
||||
profileItem.RequestHost = profileItem.RequestHost.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.StreamSecurity = profileItem.StreamSecurity.TrimEx();
|
||||
|
||||
var vlessEncryption = profileItem.GetProtocolExtra().VlessEncryption?.TrimEx();
|
||||
@@ -1067,7 +1060,7 @@ public static class ConfigHandler
|
||||
/// <returns>0 if successful</returns>
|
||||
public static async Task<int> AddServerCommon(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.ConfigVersion = 3;
|
||||
profileItem.ConfigVersion = 4;
|
||||
|
||||
if (profileItem.StreamSecurity.IsNotEmpty())
|
||||
{
|
||||
@@ -1135,6 +1128,8 @@ public static class ConfigHandler
|
||||
|
||||
var oProtocolExtra = o.GetProtocolExtra();
|
||||
var nProtocolExtra = n.GetProtocolExtra();
|
||||
var oTransport = o.GetTransportExtra();
|
||||
var nTransport = n.GetTransportExtra();
|
||||
|
||||
return o.ConfigType == n.ConfigType
|
||||
&& AreEqual(o.Address, n.Address)
|
||||
@@ -1145,9 +1140,16 @@ public static class ConfigHandler
|
||||
&& AreEqual(oProtocolExtra.SsMethod, nProtocolExtra.SsMethod)
|
||||
&& AreEqual(oProtocolExtra.VmessSecurity, nProtocolExtra.VmessSecurity)
|
||||
&& AreEqual(o.Network, n.Network)
|
||||
&& AreEqual(o.HeaderType, n.HeaderType)
|
||||
&& AreEqual(o.RequestHost, n.RequestHost)
|
||||
&& AreEqual(o.Path, n.Path)
|
||||
&& AreEqual(oTransport.RawHeaderType, nTransport.RawHeaderType)
|
||||
&& AreEqual(oTransport.Host, nTransport.Host)
|
||||
&& AreEqual(oTransport.Path, nTransport.Path)
|
||||
&& AreEqual(oTransport.XhttpMode, nTransport.XhttpMode)
|
||||
&& AreEqual(oTransport.XhttpExtra, nTransport.XhttpExtra)
|
||||
&& AreEqual(oTransport.GrpcAuthority, nTransport.GrpcAuthority)
|
||||
&& AreEqual(oTransport.GrpcServiceName, nTransport.GrpcServiceName)
|
||||
&& AreEqual(oTransport.GrpcMode, nTransport.GrpcMode)
|
||||
&& AreEqual(oTransport.KcpHeaderType, nTransport.KcpHeaderType)
|
||||
&& AreEqual(oTransport.KcpSeed, nTransport.KcpSeed)
|
||||
&& (o.ConfigType == EConfigType.Trojan || o.StreamSecurity == n.StreamSecurity)
|
||||
&& AreEqual(oProtocolExtra.Flow, nProtocolExtra.Flow)
|
||||
&& AreEqual(oProtocolExtra.SalamanderPass, nProtocolExtra.SalamanderPass)
|
||||
|
||||
Reference in New Issue
Block a user