mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-09 22:15:00 +03:00
Add MASQUE warp support (#10498)
This commit is contained in:
@@ -1061,10 +1061,6 @@ public static class ConfigHandler
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Username = profileItem.Username.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Fingerprint = string.Empty;
|
||||
profileItem.Alpn = string.Empty;
|
||||
profileItem.Network = string.Empty;
|
||||
profileItem.AllowInsecure = string.Empty;
|
||||
if (profileItem.StreamSecurity.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.StreamSecurity = Global.StreamSecurity;
|
||||
|
||||
@@ -451,6 +451,14 @@ public class MasqueSettings4Ray
|
||||
{
|
||||
public string? path { get; set; }
|
||||
public Dictionary<string, string>? headers { get; set; }
|
||||
public MasqueWarpSettings4Ray? warp { get; set; }
|
||||
}
|
||||
|
||||
public class MasqueWarpSettings4Ray
|
||||
{
|
||||
public string? privateKey { get; set; }
|
||||
public string? publicKey { get; set; }
|
||||
public List<string>? address { get; set; }
|
||||
}
|
||||
|
||||
public class UdpHop4Ray
|
||||
|
||||
@@ -49,6 +49,9 @@ public record ProtocolExtraItem
|
||||
// MASQUE
|
||||
public string? MasquePath { get; init; }
|
||||
public string? MasqueHeaders { get; init; }
|
||||
public string? WarpPublicKey { get; init; }
|
||||
public string? WarpPrivateKey { get; init; }
|
||||
public string? WarpAddress { get; init; }
|
||||
|
||||
// group profile
|
||||
public string? GroupType { get; init; }
|
||||
|
||||
Generated
+9
@@ -5166,6 +5166,15 @@ namespace ServiceLib.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Warp 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbWarp {
|
||||
get {
|
||||
return ResourceManager.GetString("TbWarp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Xray Only 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1908,4 +1908,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="menuColumns" xml:space="preserve">
|
||||
<value>Columns</value>
|
||||
</data>
|
||||
<data name="TbWarp" xml:space="preserve">
|
||||
<value>Warp</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1900,4 +1900,7 @@
|
||||
<data name="menuColumns" xml:space="preserve">
|
||||
<value>列</value>
|
||||
</data>
|
||||
<data name="TbWarp" xml:space="preserve">
|
||||
<value>Warp</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -598,11 +598,21 @@ public partial class CoreConfigV2rayService
|
||||
}
|
||||
headers = userHeaders;
|
||||
}
|
||||
streamSettings.masqueSettings = new()
|
||||
var masqueSettings = new MasqueSettings4Ray
|
||||
{
|
||||
path = protocolExtra?.MasquePath.NullIfEmpty(),
|
||||
headers = headers.Count > 0 ? headers : null,
|
||||
};
|
||||
if (!protocolExtra.WarpPrivateKey.IsNullOrEmpty())
|
||||
{
|
||||
masqueSettings.warp = new MasqueWarpSettings4Ray
|
||||
{
|
||||
publicKey = protocolExtra.WarpPublicKey,
|
||||
privateKey = protocolExtra.WarpPrivateKey,
|
||||
address = Utils.String2List(protocolExtra.WarpAddress)?.Select(s => s.Trim()).ToList(),
|
||||
};
|
||||
}
|
||||
streamSettings.masqueSettings = masqueSettings;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -103,6 +103,15 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
||||
[Reactive]
|
||||
public partial string MasqueHeaders { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string WarpPublicKey { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string WarpPrivateKey { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string WarpAddress { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string Network { get; set; }
|
||||
|
||||
@@ -334,6 +343,9 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
||||
GeckoMaxPacketSize = protocolExtra.GeckoMaxPacketSize.ToInt();
|
||||
MasquePath = protocolExtra.MasquePath ?? string.Empty;
|
||||
MasqueHeaders = protocolExtra.MasqueHeaders ?? string.Empty;
|
||||
WarpPublicKey = protocolExtra.WarpPublicKey ?? string.Empty;
|
||||
WarpPrivateKey = protocolExtra.WarpPrivateKey ?? string.Empty;
|
||||
WarpAddress = protocolExtra.WarpAddress ?? string.Empty;
|
||||
|
||||
RawHeaderType = transport.RawHeaderType ?? Global.None;
|
||||
Host = transport.Host ?? string.Empty;
|
||||
@@ -458,6 +470,9 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
||||
GeckoMaxPacketSize = GeckoMaxPacketSize > 0 ? GeckoMaxPacketSize.ToString() : null,
|
||||
MasquePath = MasquePath.NullIfEmpty(),
|
||||
MasqueHeaders = MasqueHeaders.NullIfEmpty(),
|
||||
WarpPublicKey = WarpPublicKey.NullIfEmpty(),
|
||||
WarpPrivateKey = WarpPrivateKey.NullIfEmpty(),
|
||||
WarpAddress = WarpAddress.NullIfEmpty(),
|
||||
});
|
||||
SelectedSource.SetTransportExtra(transport);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user