mirror of https://github.com/2dust/v2rayN
Added Wireguard support (using sing-box)
parent
005f26ba7c
commit
69cbdbd20e
|
@ -138,7 +138,8 @@ namespace v2rayN
|
||||||
{EConfigType.VLESS,"vless://"},
|
{EConfigType.VLESS,"vless://"},
|
||||||
{EConfigType.Trojan,"trojan://"},
|
{EConfigType.Trojan,"trojan://"},
|
||||||
{EConfigType.Hysteria2,"hysteria2://"},
|
{EConfigType.Hysteria2,"hysteria2://"},
|
||||||
{EConfigType.Tuic,"tuic://"}
|
{EConfigType.Tuic,"tuic://"},
|
||||||
|
{EConfigType.Wireguard,"wireguard://"}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly Dictionary<EConfigType, string> ProtocolTypes = new()
|
public static readonly Dictionary<EConfigType, string> ProtocolTypes = new()
|
||||||
|
@ -149,7 +150,8 @@ namespace v2rayN
|
||||||
{EConfigType.VLESS,"vless"},
|
{EConfigType.VLESS,"vless"},
|
||||||
{EConfigType.Trojan,"trojan"},
|
{EConfigType.Trojan,"trojan"},
|
||||||
{EConfigType.Hysteria2,"hysteria2"},
|
{EConfigType.Hysteria2,"hysteria2"},
|
||||||
{EConfigType.Tuic,"tuic"}
|
{EConfigType.Tuic,"tuic"},
|
||||||
|
{EConfigType.Wireguard,"wireguard"}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly List<string> VmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
public static readonly List<string> VmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
||||||
|
|
|
@ -768,6 +768,34 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add or edit server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="profileItem"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int AddWireguardServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||||
|
{
|
||||||
|
profileItem.configType = EConfigType.Wireguard;
|
||||||
|
profileItem.coreType = ECoreType.sing_box;
|
||||||
|
|
||||||
|
profileItem.address = profileItem.address.TrimEx();
|
||||||
|
profileItem.id = profileItem.id.TrimEx();
|
||||||
|
profileItem.publicKey = profileItem.publicKey.TrimEx();
|
||||||
|
profileItem.path = profileItem.path.TrimEx();
|
||||||
|
profileItem.requestHost = profileItem.requestHost.TrimEx();
|
||||||
|
profileItem.network = string.Empty;
|
||||||
|
|
||||||
|
if (profileItem.id.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddServerCommon(config, profileItem, toFile);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static int SortServers(Config config, string subId, string colName, bool asc)
|
public static int SortServers(Config config, string subId, string colName, bool asc)
|
||||||
{
|
{
|
||||||
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
|
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
|
||||||
|
@ -1125,6 +1153,10 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
addStatus = AddTuicServer(config, profileItem, false);
|
addStatus = AddTuicServer(config, profileItem, false);
|
||||||
}
|
}
|
||||||
|
else if (profileItem.configType == EConfigType.Wireguard)
|
||||||
|
{
|
||||||
|
addStatus = AddWireguardServer(config, profileItem, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (addStatus == 0)
|
if (addStatus == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,6 +181,8 @@ namespace v2rayN.Handler
|
||||||
tunInbound.mtu = _config.tunModeItem.mtu;
|
tunInbound.mtu = _config.tunModeItem.mtu;
|
||||||
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
||||||
tunInbound.stack = _config.tunModeItem.stack;
|
tunInbound.stack = _config.tunModeItem.stack;
|
||||||
|
tunInbound.sniff = _config.inbound[0].sniffingEnabled;
|
||||||
|
tunInbound.sniff_override_destination = _config.inbound[0].routeOnly ? false : _config.inbound[0].sniffingEnabled;
|
||||||
if (_config.tunModeItem.enableIPv6Address == false)
|
if (_config.tunModeItem.enableIPv6Address == false)
|
||||||
{
|
{
|
||||||
tunInbound.inet6_address = null;
|
tunInbound.inet6_address = null;
|
||||||
|
@ -296,6 +298,17 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
GenOutboundMux(node, outbound);
|
||||||
}
|
}
|
||||||
|
else if (node.configType == EConfigType.Wireguard)
|
||||||
|
{
|
||||||
|
outbound.type = Global.ProtocolTypes[EConfigType.Wireguard];
|
||||||
|
|
||||||
|
outbound.private_key = node.id;
|
||||||
|
outbound.peer_public_key = node.publicKey;
|
||||||
|
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
|
||||||
|
outbound.local_address = [.. Utils.String2List(node.requestHost)];
|
||||||
|
|
||||||
|
GenOutboundMux(node, outbound);
|
||||||
|
}
|
||||||
|
|
||||||
GenOutboundTls(node, outbound);
|
GenOutboundTls(node, outbound);
|
||||||
|
|
||||||
|
|
|
@ -846,7 +846,8 @@ namespace v2rayN.Handler
|
||||||
if (prevNode is not null
|
if (prevNode is not null
|
||||||
&& prevNode.configType != EConfigType.Custom
|
&& prevNode.configType != EConfigType.Custom
|
||||||
&& prevNode.configType != EConfigType.Hysteria2
|
&& prevNode.configType != EConfigType.Hysteria2
|
||||||
&& prevNode.configType != EConfigType.Tuic)
|
&& prevNode.configType != EConfigType.Tuic
|
||||||
|
&& prevNode.configType != EConfigType.Wireguard)
|
||||||
{
|
{
|
||||||
var prevOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
|
var prevOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
|
||||||
GenOutbound(prevNode, prevOutbound);
|
GenOutbound(prevNode, prevOutbound);
|
||||||
|
@ -864,7 +865,8 @@ namespace v2rayN.Handler
|
||||||
if (nextNode is not null
|
if (nextNode is not null
|
||||||
&& nextNode.configType != EConfigType.Custom
|
&& nextNode.configType != EConfigType.Custom
|
||||||
&& nextNode.configType != EConfigType.Hysteria2
|
&& nextNode.configType != EConfigType.Hysteria2
|
||||||
&& nextNode.configType != EConfigType.Tuic)
|
&& nextNode.configType != EConfigType.Tuic
|
||||||
|
&& nextNode.configType != EConfigType.Wireguard)
|
||||||
{
|
{
|
||||||
var nextOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
|
var nextOutbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
|
||||||
GenOutbound(nextNode, nextOutbound);
|
GenOutbound(nextNode, nextOutbound);
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace v2rayN.Handler
|
||||||
public int LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
|
public int LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
|
||||||
{
|
{
|
||||||
int pid = -1;
|
int pid = -1;
|
||||||
var coreType = selecteds.Exists(t => t.configType == EConfigType.Hysteria2 || t.configType == EConfigType.Tuic) ? ECoreType.sing_box : ECoreType.Xray;
|
var coreType = selecteds.Exists(t => t.configType == EConfigType.Hysteria2 || t.configType == EConfigType.Tuic || t.configType == EConfigType.Wireguard) ? ECoreType.sing_box : ECoreType.Xray;
|
||||||
string configPath = Utils.GetConfigPath(Global.CoreSpeedtestConfigFileName);
|
string configPath = Utils.GetConfigPath(Global.CoreSpeedtestConfigFileName);
|
||||||
if (CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType, out string msg) != 0)
|
if (CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType, out string msg) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Microsoft.Win32;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using static v2rayN.Handler.ProxySetting.InternetConnectionOption;
|
using static v2rayN.Handler.ProxySetting.InternetConnectionOption;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
VLESS = 5,
|
VLESS = 5,
|
||||||
Trojan = 6,
|
Trojan = 6,
|
||||||
Hysteria2 = 7,
|
Hysteria2 = 7,
|
||||||
Tuic = 8
|
Tuic = 8,
|
||||||
|
Wireguard = 9
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -47,18 +47,12 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
switch (configType)
|
switch (configType)
|
||||||
{
|
{
|
||||||
case EConfigType.VMess:
|
case EConfigType.Custom:
|
||||||
case EConfigType.Shadowsocks:
|
summary += string.Format("{0}", remarks);
|
||||||
case EConfigType.Socks:
|
|
||||||
case EConfigType.VLESS:
|
|
||||||
case EConfigType.Trojan:
|
|
||||||
case EConfigType.Hysteria2:
|
|
||||||
case EConfigType.Tuic:
|
|
||||||
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
summary += string.Format("{0}", remarks);
|
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return summary;
|
return summary;
|
||||||
|
|
|
@ -112,7 +112,12 @@
|
||||||
public string congestion_control { get; set; }
|
public string congestion_control { get; set; }
|
||||||
public string? version { get; set; }
|
public string? version { get; set; }
|
||||||
public string? network { get; set; }
|
public string? network { get; set; }
|
||||||
public string packet_encoding { get; set; }
|
public string? packet_encoding { get; set; }
|
||||||
|
public string[]? local_address { get; set; }
|
||||||
|
public string? private_key { get; set; }
|
||||||
|
public string? peer_public_key { get; set; }
|
||||||
|
public int[]? reserved { get; set; }
|
||||||
|
public int? mtu { get; set; }
|
||||||
public Tls4Sbox tls { get; set; }
|
public Tls4Sbox tls { get; set; }
|
||||||
public Multiplex4Sbox multiplex { get; set; }
|
public Multiplex4Sbox multiplex { get; set; }
|
||||||
public Transport4Sbox transport { get; set; }
|
public Transport4Sbox transport { get; set; }
|
||||||
|
|
|
@ -699,6 +699,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Add [Wireguard] server 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuAddWireguardServer {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuAddWireguardServer", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Check Update 的本地化字符串。
|
/// 查找类似 Check Update 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2140,6 +2149,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Address(Ip,Ipv6) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbLocalAddress {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbLocalAddress", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Transport protocol(network) 的本地化字符串。
|
/// 查找类似 Transport protocol(network) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2185,6 +2203,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 PrivateKey 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbPrivateKey {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbPrivateKey", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 PublicKey 的本地化字符串。
|
/// 查找类似 PublicKey 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2212,6 +2239,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Reserved(2,3,4) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbReserved {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbReserved", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Reset 的本地化字符串。
|
/// 查找类似 Reset 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1168,4 +1168,16 @@
|
||||||
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
||||||
<value>Enable IPv6 Address</value>
|
<value>Enable IPv6 Address</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuAddWireguardServer" xml:space="preserve">
|
||||||
|
<value>Add [Wireguard] server</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbPrivateKey" xml:space="preserve">
|
||||||
|
<value>PrivateKey</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbReserved" xml:space="preserve">
|
||||||
|
<value>Reserved(2,3,4)</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbLocalAddress" xml:space="preserve">
|
||||||
|
<value>Address(Ip,Ipv6)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1165,4 +1165,16 @@
|
||||||
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
||||||
<value>启用IPv6</value>
|
<value>启用IPv6</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuAddWireguardServer" xml:space="preserve">
|
||||||
|
<value>添加[Wireguard]服务器</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbPrivateKey" xml:space="preserve">
|
||||||
|
<value>PrivateKey</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbReserved" xml:space="preserve">
|
||||||
|
<value>Reserved(2,3,4)</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbLocalAddress" xml:space="preserve">
|
||||||
|
<value>Address(Ip,Ipv6)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -152,6 +152,10 @@ namespace v2rayN.ViewModels
|
||||||
case EConfigType.Tuic:
|
case EConfigType.Tuic:
|
||||||
ret = ConfigHandler.AddTuicServer(_config, item);
|
ret = ConfigHandler.AddTuicServer(_config, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EConfigType.Wireguard:
|
||||||
|
ret = ConfigHandler.AddWireguardServer(_config, item);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
|
|
|
@ -88,6 +88,7 @@ namespace v2rayN.ViewModels
|
||||||
public ReactiveCommand<Unit, Unit> AddTrojanServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddTrojanServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddHysteria2ServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddHysteria2ServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> AddWireguardServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
||||||
|
@ -347,6 +348,10 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
EditServer(true, EConfigType.Tuic);
|
EditServer(true, EConfigType.Tuic);
|
||||||
});
|
});
|
||||||
|
AddWireguardServerCmd = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
EditServer(true, EConfigType.Wireguard);
|
||||||
|
});
|
||||||
AddCustomServerCmd = ReactiveCommand.Create(() =>
|
AddCustomServerCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
EditServer(true, EConfigType.Custom);
|
EditServer(true, EConfigType.Custom);
|
||||||
|
@ -1390,7 +1395,8 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
Process.Start(startInfo);
|
Process.Start(startInfo);
|
||||||
MyAppExit(false);
|
MyAppExit(false);
|
||||||
} catch { }
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ImportOldGuiConfig()
|
private void ImportOldGuiConfig()
|
||||||
|
|
|
@ -372,8 +372,7 @@ namespace v2rayN.ViewModels
|
||||||
type = CoreType6;
|
type = CoreType6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
default:
|
||||||
case 8:
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
|
item.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
|
||||||
|
|
|
@ -510,6 +510,83 @@
|
||||||
Margin="{StaticResource ServerItemMargin}"
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid
|
||||||
|
x:Name="gridWireguard"
|
||||||
|
Grid.Row="2"
|
||||||
|
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="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbPrivateKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtId9"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbPublicKey}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtPublicKey9"
|
||||||
|
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.TbReserved}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtPath9"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="4"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbLocalAddress}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtRequestHost9"
|
||||||
|
Grid.Row="4"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="400"
|
||||||
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Separator
|
<Separator
|
||||||
x:Name="sepa2"
|
x:Name="sepa2"
|
||||||
|
@ -639,7 +716,7 @@
|
||||||
Margin="0,2"
|
Margin="0,2"
|
||||||
Style="{DynamicResource MaterialDesignSeparator}" />
|
Style="{DynamicResource MaterialDesignSeparator}" />
|
||||||
|
|
||||||
<Grid Grid.Row="6">
|
<Grid x:Name="gridTls" Grid.Row="6">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|
|
@ -139,6 +139,16 @@ namespace v2rayN.Views
|
||||||
cmbHeaderType8.Items.Add(it);
|
cmbHeaderType8.Items.Add(it);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EConfigType.Wireguard:
|
||||||
|
gridWireguard.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
sepa2.Visibility = Visibility.Collapsed;
|
||||||
|
gridTransport.Visibility = Visibility.Collapsed;
|
||||||
|
gridTls.Visibility = Visibility.Collapsed;
|
||||||
|
cmbCoreType.IsEnabled = false;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gridTlsMore.Visibility = Visibility.Hidden;
|
gridTlsMore.Visibility = Visibility.Hidden;
|
||||||
|
@ -188,6 +198,13 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EConfigType.Wireguard:
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId9.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedSource.publicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath9.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedSource.requestHost, v => v.txtRequestHost9.Text).DisposeWith(disposables);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.network, v => v.cmbNetwork.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.network, v => v.cmbNetwork.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType.Text).DisposeWith(disposables);
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
x:Name="menuAddTrojanServer"
|
x:Name="menuAddTrojanServer"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
|
Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
|
||||||
|
<Separator Margin="-40,5" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuAddHysteria2Server"
|
x:Name="menuAddHysteria2Server"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
@ -91,6 +92,10 @@
|
||||||
x:Name="menuAddTuicServer"
|
x:Name="menuAddTuicServer"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuAddTuicServer}" />
|
Header="{x:Static resx:ResUI.menuAddTuicServer}" />
|
||||||
|
<MenuItem
|
||||||
|
x:Name="menuAddWireguardServer"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="{x:Static resx:ResUI.menuAddWireguardServer}" />
|
||||||
<Separator Margin="-40,5" />
|
<Separator Margin="-40,5" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuAddServerViaClipboard"
|
x:Name="menuAddServerViaClipboard"
|
||||||
|
|
|
@ -88,6 +88,7 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.AddTrojanServerCmd, v => v.menuAddTrojanServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddTrojanServerCmd, v => v.menuAddTrojanServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddHysteria2ServerCmd, v => v.menuAddHysteria2Server).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddHysteria2ServerCmd, v => v.menuAddHysteria2Server).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
|
||||||
|
this.BindCommand(ViewModel, vm => vm.AddWireguardServerCmd, v => v.menuAddWireguardServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddCustomServerCmd, v => v.menuAddCustomServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddCustomServerCmd, v => v.menuAddCustomServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan).DisposeWith(disposables);
|
||||||
|
|
|
@ -203,6 +203,5 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue