1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

refactoring

This commit is contained in:
next-autumn 2021-03-26 18:13:32 +08:00
parent 0c146f176d
commit 754aff18a4
20 changed files with 424 additions and 330 deletions

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace ProxySU_Core.Converters
{
public class VisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.Equals(true) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return false;
}
if (value.Equals(Visibility.Visible))
{
return true;
}
return false;
}
}
}

View File

@ -104,7 +104,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(baseBound);
baseBound.settings.clients[0].id = parameters.UUID;
if (parameters.Types.Contains(XrayType.VLESS_WS_TLS))
if (parameters.Types.Contains(XrayType.VLESS_WS))
{
var wsInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_WS_TLS.json"));
wsInbound.port = VLESS_WS_Port;
@ -136,7 +136,7 @@ namespace ProxySU_Core.Models.Developers
if (parameters.Types.Contains(XrayType.VMESS_TCP_TLS))
if (parameters.Types.Contains(XrayType.VMESS_TCP))
{
var mtcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_TCP_TLS.json"));
mtcpBound.port = VMESS_TCP_Port;
@ -151,7 +151,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
}
if (parameters.Types.Contains(XrayType.VMESS_WS_TLS))
if (parameters.Types.Contains(XrayType.VMESS_WS))
{
var mwsBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_WS_TLS.json"));
mwsBound.port = VMESS_WS_Port;
@ -166,7 +166,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
}
if (parameters.Types.Contains(XrayType.Trojan_TCP_TLS))
if (parameters.Types.Contains(XrayType.Trojan_TCP))
{
var trojanTcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "Trojan_TCP_TLS.json"));
trojanTcpBound.port = Trojan_TCP_Port;
@ -179,7 +179,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
}
if (parameters.Types.Contains(XrayType.Trojan_WS_TLS)) { }
if (parameters.Types.Contains(XrayType.Trojan_WS)) { }
return JsonConvert.SerializeObject(
xrayConfig,

View File

@ -15,13 +15,13 @@ namespace ProxySU_Core.Models
{
switch (xrayType)
{
case XrayType.VLESS_TCP_TLS:
case XrayType.VLESS_TCP:
case XrayType.VLESS_TCP_XTLS:
case XrayType.VLESS_WS_TLS:
case XrayType.Trojan_TCP_TLS:
case XrayType.VLESS_WS:
case XrayType.Trojan_TCP:
return BuildVlessShareLink(xrayType, settings);
case XrayType.VMESS_TCP_TLS:
case XrayType.VMESS_WS_TLS:
case XrayType.VMESS_TCP:
case XrayType.VMESS_WS:
return BuildVmessShareLink(xrayType, settings);
default:
return string.Empty;
@ -49,13 +49,13 @@ namespace ProxySU_Core.Models
switch (xrayType)
{
case XrayType.VMESS_TCP_TLS:
case XrayType.VMESS_TCP:
vmess.ps = "vmess-tcp-tls";
vmess.net = "tcp";
vmess.type = "http";
vmess.path = settings.VMESS_TCP_Path;
break;
case XrayType.VMESS_WS_TLS:
case XrayType.VMESS_WS:
vmess.ps = "vmess-ws-tls";
vmess.net = "ws";
vmess.type = "none";
@ -84,10 +84,9 @@ namespace ProxySU_Core.Models
switch (xrayType)
{
case XrayType.VLESS_TCP_TLS:
case XrayType.VLESS_TCP:
_protocol = "vless";
_type = "tcp";
_path = settings.VLESS_TCP_Path;
_encryption = "none";
_descriptiveText = "vless-tcp-tls";
break;
@ -98,28 +97,28 @@ namespace ProxySU_Core.Models
_encryption = "none";
_descriptiveText = "vless-tcp-xtls";
break;
case XrayType.VLESS_WS_TLS:
case XrayType.VLESS_WS:
_protocol = "vless";
_type = "ws";
_path = settings.VLESS_WS_Path;
_encryption = "none";
_descriptiveText = "vless-ws-tls";
break;
case XrayType.VMESS_TCP_TLS:
case XrayType.VMESS_TCP:
_protocol = "vmess";
_type = "tcp";
_path = settings.VMESS_TCP_Path;
_encryption = "auto";
_descriptiveText = "vmess-tcp-tls";
break;
case XrayType.VMESS_WS_TLS:
case XrayType.VMESS_WS:
_protocol = "vmess";
_type = "ws";
_path = settings.VMESS_WS_Path;
_encryption = "auto";
_descriptiveText = "vmess-ws-tls";
break;
case XrayType.Trojan_TCP_TLS:
case XrayType.Trojan_TCP:
_protocol = "trojan";
_descriptiveText = "trojan-tcp";
break;
@ -129,7 +128,7 @@ namespace ProxySU_Core.Models
string parametersURL = string.Empty;
if (xrayType != XrayType.Trojan_TCP_TLS)
if (xrayType != XrayType.Trojan_TCP)
{
// 4.3 传输层相关段
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&host={_host}&path={HttpUtility.UrlEncode(_path)}";

View File

@ -19,14 +19,21 @@ namespace ProxySU_Core.Models
Port = 443;
UUID = guid;
Types = new List<XrayType>();
VLESS_WS_Path = "/vlessws";
VLESS_TCP_Path = "/vlesstcp";
VLESS_H2_Path = "/vlessh2";
VMESS_WS_Path = "/vmessws";
VMESS_TCP_Path = "/vmesstcp";
VMESS_H2_Path = "/vmessh2";
VMESS_KCP_Seed = guid;
VMESS_KCP_Type = "none";
TrojanPassword = guid;
Trojan_WS_Path = "/trojanws";
ShadowsocksPassword = guid;
ShadowsocksMethod = "aes-128-gcm";
}
/// <summary>
@ -39,26 +46,19 @@ namespace ProxySU_Core.Models
/// </summary>
public string UUID { get; set; }
#region vless
/// <summary>
/// vless ws路径
/// </summary>
public string VLESS_WS_Path { get; set; }
/// <summary>
/// vless tcp路径
/// </summary>
public string VLESS_TCP_Path { get; set; }
/// <summary>
/// vless http2 path
/// </summary>
public string VLESS_H2_Path { get; set; }
#endregion
/// <summary>
/// vless mKcp seed
/// </summary>
public string VLESS_mKCP_Seed { get; set; }
#region vmess
/// <summary>
/// vmess ws路径
/// </summary>
@ -75,10 +75,17 @@ namespace ProxySU_Core.Models
public string VMESS_H2_Path { get; set; }
/// <summary>
/// vmess mKcp seed
/// vmess kcp seed
/// </summary>
public string VMESS_mKCP_Seed { get; set; }
public string VMESS_KCP_Seed { get; set; }
/// <summary>
/// vmess kcp type
/// </summary>
public string VMESS_KCP_Type { get; set; }
#endregion
#region Trojan
/// <summary>
/// trojan密码
/// </summary>
@ -88,6 +95,20 @@ namespace ProxySU_Core.Models
/// trojan ws path
/// </summary>
public string Trojan_WS_Path { get; set; }
#endregion
#region ShadowsocksAEAD
/// <summary>
/// ss password
/// </summary>
public string ShadowsocksPassword { get; set; }
/// <summary>
/// ss method
/// </summary>
public string ShadowsocksMethod { get; set; }
#endregion
/// <summary>
/// 域名
@ -109,26 +130,24 @@ namespace ProxySU_Core.Models
{
switch (type)
{
case XrayType.VLESS_TCP_TLS:
return VLESS_TCP_Path;
case XrayType.VLESS_TCP_XTLS:
return VLESS_TCP_Path;
case XrayType.VLESS_WS_TLS:
case XrayType.VLESS_WS:
return VLESS_WS_Path;
case XrayType.VLESS_H2_TLS:
case XrayType.VLESS_H2:
return VLESS_H2_Path;
case XrayType.VMESS_TCP_TLS:
case XrayType.VMESS_TCP:
return VMESS_TCP_Path;
case XrayType.VMESS_WS_TLS:
case XrayType.VMESS_WS:
return VMESS_WS_Path;
case XrayType.Trojan_WS_TLS:
case XrayType.Trojan_WS:
return Trojan_WS_Path;
// no path
case XrayType.VLESS_mKCP_Speed:
case XrayType.Trojan_TCP_TLS:
case XrayType.VMESS_mKCP_Speed:
case XrayType.VLESS_TCP_XTLS:
case XrayType.VLESS_TCP:
case XrayType.VLESS_KCP:
case XrayType.VMESS_KCP:
case XrayType.Trojan_TCP:
return string.Empty;
default:
return string.Empty;
@ -144,19 +163,22 @@ namespace ProxySU_Core.Models
VLESS_TCP_XTLS = 100,
// vless 101开头
VLESS_TCP_TLS = 101,
VLESS_WS_TLS = 102,
VLESS_H2_TLS = 103,
VLESS_mKCP_Speed = 104,
VLESS_TCP = 101,
VLESS_WS = 102,
VLESS_H2 = 103,
VLESS_KCP = 104,
// vmess 201开头
VMESS_TCP_TLS = 201,
VMESS_WS_TLS = 202,
VMESS_H2_TLS = 203,
VMESS_mKCP_Speed = 204,
VMESS_TCP = 201,
VMESS_WS = 202,
VMESS_H2 = 203,
VMESS_KCP = 204,
// trojan 301开头
Trojan_TCP_TLS = 301,
Trojan_WS_TLS = 302,
Trojan_TCP = 301,
Trojan_WS = 302,
// ss
ShadowsocksAEAD = 401
}
}

View File

@ -122,6 +122,7 @@
</Compile>
<Compile Include="Common\Base64.cs" />
<Compile Include="Converters\LoginSecretTypeConverter.cs" />
<Compile Include="Converters\VisibleConverter.cs" />
<Compile Include="Models\Host.cs" />
<Compile Include="Models\ShareLink.cs" />
<Compile Include="Models\XraySettings.cs" />
@ -138,6 +139,7 @@
<Compile Include="Models\LocalProxyType.cs" />
<Compile Include="Models\LoginSecretType.cs" />
<Compile Include="Models\Record.cs" />
<Compile Include="ViewModels\IdValueViewModel.cs" />
<Compile Include="ViewModels\RecordViewModel.cs" />
<Compile Include="ViewModels\Terminal.cs" />
<Compile Include="ViewModels\XraySettingsViewModel.cs" />
@ -241,34 +243,35 @@
<None Include="Templates\xray\server\05_inbounds\05_inbounds.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP_TLS.json">
<None Include="Templates\xray\server\05_inbounds\Shadowsocks-AEAD.json" />
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\Trojan_WS_TLS.json">
<None Include="Templates\xray\server\05_inbounds\Trojan_WS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VLESS_HTTP2_TLS.json">
<None Include="Templates\xray\server\05_inbounds\VLESS_HTTP2.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VLESS_mKCP.json">
<None Include="Templates\xray\server\05_inbounds\VLESS_KCP.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VLESS_WS_TLS.json">
<None Include="Templates\xray\server\05_inbounds\VLESS_WS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VMESS_HTTP2_TLS.json">
<None Include="Templates\xray\server\05_inbounds\VMESS_HTTP2.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VMESS_mKCP.json">
<None Include="Templates\xray\server\05_inbounds\VMESS_KCP.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VMESS_TCP_TLS.json">
<None Include="Templates\xray\server\05_inbounds\VMESS_TCP.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\05_inbounds\VMESS_WS_TLS.json">
<None Include="Templates\xray\server\05_inbounds\VMESS_WS.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\server\06_outbounds\06_outbounds.json">

View File

@ -0,0 +1,13 @@
{
"port": 12345,
"protocol": "shadowsocks",
"settings": {
"clients": [
{
"password": "example_user_1",
"method": "aes-128-gcm"
}
],
"network": "tcp,udp"
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySU_Core.ViewModels
{
public class IdValueViewModel
{
public IdValueViewModel(int id, string value)
{
Id = id;
Value = value;
}
public int Id { get; set; }
public string Value { get; set; }
}
}

View File

@ -3,21 +3,24 @@ using ProxySU_Core.Common;
using ProxySU_Core.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows;
using System.Windows.Controls;
namespace ProxySU_Core.ViewModels
{
public class XraySettingsViewModel : BaseViewModel
public partial class XraySettingsViewModel : BaseViewModel
{
public XraySettings settings;
public XraySettingsViewModel(XraySettings parameters)
{
this.settings = parameters;
Notify("VMESS_KCP_Type");
}
public string UUID
@ -42,299 +45,225 @@ namespace ProxySU_Core.ViewModels
set => settings.MaskDomain = value;
}
public string VLESS_TCP_Path
{
get => settings.VLESS_TCP_Path;
set => settings.VLESS_TCP_Path = value;
}
public string VLESS_WS_Path
{
get => settings.VLESS_WS_Path;
set => settings.VLESS_WS_Path = value;
}
public string VLESS_H2_Path
{
get => settings.VLESS_H2_Path;
set => settings.VLESS_H2_Path = value;
}
public string VMESS_TCP_Path
{
get => settings.VMESS_TCP_Path;
set => settings.VMESS_TCP_Path = value;
}
public string VMESS_WS_Path
{
get => settings.VMESS_WS_Path;
set => settings.VMESS_WS_Path = value;
}
public string VMESS_H2_Path
{
get => settings.VMESS_H2_Path;
set => settings.VMESS_H2_Path = value;
}
public string TrojanPassword
{
get => settings.TrojanPassword;
set => settings.TrojanPassword = value;
}
public bool Checked_VLESS_TCP
{
get
{
return settings.Types.Contains(XrayType.VLESS_TCP_TLS);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VLESS_TCP_TLS))
settings.Types.Add(XrayType.VLESS_TCP_TLS);
}
else
{
settings.Types.Remove(XrayType.VLESS_TCP_TLS);
}
Notify("Checked_VLESS_TCP");
Notify("VLESS_TCP_Path_Visibility");
}
}
public bool Checked_VLESS_XTLS
{
get
{
return settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VLESS_TCP_XTLS))
settings.Types.Add(XrayType.VLESS_TCP_XTLS);
}
else
{
settings.Types.Remove(XrayType.VLESS_TCP_XTLS);
}
Notify("Checked_VLESS_XTLS");
}
}
public bool Checked_VLESS_WS
{
get
{
return settings.Types.Contains(XrayType.VLESS_WS_TLS);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VLESS_WS_TLS))
settings.Types.Add(XrayType.VLESS_WS_TLS);
}
else
{
settings.Types.Remove(XrayType.VLESS_WS_TLS);
}
Notify("Checked_VLESS_WS");
Notify("VLESS_WS_Path_Visibility");
}
}
public bool Checked_VLESS_H2
{
get => settings.Types.Contains(XrayType.VLESS_H2_TLS);
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VLESS_H2_TLS))
settings.Types.Add(XrayType.VLESS_H2_TLS);
}
else
{
settings.Types.Remove(XrayType.VLESS_H2_TLS);
}
Notify("Checked_VLESS_H2");
Notify("VLESS_H2_Path_Visibility");
}
}
public bool Checked_VMESS_TCP
{
get
{
return settings.Types.Contains(XrayType.VMESS_TCP_TLS);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VMESS_TCP_TLS))
settings.Types.Add(XrayType.VMESS_TCP_TLS);
}
else
{
settings.Types.Remove(XrayType.VMESS_TCP_TLS);
}
Notify("Checked_VMESS_TCP");
Notify("VMESS_TCP_Path_Visibility");
}
}
public bool Checked_VMESS_WS
{
get
{
return settings.Types.Contains(XrayType.VMESS_WS_TLS);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VMESS_WS_TLS))
settings.Types.Add(XrayType.VMESS_WS_TLS);
}
else
{
settings.Types.Remove(XrayType.VMESS_WS_TLS);
}
Notify("Checked_VMESS_WS");
Notify("VMESS_WS_Path_Visibility");
}
}
public bool Checked_VMESS_H2
{
get => settings.Types.Contains(XrayType.VMESS_H2_TLS);
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.VMESS_H2_TLS))
settings.Types.Add(XrayType.VMESS_H2_TLS);
}
else
{
settings.Types.Remove(XrayType.VMESS_H2_TLS);
}
Notify("Checked_VMESS_H2");
Notify("VMESS_H2_Path_Visibility");
}
}
public bool Checked_Trojan_TCP
{
get
{
return settings.Types.Contains(XrayType.Trojan_TCP_TLS);
return settings.Types.Contains(XrayType.Trojan_TCP);
}
set
{
if (value == true)
{
if (!settings.Types.Contains(XrayType.Trojan_TCP_TLS))
settings.Types.Add(XrayType.Trojan_TCP_TLS);
if (!settings.Types.Contains(XrayType.Trojan_TCP))
settings.Types.Add(XrayType.Trojan_TCP);
}
else
{
settings.Types.Remove(XrayType.Trojan_TCP_TLS);
settings.Types.Remove(XrayType.Trojan_TCP);
}
Notify("Checked_Trojan_TCP");
Notify("Trojan_TCP_Pwd_Visibility");
}
}
public string Trojan_TCP_ShareLink
{
get => ShareLink.Build(XrayType.Trojan_TCP, settings);
}
private List<string> _ssMethods = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" };
public List<string> ShadowSocksMethods => _ssMethods;
public bool CheckedShadowSocks
{
get => settings.Types.Contains(XrayType.ShadowsocksAEAD);
set
{
CheckBoxChanged(value, XrayType.ShadowsocksAEAD);
Notify("CheckedShadowSocks");
}
}
public string ShadowSocksPassword
{
get => settings.ShadowsocksPassword;
set => settings.ShadowsocksPassword = value;
}
public string ShadowSocksMethod
{
get => settings.ShadowsocksMethod;
set
{
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
var trimValue = value.Replace(namespaceStr, "");
trimValue = trimValue.Trim();
settings.ShadowsocksMethod = trimValue;
Notify("ShadowSocksMethod");
}
}
public string ShadowSocksShareLink
{
get => ShareLink.Build(XrayType.ShadowsocksAEAD, settings);
}
private void CheckBoxChanged(bool value, XrayType type)
{
if (value == true)
{
if (!settings.Types.Contains(type))
{
settings.Types.Add(type);
}
}
else
{
settings.Types.RemoveAll(x => x == type);
}
}
public Visibility VLESS_TCP_Path_Visibility
}
public partial class XraySettingsViewModel
{
// vmess tcp
public bool Checked_VMESS_TCP
{
get
get => settings.Types.Contains(XrayType.VMESS_TCP);
set
{
return Checked_VLESS_TCP ? Visibility.Visible : Visibility.Hidden;
CheckBoxChanged(value, XrayType.VMESS_TCP);
Notify("Checked_VMESS_TCP");
}
}
public Visibility VLESS_WS_Path_Visibility
public string VMESS_TCP_Path
{
get
{
return Checked_VLESS_WS ? Visibility.Visible : Visibility.Hidden;
}
get => settings.VMESS_TCP_Path;
set => settings.VMESS_TCP_Path = value;
}
public Visibility VLESS_H2_Path_Visibility
public string VMESS_TCP_ShareLink
{
get
{
return Checked_VLESS_H2 ? Visibility.Visible : Visibility.Hidden;
}
get => ShareLink.Build(XrayType.VMESS_TCP, settings);
}
public Visibility VMESS_TCP_Path_Visibility
// vmess ws
public bool Checked_VMESS_WS
{
get
get => settings.Types.Contains(XrayType.VMESS_WS);
set
{
return Checked_VMESS_TCP ? Visibility.Visible : Visibility.Hidden;
CheckBoxChanged(value, XrayType.VMESS_WS);
Notify("Checked_VMESS_WS");
}
}
public Visibility VMESS_WS_Path_Visibility
public string VMESS_WS_Path
{
get
{
return Checked_VMESS_WS ? Visibility.Visible : Visibility.Hidden;
}
get => settings.VMESS_WS_Path;
set => settings.VMESS_WS_Path = value;
}
public Visibility VMESS_H2_Path_Visibility
public string VMESS_WS_TLS_ShareLink
{
get
{
return Checked_VMESS_H2 ? Visibility.Visible : Visibility.Hidden;
}
}
public Visibility Trojan_TCP_Pwd_Visibility
{
get
{
return Checked_Trojan_TCP ? Visibility.Visible : Visibility.Hidden;
}
get => ShareLink.Build(XrayType.VMESS_WS, settings);
}
// vmess kcp
public string VMESS_KCP_Seed
{
get => settings.VMESS_KCP_Seed;
set => settings.VMESS_KCP_Seed = value;
}
public string VMESS_KCP_Type
{
get => settings.VMESS_KCP_Type;
set
{
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
var trimValue = value.Replace(namespaceStr, "");
trimValue = trimValue.Trim();
settings.VMESS_KCP_Type = trimValue;
Notify("VMESS_KCP_Type");
}
}
public bool Checked_VMESS_KCP
{
get => settings.Types.Contains(XrayType.VMESS_KCP);
set
{
CheckBoxChanged(value, XrayType.VMESS_KCP);
Notify("Checked_VMESS_KCP");
}
}
public string VMESS_KCP_ShareLink
{
get => ShareLink.Build(XrayType.VMESS_KCP, settings);
}
private List<string> _kcpTypes = new List<string> { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard", };
public List<string> KcpTypes => _kcpTypes;
}
public partial class XraySettingsViewModel
{
// vless xtls
public bool Checked_VLESS_TCP_XTLS
{
get => settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
set
{
CheckBoxChanged(value, XrayType.VLESS_TCP_XTLS);
Notify("Checked_VLESS_XTLS");
}
}
public string VLESS_TCP_XTLS_ShareLink
{
get => ShareLink.Build(XrayType.VLESS_TCP_XTLS, settings);
}
public string VLESS_TCP_TLS_ShareLink
// vless tcp
public bool Checked_VLESS_TCP
{
get => ShareLink.Build(XrayType.VLESS_TCP_TLS, settings);
get => settings.Types.Contains(XrayType.VLESS_TCP);
set
{
CheckBoxChanged(value, XrayType.VLESS_TCP);
Notify("Checked_VLESS_TCP");
}
}
public string VLESS_WS_TLS_ShareLink
public string VLESS_TCP_ShareLink
{
get => ShareLink.Build(XrayType.VLESS_WS_TLS, settings);
get => ShareLink.Build(XrayType.VLESS_TCP, settings);
}
public string VLESS_H2_TLS_ShareLink
// vless ws
public string VLESS_WS_Path
{
get => ShareLink.Build(XrayType.VLESS_H2_TLS, settings);
get => settings.VLESS_WS_Path;
set => settings.VLESS_WS_Path = value;
}
public string VMESS_TCP_TLS_ShareLink
public bool Checked_VLESS_WS
{
get => ShareLink.Build(XrayType.VMESS_TCP_TLS, settings);
get
{
return settings.Types.Contains(XrayType.VLESS_WS);
}
set
{
CheckBoxChanged(value, XrayType.VLESS_WS);
Notify("Checked_VLESS_WS");
}
}
public string VMESS_WS_TLS_ShareLink
public string VLESS_WS_ShareLink
{
get => ShareLink.Build(XrayType.VMESS_WS_TLS, settings);
}
public string VMESS_H2_TLS_ShareLink
{
get => ShareLink.Build(XrayType.VMESS_H2_TLS, settings);
}
public string Trojan_TCP_TLS_ShareLink
{
get => ShareLink.Build(XrayType.Trojan_TCP_TLS, settings);
get => ShareLink.Build(XrayType.VLESS_WS, settings);
}
}

View File

@ -34,7 +34,7 @@
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="流控(flow)" Width="120" />
<TextBox Text="xtls-rprx-direct" IsReadOnly="True" Width="200" />
<TextBox Text="xtls-rprx-splice" IsReadOnly="True" Width="200" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
@ -69,7 +69,7 @@
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="分享链接" Width="120" />
<TextBox Text="{Binding Settings.VLESS_TCP_XTLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
<TextBox Text="{Binding Settings.VLESS_XTLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</TabItem>
@ -130,7 +130,7 @@
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="分享链接" Width="120" />
<TextBox Text="{Binding Settings.VLESS_TCP_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
<TextBox Text="{Binding Settings.VLESS_TCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</TabItem>

View File

@ -13,6 +13,7 @@
<Window.Resources>
<converters:LoginSecretTypeConverter x:Key="LoginSecretTypeConverter" />
<converters:ProxyTypeConverter x:Key="ProxyTypeConverter" />
<converters:VisibleConverter x:Key="VisibleConverter" />
</Window.Resources>
<Grid>
@ -98,7 +99,7 @@
Content="{DynamicResource KeyLogin}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding PasswordVisiblity}">
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" Visibility="{Binding Host.PasswordVisiblity}">
<TextBlock
Width="100"
Text="{DynamicResource HostPassword}"
@ -223,7 +224,7 @@
<StackPanel>
<CheckBox Content="VLESS OVER TCP with XTLS"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Settings.Checked_VLESS_XTLS}"
IsChecked="{Binding Path=Settings.Checked_VLESS_TCP_XTLS}"
Margin="0,10,0,0" />
<Label Content="数倍性能首选方式不支持CDN" Margin="20,0,0,0" />
@ -251,11 +252,24 @@
Margin="0,10,0,0" />
<Label Content="常规支持CDN" Margin="20,0,0,0" />
<CheckBox Content="VMess mKCP"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Settings.Checked_VMESS_KCP}"
Margin="0,10,0,0" />
<Label Content="低延迟,适用于游戏" Margin="20,0,0,0" />
<CheckBox Content="Trojan over TCP with TLS"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Settings.Checked_Trojan_TCP}"
Margin="0,10,0,0" />
<Label Content="Torjan协议不支持CDN" Margin="20,0,0,0" />
<CheckBox Content="ShadowSocksAEAD"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Settings.CheckedShadowSocks}"
Margin="0,10,0,0" />
<Label Content="俗称SS" Margin="20,0,0,0" />
</StackPanel>
<StackPanel Margin="60,0,0,0">
@ -278,39 +292,97 @@
<TextBox Text="{Binding Path=Settings.MaskDomain}" Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.VLESS_TCP_Path_Visibility}">
<Label Content="VLESS-TCP-Path" Width="120" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.VLESS_TCP_Path}"
IsEnabled="{Binding Checked_VLESS_TCP}"
Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.VLESS_WS_Path_Visibility}">
<Label Content="VLESS-WS-Path" Width="120" VerticalAlignment="Center" />
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_VLESS_WS,
Converter={StaticResource VisibleConverter}
}">
<Label Content="VLESS-WS" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.VLESS_WS_Path}"
IsEnabled="{Binding Checked_VLESS_WS}"
Width="200" />
Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.VMESS_TCP_Path_Visibility}">
<Label Content="VMESS-TCP-Path" Width="120" VerticalAlignment="Center" />
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_VMESS_TCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="VMESS-TCP" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.VMESS_TCP_Path}"
IsEnabled="{Binding Checked_VMESS_TCP}"
Width="200" />
Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.VMESS_WS_Path_Visibility}">
<Label Content="VMESS-WS-Path" Width="120" VerticalAlignment="Center" />
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_VMESS_WS,
Converter={StaticResource VisibleConverter}
}">
<Label Content="VMESS-WS" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.VMESS_WS_Path}"
IsEnabled="{Binding Checked_VMESS_WS}"
Width="200" />
Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.Trojan_TCP_Pwd_Visibility}">
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_Trojan_TCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="Trojan密码" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.TrojanPassword}"
IsEnabled="{Binding Checked_Trojan_TCP}"
Width="200" />
Width="200" />
</StackPanel>
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_VMESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="KCP伪装" Width="80" VerticalAlignment="Center"/>
<ComboBox Width="200"
ItemsSource="{Binding Path=Settings.KcpTypes}"
SelectedValue="{Binding Settings.VMESS_KCP_Type,Mode=TwoWay}">
</ComboBox>
</StackPanel>
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.Checked_VMESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="KCP Seed" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.VMESS_KCP_Seed}"
Width="200"/>
</StackPanel>
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.CheckedShadowSocks,
Converter={StaticResource VisibleConverter}
}">
<Label Content="SS 密码" Width="80" VerticalAlignment="Center" />
<TextBox Text="{Binding Path=Settings.ShadowSocksPassword}"
Width="200"/>
</StackPanel>
<StackPanel Margin="0,10,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Settings.CheckedShadowSocks,
Converter={StaticResource VisibleConverter}
}">
<Label Content="SS 加密方式" Width="80" VerticalAlignment="Center" />
<ComboBox Width="200"
ItemsSource="{Binding Settings.ShadowSocksMethods}"
SelectedValue="{Binding Settings.ShadowSocksMethod}">
</ComboBox>
</StackPanel>
</StackPanel>
</StackPanel>

View File

@ -53,5 +53,6 @@ namespace ProxySU_Core.Views
{
Settings.UUID = Guid.NewGuid().ToString();
}
}
}