mirror of https://github.com/2dust/v2rayN
parent
59b7daaef5
commit
b8a0293b52
|
@ -240,6 +240,7 @@ namespace ServiceLib.Handler
|
|||
item.PublicKey = profileItem.PublicKey;
|
||||
item.ShortId = profileItem.ShortId;
|
||||
item.SpiderX = profileItem.SpiderX;
|
||||
item.Extra = profileItem.Extra;
|
||||
}
|
||||
|
||||
var ret = item.ConfigType switch
|
||||
|
|
|
@ -107,6 +107,10 @@ namespace ServiceLib.Handler.Fmt
|
|||
{
|
||||
dicQuery.Add("mode", Utils.UrlEncode(item.HeaderType));
|
||||
}
|
||||
if (Utils.IsNotEmpty(item.Extra))
|
||||
{
|
||||
dicQuery.Add("extra", Utils.UrlEncode(item.Extra));
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(ETransport.http):
|
||||
|
@ -180,6 +184,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
item.RequestHost = Utils.UrlDecode(query["host"] ?? "");
|
||||
item.Path = Utils.UrlDecode(query["path"] ?? "/");
|
||||
item.HeaderType = Utils.UrlDecode(query["mode"] ?? "");
|
||||
item.Extra = Utils.UrlDecode(query["extra"] ?? "");
|
||||
break;
|
||||
|
||||
case nameof(ETransport.http):
|
||||
|
|
|
@ -30,44 +30,25 @@ namespace ServiceLib.Models
|
|||
|
||||
public string GetSummary()
|
||||
{
|
||||
string summary = string.Format("[{0}] ", (ConfigType).ToString());
|
||||
string[] arrAddr = Address.Split('.');
|
||||
string addr;
|
||||
if (arrAddr.Length > 2)
|
||||
var summary = $"[{(ConfigType).ToString()}] ";
|
||||
var arrAddr = Address.Split('.');
|
||||
var addr = arrAddr.Length switch
|
||||
{
|
||||
addr = $"{arrAddr.First()}***{arrAddr.Last()}";
|
||||
}
|
||||
else if (arrAddr.Length > 1)
|
||||
> 2 => $"{arrAddr.First()}***{arrAddr.Last()}",
|
||||
> 1 => $"***{arrAddr.Last()}",
|
||||
_ => Address
|
||||
};
|
||||
summary += ConfigType switch
|
||||
{
|
||||
addr = $"***{arrAddr.Last()}";
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = Address;
|
||||
}
|
||||
switch (ConfigType)
|
||||
{
|
||||
case EConfigType.Custom:
|
||||
summary += string.Format("[{1}]{0}", Remarks, CoreType.ToString());
|
||||
break;
|
||||
|
||||
default:
|
||||
summary += string.Format("{0}({1}:{2})", Remarks, addr, Port);
|
||||
break;
|
||||
}
|
||||
EConfigType.Custom => $"[{CoreType.ToString()}]{Remarks}",
|
||||
_ => $"{Remarks}({addr}:{Port})"
|
||||
};
|
||||
return summary;
|
||||
}
|
||||
|
||||
public List<string>? GetAlpn()
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(Alpn))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utils.String2List(Alpn);
|
||||
}
|
||||
return Utils.IsNullOrEmpty(Alpn) ? null : Utils.String2List(Alpn);
|
||||
}
|
||||
|
||||
public string GetNetwork()
|
||||
|
@ -110,5 +91,6 @@ namespace ServiceLib.Models
|
|||
public string PublicKey { get; set; }
|
||||
public string ShortId { get; set; }
|
||||
public string SpiderX { get; set; }
|
||||
public string Extra { get; set; }
|
||||
}
|
||||
}
|
|
@ -353,6 +353,7 @@ namespace ServiceLib.Models
|
|||
public string? scMaxConcurrentPosts { get; set; }
|
||||
public string? scMinPostsIntervalMs { get; set; }
|
||||
public Xmux4Ray? xmux { get; set; }
|
||||
public object? extra { get; set; }
|
||||
}
|
||||
|
||||
public class Xmux4Ray
|
||||
|
|
|
@ -3697,6 +3697,15 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 XHTTP Extra raw JSON, format: { XHTTPObject } 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TransportExtraTip {
|
||||
get {
|
||||
return ResourceManager.GetString("TransportExtraTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 *tcp camouflage type 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1384,4 +1384,7 @@
|
|||
<data name="TransportHeaderTypeTip5" xml:space="preserve">
|
||||
<value>*xhttp mode</value>
|
||||
</data>
|
||||
<data name="TransportExtraTip" xml:space="preserve">
|
||||
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1384,4 +1384,7 @@
|
|||
<data name="TransportHeaderTypeTip5" xml:space="preserve">
|
||||
<value>*xhttp mode</value>
|
||||
</data>
|
||||
<data name="TransportExtraTip" xml:space="preserve">
|
||||
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1384,4 +1384,7 @@
|
|||
<data name="TransportHeaderTypeTip5" xml:space="preserve">
|
||||
<value>*xhttp mode</value>
|
||||
</data>
|
||||
<data name="TransportExtraTip" xml:space="preserve">
|
||||
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1381,4 +1381,7 @@
|
|||
<data name="TransportHeaderTypeTip5" xml:space="preserve">
|
||||
<value>*xhttp 模式</value>
|
||||
</data>
|
||||
<data name="TransportExtraTip" xml:space="preserve">
|
||||
<value>XHTTP Extra 原始 JSON,格式: { XHTTPObject }</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1381,4 +1381,7 @@
|
|||
<data name="TransportHeaderTypeTip5" xml:space="preserve">
|
||||
<value>*xhttp 模式</value>
|
||||
</data>
|
||||
<data name="TransportExtraTip" xml:space="preserve">
|
||||
<value>XHTTP Extra 原始 JSON,格式: { XHTTPObject }</value>
|
||||
</data>
|
||||
</root>
|
|
@ -949,6 +949,10 @@ namespace ServiceLib.Services.CoreConfig
|
|||
{
|
||||
xhttpSettings.mode = node.HeaderType;
|
||||
}
|
||||
if (Utils.IsNotEmpty(node.Extra))
|
||||
{
|
||||
xhttpSettings.extra = JsonUtils.ParseJson(node.Extra);
|
||||
}
|
||||
|
||||
streamSettings.xhttpSettings = xhttpSettings;
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
x:Name="txtPort"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
HorizontalAlignment="Left"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
|
@ -164,7 +164,7 @@
|
|||
x:Name="txtAlterId"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
HorizontalAlignment="Left"
|
||||
Classes="Margin8" />
|
||||
|
||||
|
@ -458,7 +458,7 @@
|
|||
x:Name="cmbHeaderType8"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
<Grid
|
||||
|
@ -541,7 +541,7 @@
|
|||
x:Name="txtShortId9"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
HorizontalAlignment="Left"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
|
@ -584,7 +584,7 @@
|
|||
x:Name="cmbNetwork"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Classes="Margin8" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
|
@ -600,12 +600,50 @@
|
|||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TbHeaderType}" />
|
||||
<ComboBox
|
||||
x:Name="cmbHeaderType"
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Classes="Margin8" />
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="cmbHeaderType"
|
||||
Width="200"
|
||||
Classes="Margin8" />
|
||||
|
||||
<Button
|
||||
x:Name="btnExtra"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="10,0"
|
||||
Theme="{DynamicResource BorderlessButton}">
|
||||
<Button.Content>
|
||||
<PathIcon
|
||||
Width="20"
|
||||
Height="20"
|
||||
Data="{StaticResource building_more}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Classes="Margin8"
|
||||
Text="{x:Static resx:ResUI.TransportExtraTip}" />
|
||||
<TextBox
|
||||
x:Name="txtExtra"
|
||||
Width="400"
|
||||
MinHeight="100"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Classes="TextArea Margin8"
|
||||
MinLines="6"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
x:Name="tipHeaderType"
|
||||
Grid.Row="2"
|
||||
|
@ -680,7 +718,7 @@
|
|||
x:Name="cmbStreamSecurity"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
<Grid
|
||||
|
@ -749,7 +787,7 @@
|
|||
x:Name="cmbAllowInsecure"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Classes="Margin8" />
|
||||
</Grid>
|
||||
<Grid
|
||||
|
|
|
@ -208,7 +208,8 @@ namespace v2rayN.Desktop.Views
|
|||
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.RequestHost, v => v.txtRequestHost.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Extra, v => v.txtExtra.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.StreamSecurity, v => v.cmbStreamSecurity.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.SelectedValue).DisposeWith(disposables);
|
||||
|
@ -326,6 +327,7 @@ namespace v2rayN.Desktop.Views
|
|||
network = Global.DefaultNetwork;
|
||||
}
|
||||
labHeaderType.IsVisible = true;
|
||||
btnExtra.IsVisible = false;
|
||||
tipRequestHost.Text =
|
||||
tipPath.Text =
|
||||
tipHeaderType.Text = string.Empty;
|
||||
|
@ -354,6 +356,7 @@ namespace v2rayN.Desktop.Views
|
|||
tipPath.Text = ResUI.TransportPathTip1;
|
||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip5;
|
||||
labHeaderType.IsVisible = false;
|
||||
btnExtra.IsVisible = true;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.h2):
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
Style="{StaticResource WindowGlobal}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Popupbox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
|
@ -128,7 +135,7 @@
|
|||
x:Name="txtPort"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
@ -188,7 +195,7 @@
|
|||
x:Name="txtAlterId"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
@ -513,7 +520,7 @@
|
|||
x:Name="cmbHeaderType8"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
|
@ -606,7 +613,7 @@
|
|||
x:Name="txtShortId9"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
@ -653,7 +660,7 @@
|
|||
x:Name="cmbNetwork"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
<TextBlock
|
||||
|
@ -672,13 +679,40 @@
|
|||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbHeaderType}" />
|
||||
<ComboBox
|
||||
x:Name="cmbHeaderType"
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="cmbHeaderType"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
|
||||
<materialDesign:PopupBox
|
||||
x:Name="popExtra"
|
||||
HorizontalAlignment="Right"
|
||||
StaysOpen="True"
|
||||
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TransportExtraTip}" />
|
||||
<TextBox
|
||||
x:Name="txtExtra"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
AcceptsReturn="True"
|
||||
MinLines="6"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</materialDesign:PopupBox>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
x:Name="tipHeaderType"
|
||||
Grid.Row="2"
|
||||
|
@ -764,7 +798,7 @@
|
|||
x:Name="cmbStreamSecurity"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
|
@ -842,7 +876,7 @@
|
|||
x:Name="cmbAllowInsecure"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Width="100"
|
||||
Width="200"
|
||||
Margin="{StaticResource Margin4}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
|
|
|
@ -202,7 +202,8 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.RequestHost, v => v.txtRequestHost.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Extra, v => v.txtExtra.Text).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.StreamSecurity, v => v.cmbStreamSecurity.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables);
|
||||
|
@ -321,6 +322,7 @@ namespace v2rayN.Views
|
|||
network = Global.DefaultNetwork;
|
||||
}
|
||||
labHeaderType.Visibility = Visibility.Visible;
|
||||
popExtra.Visibility = Visibility.Hidden;
|
||||
tipRequestHost.Text =
|
||||
tipPath.Text =
|
||||
tipHeaderType.Text = string.Empty;
|
||||
|
@ -349,6 +351,7 @@ namespace v2rayN.Views
|
|||
tipPath.Text = ResUI.TransportPathTip1;
|
||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip5;
|
||||
labHeaderType.Visibility = Visibility.Hidden;
|
||||
popExtra.Visibility = Visibility.Visible;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.h2):
|
||||
|
|
Loading…
Reference in New Issue