Add reality and remove legacy xtls settings

This commit is contained in:
2dust 2023-03-09 20:57:12 +08:00
parent 6f181053b2
commit 045af7e8df
10 changed files with 241 additions and 150 deletions

View file

@ -43,7 +43,7 @@
public const string directTag = "direct"; public const string directTag = "direct";
public const string blockTag = "block"; public const string blockTag = "block";
public const string StreamSecurity = "tls"; public const string StreamSecurity = "tls";
public const string StreamSecurityX = "xtls"; public const string StreamSecurityReality = "reality";
public const string InboundSocks = "socks"; public const string InboundSocks = "socks";
public const string InboundHttp = "http"; public const string InboundHttp = "http";
public const string InboundSocks2 = "socks2"; public const string InboundSocks2 = "socks2";
@ -92,7 +92,7 @@
public static readonly List<string> ssSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" }; public static readonly List<string> ssSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
public static readonly List<string> ssSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" }; public static readonly List<string> ssSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" };
public static readonly List<string> ssSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" }; public static readonly List<string> ssSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
public static readonly List<string> xtlsFlows = new() { "", "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443", "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; public static readonly List<string> flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" }; public static readonly List<string> networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
public static readonly List<string> kcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List<string> kcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5" }; public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5" };

View file

@ -456,16 +456,15 @@ namespace v2rayN.Handler
boundStreamSettings(node, "out", outbound.streamSettings); boundStreamSettings(node, "out", outbound.streamSettings);
//if xtls if (node.streamSecurity == Global.StreamSecurityReality)
if (node.streamSecurity == Global.StreamSecurityX)
{ {
if (Utils.IsNullOrEmpty(node.flow)) if (Utils.IsNullOrEmpty(node.flow))
{ {
usersItem.flow = Global.xtlsFlows[1]; usersItem.flow = Global.flows[1];
} }
else else
{ {
usersItem.flow = node.flow.Replace("splice", "direct"); usersItem.flow = node.flow;
} }
outbound.mux.enabled = false; outbound.mux.enabled = false;
@ -505,22 +504,6 @@ namespace v2rayN.Handler
serversItem.ota = false; serversItem.ota = false;
serversItem.level = 1; serversItem.level = 1;
//if xtls
if (node.streamSecurity == Global.StreamSecurityX)
{
if (Utils.IsNullOrEmpty(node.flow))
{
serversItem.flow = Global.xtlsFlows[1];
}
else
{
serversItem.flow = node.flow.Replace("splice", "direct");
}
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
}
outbound.mux.enabled = false; outbound.mux.enabled = false;
outbound.mux.concurrency = -1; outbound.mux.concurrency = -1;
@ -581,26 +564,21 @@ namespace v2rayN.Handler
streamSettings.tlsSettings = tlsSettings; streamSettings.tlsSettings = tlsSettings;
} }
//if xtls //if Reality
if (node.streamSecurity == Global.StreamSecurityX) if (node.streamSecurity == Global.StreamSecurityReality)
{ {
streamSettings.security = node.streamSecurity; streamSettings.security = node.streamSecurity;
TlsSettings xtlsSettings = new() RealitySettings realitySettings = new()
{ {
allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure), fingerprint = node.fingerprint.IsNullOrEmpty() ? config.coreBasicItem.defFingerprint : node.fingerprint,
alpn = node.GetAlpn(), serverName = sni,
fingerprint = node.fingerprint.IsNullOrEmpty() ? config.coreBasicItem.defFingerprint : node.fingerprint publicKey = node.publicKey,
shortId = node.shortId,
spiderX = node.spiderX,
}; };
if (!string.IsNullOrWhiteSpace(sni))
{ streamSettings.realitySettings = realitySettings;
xtlsSettings.serverName = sni;
}
else if (!string.IsNullOrWhiteSpace(host))
{
xtlsSettings.serverName = Utils.String2List(host)[0];
}
streamSettings.xtlsSettings = xtlsSettings;
} }
//streamSettings //streamSettings

View file

@ -85,158 +85,100 @@ namespace v2rayN.Mode
#endregion #endregion
[PrimaryKey] [PrimaryKey]
public string indexId public string indexId { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// config type(1=normal,2=custom) /// config type(1=normal,2=custom)
/// </summary> /// </summary>
public EConfigType configType public EConfigType configType { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 版本(现在=2) /// 版本(现在=2)
/// </summary> /// </summary>
public int configVersion public int configVersion { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 远程服务器地址 /// 远程服务器地址
/// </summary> /// </summary>
public string address public string address { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 远程服务器端口 /// 远程服务器端口
/// </summary> /// </summary>
public int port public int port { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 远程服务器ID /// 远程服务器ID
/// </summary> /// </summary>
public string id public string id { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 远程服务器额外ID /// 远程服务器额外ID
/// </summary> /// </summary>
public int alterId public int alterId { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 本地安全策略 /// 本地安全策略
/// </summary> /// </summary>
public string security public string security { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// tcp,kcp,ws,h2,quic /// tcp,kcp,ws,h2,quic
/// </summary> /// </summary>
public string network public string network { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 备注或别名 /// 备注或别名
/// </summary> /// </summary>
public string remarks public string remarks { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 伪装类型 /// 伪装类型
/// </summary> /// </summary>
public string headerType public string headerType { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 伪装的域名 /// 伪装的域名
/// </summary> /// </summary>
public string requestHost public string requestHost { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// ws h2 path /// ws h2 path
/// </summary> /// </summary>
public string path public string path { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 传输层安全 /// 传输层安全
/// </summary> /// </summary>
public string streamSecurity public string streamSecurity { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// 是否允许不安全连接(用于客户端) /// 是否允许不安全连接(用于客户端)
/// </summary> /// </summary>
public string allowInsecure public string allowInsecure { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// SubItem id /// SubItem id
/// </summary> /// </summary>
public string subid public string subid { get; set; }
{
get; set;
}
public bool isSub { get; set; } = true; public bool isSub { get; set; } = true;
/// <summary> /// <summary>
/// VLESS flow /// VLESS flow
/// </summary> /// </summary>
public string flow public string flow { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// tls sni /// tls sni
/// </summary> /// </summary>
public string sni public string sni { get; set; }
{
get; set;
}
/// <summary> /// <summary>
/// tls alpn /// tls alpn
/// </summary> /// </summary>
public string alpn { get; set; } = string.Empty; public string alpn { get; set; } = string.Empty;
public ECoreType? coreType public ECoreType? coreType { get; set; }
{
get; set;
}
public int preSocksPort public int preSocksPort { get; set; }
{
get; set;
}
public string fingerprint { get; set; } public string fingerprint { get; set; }
public bool displayLog { get; set; } = true; public bool displayLog { get; set; } = true;
public string publicKey { get; set; }
public string shortId { get; set; }
public string spiderX { get; set; }
} }
} }

View file

@ -389,9 +389,9 @@ namespace v2rayN.Mode
public QuicSettings quicSettings { get; set; } public QuicSettings quicSettings { get; set; }
/// <summary> /// <summary>
/// VLESS xtls /// VLESS only
/// </summary> /// </summary>
public TlsSettings xtlsSettings { get; set; } public RealitySettings realitySettings { get; set; }
/// <summary> /// <summary>
/// grpc /// grpc
/// </summary> /// </summary>
@ -424,6 +424,15 @@ namespace v2rayN.Mode
public string fingerprint { get; set; } public string fingerprint { get; set; }
} }
public class RealitySettings
{
public bool show { get; set; } = false;
public string fingerprint { get; set; }
public string serverName { get; set; }
public string publicKey { get; set; }
public string shortId { get; set; }
public string spiderX { get; set; }
}
public class TcpSettings public class TcpSettings
{ {

View file

@ -2167,6 +2167,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 PublicKey 的本地化字符串。
/// </summary>
public static string TbPublicKey {
get {
return ResourceManager.GetString("TbPublicKey", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Alias (remarks) 的本地化字符串。 /// 查找类似 Alias (remarks) 的本地化字符串。
/// </summary> /// </summary>
@ -2896,6 +2905,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 ShortId 的本地化字符串。
/// </summary>
public static string TbShortId {
get {
return ResourceManager.GetString("TbShortId", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 SNI 的本地化字符串。 /// 查找类似 SNI 的本地化字符串。
/// </summary> /// </summary>
@ -2905,6 +2923,15 @@ namespace v2rayN.Resx {
} }
} }
/// <summary>
/// 查找类似 SpiderX 的本地化字符串。
/// </summary>
public static string TbSpiderX {
get {
return ResourceManager.GetString("TbSpiderX", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 TLS 的本地化字符串。 /// 查找类似 TLS 的本地化字符串。
/// </summary> /// </summary>

View file

@ -1132,4 +1132,13 @@
<data name="menuMoveTo" xml:space="preserve"> <data name="menuMoveTo" xml:space="preserve">
<value>Move up and down</value> <value>Move up and down</value>
</data> </data>
<data name="TbPublicKey" xml:space="preserve">
<value>PublicKey</value>
</data>
<data name="TbShortId" xml:space="preserve">
<value>ShortId</value>
</data>
<data name="TbSpiderX" xml:space="preserve">
<value>SpiderX</value>
</data>
</root> </root>

View file

@ -710,7 +710,7 @@
<value>SNI</value> <value>SNI</value>
</data> </data>
<data name="TbStreamSecurity" xml:space="preserve"> <data name="TbStreamSecurity" xml:space="preserve">
<value>TLS</value> <value>传输层安全(TLS)</value>
</data> </data>
<data name="TipNetwork" xml:space="preserve"> <data name="TipNetwork" xml:space="preserve">
<value>*默认tcp,选错会无法连接</value> <value>*默认tcp,选错会无法连接</value>
@ -1132,4 +1132,13 @@
<data name="menuMoveTo" xml:space="preserve"> <data name="menuMoveTo" xml:space="preserve">
<value>移至上下</value> <value>移至上下</value>
</data> </data>
<data name="TbPublicKey" xml:space="preserve">
<value>PublicKey</value>
</data>
<data name="TbShortId" xml:space="preserve">
<value>ShortId</value>
</data>
<data name="TbSpiderX" xml:space="preserve">
<value>SpiderX</value>
</data>
</root> </root>

View file

@ -118,6 +118,10 @@ namespace v2rayN.ViewModels
item.allowInsecure = SelectedSource.allowInsecure; item.allowInsecure = SelectedSource.allowInsecure;
item.fingerprint = SelectedSource.fingerprint; item.fingerprint = SelectedSource.fingerprint;
item.alpn = SelectedSource.alpn; item.alpn = SelectedSource.alpn;
item.publicKey = SelectedSource.publicKey;
item.shortId = SelectedSource.shortId;
item.spiderX = SelectedSource.spiderX;
} }
int ret = -1; int ret = -1;

View file

@ -11,7 +11,7 @@
xmlns:vms="clr-namespace:v2rayN.ViewModels" xmlns:vms="clr-namespace:v2rayN.ViewModels"
Title="{x:Static resx:ResUI.menuServers}" Title="{x:Static resx:ResUI.menuServers}"
Width="800" Width="800"
Height="800" Height="830"
x:TypeArguments="vms:AddServerViewModel" x:TypeArguments="vms:AddServerViewModel"
Background="{DynamicResource MaterialDesignPaper}" Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}" FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
@ -559,8 +559,10 @@
Margin="{StaticResource ServerItemMargin}" Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
</Grid> </Grid>
<Grid
<Grid x:Name="gridTlsMore" Grid.Row="7"> x:Name="gridTlsMore"
Grid.Row="7"
Visibility="Hidden">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -595,25 +597,10 @@
Margin="{StaticResource ServerItemMargin}" Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAllowInsecure}" />
<ComboBox
x:Name="cmbAllowInsecure"
Grid.Row="2"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFingerprint}" /> Text="{x:Static resx:ResUI.TbFingerprint}" />
<ComboBox <ComboBox
x:Name="cmbFingerprint" x:Name="cmbFingerprint"
Grid.Row="3" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource ServerItemMargin}" Margin="{StaticResource ServerItemMargin}"
@ -621,7 +608,7 @@
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource ServerItemMargin}" Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center" VerticalAlignment="Center"
@ -629,13 +616,125 @@
Text="{x:Static resx:ResUI.TbAlpn}" /> Text="{x:Static resx:ResUI.TbAlpn}" />
<ComboBox <ComboBox
x:Name="cmbAlpn" x:Name="cmbAlpn"
Grid.Row="4" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource ServerItemMargin}" Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
</Grid>
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAllowInsecure}" />
<ComboBox
x:Name="cmbAllowInsecure"
Grid.Row="4"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
x:Name="gridRealityMore"
Grid.Row="7"
Visibility="Hidden">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSNI}" />
<TextBox
x:Name="txtSNI2"
Grid.Row="0"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFingerprint}" />
<ComboBox
x:Name="cmbFingerprint2"
Grid.Row="1"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPublicKey}" />
<TextBox
x:Name="txtPublicKey"
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbShortId}" />
<TextBox
x:Name="txtShortId"
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSpiderX}" />
<TextBox
x:Name="txtSpiderX"
Grid.Row="4"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>
<Separator <Separator
Grid.Row="8" Grid.Row="8"
Margin="0,2" Margin="0,2"

View file

@ -39,6 +39,7 @@ namespace v2rayN.Views
Global.fingerprints.ForEach(it => Global.fingerprints.ForEach(it =>
{ {
cmbFingerprint.Items.Add(it); cmbFingerprint.Items.Add(it);
cmbFingerprint2.Items.Add(it);
}); });
Global.allowInsecures.ForEach(it => Global.allowInsecures.ForEach(it =>
{ {
@ -74,8 +75,8 @@ namespace v2rayN.Views
break; break;
case EConfigType.VLESS: case EConfigType.VLESS:
gridVLESS.Visibility = Visibility.Visible; gridVLESS.Visibility = Visibility.Visible;
cmbStreamSecurity.Items.Add(Global.StreamSecurityX); cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
Global.xtlsFlows.ForEach(it => Global.flows.ForEach(it =>
{ {
cmbFlow5.Items.Add(it); cmbFlow5.Items.Add(it);
}); });
@ -86,8 +87,7 @@ namespace v2rayN.Views
break; break;
case EConfigType.Trojan: case EConfigType.Trojan:
gridTrojan.Visibility = Visibility.Visible; gridTrojan.Visibility = Visibility.Visible;
cmbStreamSecurity.Items.Add(Global.StreamSecurityX); Global.flows.ForEach(it =>
Global.xtlsFlows.ForEach(it =>
{ {
cmbFlow6.Items.Add(it); cmbFlow6.Items.Add(it);
}); });
@ -138,6 +138,13 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.SelectedSource.allowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.allowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.alpn, v => v.cmbAlpn.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.alpn, v => v.cmbAlpn.Text).DisposeWith(disposables);
//reality
this.Bind(ViewModel, vm => vm.SelectedSource.sni, v => v.txtSNI2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.fingerprint, v => v.cmbFingerprint2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.publicKey, v => v.txtPublicKey.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.shortId, v => v.txtShortId.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.spiderX, v => v.txtSpiderX.Text).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
@ -159,13 +166,20 @@ namespace v2rayN.Views
private void CmbStreamSecurity_SelectionChanged(object sender, SelectionChangedEventArgs e) private void CmbStreamSecurity_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
var security = cmbStreamSecurity.SelectedItem.ToString(); var security = cmbStreamSecurity.SelectedItem.ToString();
if (Utils.IsNullOrEmpty(security)) if (security == Global.StreamSecurityReality)
{ {
gridRealityMore.Visibility = Visibility.Visible;
gridTlsMore.Visibility = Visibility.Hidden; gridTlsMore.Visibility = Visibility.Hidden;
} }
else if (security == Global.StreamSecurity)
{
gridRealityMore.Visibility = Visibility.Hidden;
gridTlsMore.Visibility = Visibility.Visible;
}
else else
{ {
gridTlsMore.Visibility = Visibility.Visible; gridRealityMore.Visibility = Visibility.Hidden;
gridTlsMore.Visibility = Visibility.Hidden;
} }
} }
private void btnGUID_Click(object sender, RoutedEventArgs e) private void btnGUID_Click(object sender, RoutedEventArgs e)