diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index aeccf43d..34e67761 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -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; diff --git a/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs b/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs index e4299ec6..9f14f021 100644 --- a/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs @@ -451,6 +451,14 @@ public class MasqueSettings4Ray { public string? path { get; set; } public Dictionary? headers { get; set; } + public MasqueWarpSettings4Ray? warp { get; set; } +} + +public class MasqueWarpSettings4Ray +{ + public string? privateKey { get; set; } + public string? publicKey { get; set; } + public List? address { get; set; } } public class UdpHop4Ray diff --git a/v2rayN/ServiceLib/Models/Entities/ProtocolExtraItem.cs b/v2rayN/ServiceLib/Models/Entities/ProtocolExtraItem.cs index eb2059ca..a149c2a4 100644 --- a/v2rayN/ServiceLib/Models/Entities/ProtocolExtraItem.cs +++ b/v2rayN/ServiceLib/Models/Entities/ProtocolExtraItem.cs @@ -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; } diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 3c9847f0..ca68ab73 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -5166,6 +5166,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Warp 的本地化字符串。 + /// + public static string TbWarp { + get { + return ResourceManager.GetString("TbWarp", resourceCulture); + } + } + /// /// 查找类似 Xray Only 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 49d63db7..c17ef0f0 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1908,4 +1908,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if Columns + + Warp + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 70b03202..bbaafa32 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1900,4 +1900,7 @@ 列 + + Warp + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index fe69aeef..0803f9b3 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -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: diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index aea7ce68..c76c69ee 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -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); diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml index 8ebbcbec..ce29e9de 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml @@ -789,7 +789,7 @@ Grid.Row="2" ColumnDefinitions="300,Auto" IsVisible="False" - RowDefinitions="Auto,Auto,Auto,Auto,Auto"> + RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto"> + + + this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity14.Text).DisposeWith(currentTypeDisposables); this.Bind(ViewModel, vm => vm.MasquePath, v => v.txtPath14.Text).DisposeWith(currentTypeDisposables); this.Bind(ViewModel, vm => vm.MasqueHeaders, v => v.txtHttpHeaders14.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpPublicKey, v => v.txtWarpPublicKey.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpPrivateKey, v => v.txtWarpPrivateKey.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpAddress, v => v.txtWarpAddress.Text).DisposeWith(currentTypeDisposables); break; } }) @@ -295,8 +298,6 @@ public partial class AddServerWindow : WindowBase gridMasque.IsVisible = true; sepa2.IsVisible = false; gridTransport.IsVisible = false; - cmbFingerprint.IsEnabled = false; - cmbAlpn.IsEnabled = false; break; } cmbStreamSecurity.ItemsSource = lstStreamSecurity; diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml b/v2rayN/v2rayN/Views/AddServerWindow.xaml index 2ab40a0e..846b6aa6 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml @@ -1010,6 +1010,7 @@ + @@ -1081,6 +1082,63 @@ MinLines="3" Style="{StaticResource MyOutlinedTextBox}" TextWrapping="Wrap" /> + + + + + + + + + + + + + + vm.SelectedSource.Password, v => v.txtSecurity14.Text).DisposeWith(currentTypeDisposables); this.Bind(ViewModel, vm => vm.MasquePath, v => v.txtPath14.Text).DisposeWith(currentTypeDisposables); this.Bind(ViewModel, vm => vm.MasqueHeaders, v => v.txtHeaders14.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpPublicKey, v => v.txtWarpPublicKey.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpPrivateKey, v => v.txtWarpPrivateKey.Text).DisposeWith(currentTypeDisposables); + this.Bind(ViewModel, vm => vm.WarpAddress, v => v.txtWarpAddress.Text).DisposeWith(currentTypeDisposables); break; } }) @@ -296,8 +299,6 @@ public partial class AddServerWindow gridMasque.Visibility = Visibility.Visible; sepa2.Visibility = Visibility.Collapsed; gridTransport.Visibility = Visibility.Collapsed; - cmbFingerprint.IsEnabled = false; - cmbAlpn.IsEnabled = false; break; } cmbStreamSecurity.ItemsSource = lstStreamSecurity;