mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-03 11:05:08 +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.Address = profileItem.Address.TrimEx();
|
||||||
profileItem.Username = profileItem.Username.TrimEx();
|
profileItem.Username = profileItem.Username.TrimEx();
|
||||||
profileItem.Password = profileItem.Password.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())
|
if (profileItem.StreamSecurity.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.StreamSecurity = Global.StreamSecurity;
|
profileItem.StreamSecurity = Global.StreamSecurity;
|
||||||
|
|||||||
@@ -451,6 +451,14 @@ public class MasqueSettings4Ray
|
|||||||
{
|
{
|
||||||
public string? path { get; set; }
|
public string? path { get; set; }
|
||||||
public Dictionary<string, string>? headers { 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
|
public class UdpHop4Ray
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ public record ProtocolExtraItem
|
|||||||
// MASQUE
|
// MASQUE
|
||||||
public string? MasquePath { get; init; }
|
public string? MasquePath { get; init; }
|
||||||
public string? MasqueHeaders { get; init; }
|
public string? MasqueHeaders { get; init; }
|
||||||
|
public string? WarpPublicKey { get; init; }
|
||||||
|
public string? WarpPrivateKey { get; init; }
|
||||||
|
public string? WarpAddress { get; init; }
|
||||||
|
|
||||||
// group profile
|
// group profile
|
||||||
public string? GroupType { get; init; }
|
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>
|
/// <summary>
|
||||||
/// 查找类似 Xray Only 的本地化字符串。
|
/// 查找类似 Xray Only 的本地化字符串。
|
||||||
/// </summary>
|
/// </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">
|
<data name="menuColumns" xml:space="preserve">
|
||||||
<value>Columns</value>
|
<value>Columns</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbWarp" xml:space="preserve">
|
||||||
|
<value>Warp</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1900,4 +1900,7 @@
|
|||||||
<data name="menuColumns" xml:space="preserve">
|
<data name="menuColumns" xml:space="preserve">
|
||||||
<value>列</value>
|
<value>列</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbWarp" xml:space="preserve">
|
||||||
|
<value>Warp</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -598,11 +598,21 @@ public partial class CoreConfigV2rayService
|
|||||||
}
|
}
|
||||||
headers = userHeaders;
|
headers = userHeaders;
|
||||||
}
|
}
|
||||||
streamSettings.masqueSettings = new()
|
var masqueSettings = new MasqueSettings4Ray
|
||||||
{
|
{
|
||||||
path = protocolExtra?.MasquePath.NullIfEmpty(),
|
path = protocolExtra?.MasquePath.NullIfEmpty(),
|
||||||
headers = headers.Count > 0 ? headers : null,
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -103,6 +103,15 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
|||||||
[Reactive]
|
[Reactive]
|
||||||
public partial string MasqueHeaders { get; set; }
|
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]
|
[Reactive]
|
||||||
public partial string Network { get; set; }
|
public partial string Network { get; set; }
|
||||||
|
|
||||||
@@ -334,6 +343,9 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
|||||||
GeckoMaxPacketSize = protocolExtra.GeckoMaxPacketSize.ToInt();
|
GeckoMaxPacketSize = protocolExtra.GeckoMaxPacketSize.ToInt();
|
||||||
MasquePath = protocolExtra.MasquePath ?? string.Empty;
|
MasquePath = protocolExtra.MasquePath ?? string.Empty;
|
||||||
MasqueHeaders = protocolExtra.MasqueHeaders ?? 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;
|
RawHeaderType = transport.RawHeaderType ?? Global.None;
|
||||||
Host = transport.Host ?? string.Empty;
|
Host = transport.Host ?? string.Empty;
|
||||||
@@ -458,6 +470,9 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
|||||||
GeckoMaxPacketSize = GeckoMaxPacketSize > 0 ? GeckoMaxPacketSize.ToString() : null,
|
GeckoMaxPacketSize = GeckoMaxPacketSize > 0 ? GeckoMaxPacketSize.ToString() : null,
|
||||||
MasquePath = MasquePath.NullIfEmpty(),
|
MasquePath = MasquePath.NullIfEmpty(),
|
||||||
MasqueHeaders = MasqueHeaders.NullIfEmpty(),
|
MasqueHeaders = MasqueHeaders.NullIfEmpty(),
|
||||||
|
WarpPublicKey = WarpPublicKey.NullIfEmpty(),
|
||||||
|
WarpPrivateKey = WarpPrivateKey.NullIfEmpty(),
|
||||||
|
WarpAddress = WarpAddress.NullIfEmpty(),
|
||||||
});
|
});
|
||||||
SelectedSource.SetTransportExtra(transport);
|
SelectedSource.SetTransportExtra(transport);
|
||||||
|
|
||||||
|
|||||||
@@ -789,7 +789,7 @@
|
|||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
ColumnDefinitions="300,Auto"
|
ColumnDefinitions="300,Auto"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
RowDefinitions="Auto,Auto,Auto,Auto,Auto">
|
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -845,6 +845,64 @@
|
|||||||
Classes="TextArea"
|
Classes="TextArea"
|
||||||
PlaceholderText="Header: Value"
|
PlaceholderText="Header: Value"
|
||||||
TextWrapping="NoWrap" />
|
TextWrapping="NoWrap" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Static resx:ResUI.TbWarp}" />
|
||||||
|
<Button
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="{StaticResource MarginLr4}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="IconButton">
|
||||||
|
<Button.Content>
|
||||||
|
<PathIcon Data="{StaticResource SemiIconMore}">
|
||||||
|
<PathIcon.RenderTransform>
|
||||||
|
<RotateTransform Angle="90" />
|
||||||
|
</PathIcon.RenderTransform>
|
||||||
|
</PathIcon>
|
||||||
|
</Button.Content>
|
||||||
|
<Button.Flyout>
|
||||||
|
<Flyout>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Text="{x:Static resx:ResUI.TbXrayOnly}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Static resx:ResUI.TbPrivateKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpPrivateKey"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Static resx:ResUI.TbPublicKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpPublicKey"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Static resx:ResUI.TbLocalAddress}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpAddress"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
PlaceholderText="Ipv4, Ipv6" />
|
||||||
|
</StackPanel>
|
||||||
|
</Flyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Separator
|
<Separator
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity14.Text).DisposeWith(currentTypeDisposables);
|
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.MasquePath, v => v.txtPath14.Text).DisposeWith(currentTypeDisposables);
|
||||||
this.Bind(ViewModel, vm => vm.MasqueHeaders, v => v.txtHttpHeaders14.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;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -295,8 +298,6 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||||||
gridMasque.IsVisible = true;
|
gridMasque.IsVisible = true;
|
||||||
sepa2.IsVisible = false;
|
sepa2.IsVisible = false;
|
||||||
gridTransport.IsVisible = false;
|
gridTransport.IsVisible = false;
|
||||||
cmbFingerprint.IsEnabled = false;
|
|
||||||
cmbAlpn.IsEnabled = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
||||||
|
|||||||
@@ -1010,6 +1010,7 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="300" />
|
<ColumnDefinition Width="300" />
|
||||||
@@ -1081,6 +1082,63 @@
|
|||||||
MinLines="3"
|
MinLines="3"
|
||||||
Style="{StaticResource MyOutlinedTextBox}"
|
Style="{StaticResource MyOutlinedTextBox}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbWarp}" />
|
||||||
|
<materialDesign:PopupBox
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
StaysOpen="True"
|
||||||
|
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbXrayOnly}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbPrivateKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpPrivateKey"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbPublicKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpPublicKey"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbLocalAddress}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWarpAddress"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
materialDesign:HintAssist.Hint="Ipv4, Ipv6"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
</StackPanel>
|
||||||
|
</materialDesign:PopupBox>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Separator
|
<Separator
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ public partial class AddServerWindow
|
|||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtSecurity14.Text).DisposeWith(currentTypeDisposables);
|
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.MasquePath, v => v.txtPath14.Text).DisposeWith(currentTypeDisposables);
|
||||||
this.Bind(ViewModel, vm => vm.MasqueHeaders, v => v.txtHeaders14.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;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -296,8 +299,6 @@ public partial class AddServerWindow
|
|||||||
gridMasque.Visibility = Visibility.Visible;
|
gridMasque.Visibility = Visibility.Visible;
|
||||||
sepa2.Visibility = Visibility.Collapsed;
|
sepa2.Visibility = Visibility.Collapsed;
|
||||||
gridTransport.Visibility = Visibility.Collapsed;
|
gridTransport.Visibility = Visibility.Collapsed;
|
||||||
cmbFingerprint.IsEnabled = false;
|
|
||||||
cmbAlpn.IsEnabled = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
||||||
|
|||||||
Reference in New Issue
Block a user