mirror of
https://github.com/proxysu/ProxySU.git
synced 2025-04-08 03:32:13 +00:00
commit
400fca295b
31 changed files with 796 additions and 401 deletions
34
ProxySU_Core/Converters/VisibleConverter.cs
Normal file
34
ProxySU_Core/Converters/VisibleConverter.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,8 @@ namespace ProxySU_Core.Models.Developers
|
|||
public const int Trojan_TCP_Port = 3110;
|
||||
public const int Trojan_WS_Port = 3111;
|
||||
|
||||
public const int ShadowSocksPort = 4110;
|
||||
|
||||
|
||||
public static dynamic LoadXrayConfig()
|
||||
{
|
||||
|
@ -95,7 +97,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
public static string BuildXrayConfig(XraySettings parameters)
|
||||
{
|
||||
var xrayConfig = LoadXrayConfig();
|
||||
var baseBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_TCP_XTLS.json"));
|
||||
var baseBound = GetBound("VLESS_TCP_XTLS.json");
|
||||
baseBound.port = parameters.Port;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
|
@ -104,42 +106,24 @@ 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"));
|
||||
var wsInbound = GetBound("VLESS_WS.json");
|
||||
wsInbound.port = VLESS_WS_Port;
|
||||
wsInbound.settings.clients[0].id = parameters.UUID;
|
||||
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
dest = VLESS_WS_Port,
|
||||
path = parameters.VLESS_WS_Path
|
||||
path = parameters.VLESS_WS_Path,
|
||||
xver = 1,
|
||||
}));
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_H2_TLS))
|
||||
if (parameters.Types.Contains(XrayType.VMESS_TCP))
|
||||
{
|
||||
var h2Inbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_HTTP2_TLS.json"));
|
||||
h2Inbound.port = VLESS_H2_Port;
|
||||
h2Inbound.settings.clients[0].id = parameters.UUID;
|
||||
h2Inbound.streamSettings.httpSettings.path = parameters.VLESS_H2_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
dest = VLESS_H2_Port,
|
||||
path = parameters.VLESS_H2_Path
|
||||
}));
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(h2Inbound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_mKCP_Speed))
|
||||
{
|
||||
var kcpInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_mKCP"));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_TCP_TLS))
|
||||
{
|
||||
var mtcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_TCP_TLS.json"));
|
||||
var mtcpBound = GetBound("VMESS_TCP.json");
|
||||
mtcpBound.port = VMESS_TCP_Port;
|
||||
mtcpBound.settings.clients[0].id = parameters.UUID;
|
||||
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
|
||||
|
@ -152,9 +136,9 @@ 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"));
|
||||
var mwsBound = GetBound("VMESS_WS.json");
|
||||
mwsBound.port = VMESS_WS_Port;
|
||||
mwsBound.settings.clients[0].id = parameters.UUID;
|
||||
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
|
||||
|
@ -167,13 +151,9 @@ namespace ProxySU_Core.Models.Developers
|
|||
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_H2_TLS)) { }
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_mKCP_Speed)) { }
|
||||
|
||||
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"));
|
||||
var trojanTcpBound = GetBound("Trojan_TCP.json");
|
||||
trojanTcpBound.port = Trojan_TCP_Port;
|
||||
trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
|
||||
baseBound.settings.fallbacks[0] = JToken.FromObject(new
|
||||
|
@ -184,7 +164,25 @@ namespace ProxySU_Core.Models.Developers
|
|||
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.Trojan_WS_TLS)) { }
|
||||
if (parameters.Types.Contains(XrayType.VMESS_KCP))
|
||||
{
|
||||
var kcpBound = GetBound("VMESS_KCP.json");
|
||||
kcpBound.port = VMESS_mKCP_Port;
|
||||
kcpBound.settings.clients[0].id = parameters.UUID;
|
||||
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
|
||||
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||
}
|
||||
|
||||
|
||||
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
||||
{
|
||||
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
||||
ssBound.port = ShadowSocksPort;
|
||||
ssBound.settings.clients[0].password = parameters.ShadowsocksPassword;
|
||||
ssBound.settings.clients[0].method = parameters.ShadowsocksMethod;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(
|
||||
xrayConfig,
|
||||
|
@ -195,6 +193,11 @@ namespace ProxySU_Core.Models.Developers
|
|||
});
|
||||
}
|
||||
|
||||
private static dynamic GetBound(string name)
|
||||
{
|
||||
return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
|
||||
}
|
||||
|
||||
private static dynamic LoadJsonObj(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
|
|
|
@ -9,5 +9,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
int Port { get; set; }
|
||||
|
||||
string Domain { get; set; }
|
||||
|
||||
List<XrayType> Types { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,10 +222,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置防火墙
|
||||
/// </summary>
|
||||
protected void ConfigureFirewall()
|
||||
protected void ClosePort(params int[] portList)
|
||||
{
|
||||
string cmd;
|
||||
|
||||
|
@ -240,43 +237,88 @@ namespace ProxySU_Core.Models.Developers
|
|||
RunCmd("systemctl restart firewalld");
|
||||
}
|
||||
|
||||
if (Parameters.Port == 443)
|
||||
foreach (var port in portList)
|
||||
{
|
||||
RunCmd("firewall-cmd --zone=public --add-port=80/tcp --permanent");
|
||||
RunCmd("firewall-cmd --zone=public --add-port=443/tcp --permanent");
|
||||
RunCmd("firewall-cmd --zone=public --add-port=80/udp --permanent");
|
||||
RunCmd("firewall-cmd --zone=public --add-port=443/udp --permanent");
|
||||
RunCmd("yes | firewall-cmd --reload");
|
||||
RunCmd($"firewall-cmd --zone=public --remove-port={port}/tcp --permanent");
|
||||
RunCmd($"firewall-cmd --zone=public --remove-port={port}/udp --permanent");
|
||||
}
|
||||
else
|
||||
{
|
||||
RunCmd($"firewall-cmd --zone=public --add-port={Parameters.Port}/tcp --permanent");
|
||||
RunCmd($"firewall-cmd --zone=public --add-port={Parameters.Port}/udp --permanent");
|
||||
RunCmd("yes | firewall-cmd --reload");
|
||||
}
|
||||
return;
|
||||
RunCmd("yes | firewall-cmd --reload");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = RunCmd("command -v ufw");
|
||||
if (!string.IsNullOrEmpty(cmd))
|
||||
{
|
||||
foreach (var port in portList)
|
||||
{
|
||||
RunCmd($"ufw delete allow {port}/tcp");
|
||||
RunCmd($"ufw delete allow {port}/udp");
|
||||
}
|
||||
RunCmd("yes | ufw reload");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd = RunCmd("command -v ufw");
|
||||
protected void OpenPort(params int[] portList)
|
||||
{
|
||||
|
||||
string cmd;
|
||||
|
||||
cmd = RunCmd("command -v firewall-cmd");
|
||||
if (!string.IsNullOrEmpty(cmd))
|
||||
{
|
||||
if (Parameters.Port == 443)
|
||||
//有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
|
||||
//用于保证acme.sh申请证书成功
|
||||
cmd = RunCmd("firewall-cmd --state");
|
||||
if (cmd.Trim() != "running")
|
||||
{
|
||||
RunCmd("ufw allow 80/tcp");
|
||||
RunCmd("ufw allow 443/tcp");
|
||||
RunCmd("ufw allow 80/udp");
|
||||
RunCmd("ufw allow 443/udp");
|
||||
RunCmd("yes | ufw reload");
|
||||
RunCmd("systemctl restart firewalld");
|
||||
}
|
||||
else
|
||||
|
||||
foreach (var port in portList)
|
||||
{
|
||||
RunCmd($"ufw allow {Parameters.Port}/tcp");
|
||||
RunCmd($"ufw allow {Parameters.Port}/udp");
|
||||
RunCmd($"firewall-cmd --zone=public --add-port={port}/tcp --permanent");
|
||||
RunCmd($"firewall-cmd --zone=public --add-port={port}/udp --permanent");
|
||||
}
|
||||
RunCmd("yes | firewall-cmd --reload");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = RunCmd("command -v ufw");
|
||||
if (!string.IsNullOrEmpty(cmd))
|
||||
{
|
||||
foreach (var port in portList)
|
||||
{
|
||||
RunCmd($"ufw allow {port}/tcp");
|
||||
RunCmd($"ufw allow {port}/udp");
|
||||
}
|
||||
RunCmd("yes | ufw reload");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置防火墙
|
||||
/// </summary>
|
||||
protected void ConfigureFirewall()
|
||||
{
|
||||
var portList = new List<int>();
|
||||
portList.Add(80);
|
||||
portList.Add(Parameters.Port);
|
||||
|
||||
if (Parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
||||
{
|
||||
portList.Add(ConfigBuilder.ShadowSocksPort);
|
||||
}
|
||||
|
||||
if (Parameters.Types.Contains(XrayType.VMESS_KCP))
|
||||
{
|
||||
portList.Add(ConfigBuilder.VMESS_mKCP_Port);
|
||||
}
|
||||
|
||||
OpenPort(portList.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置同步时间差
|
||||
/// </summary>
|
||||
|
@ -357,29 +399,16 @@ namespace ProxySU_Core.Models.Developers
|
|||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
|
||||
RunCmd("yes | bash caddy_install.sh");
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
}
|
||||
|
||||
//if (CmdType == CmdType.Apt)
|
||||
//{
|
||||
// RunCmd("sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("sudo apt install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Dnf)
|
||||
//{
|
||||
// RunCmd("echo y | dnf install 'dnf-command(copr)'");
|
||||
// RunCmd("echo y | dnf copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("dnf install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Yum)
|
||||
//{
|
||||
// RunCmd("echo y | echo y | yum install yum-plugin-copr");
|
||||
// RunCmd("echo y | echo y | yum copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("yum install caddy");
|
||||
//}
|
||||
protected void UninstallCaddy()
|
||||
{
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
|
||||
RunCmd("yes | bash caddy_install.sh uninstall");
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("rm -rf /usr/share/caddy");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
ConfigureFirewall();
|
||||
WriteOutput("防火墙配置完成");
|
||||
|
||||
WriteOutput("同步系统和本地世间...");
|
||||
WriteOutput("同步系统和本地时间...");
|
||||
SyncTimeDiff();
|
||||
WriteOutput("时间同步完成");
|
||||
|
||||
|
@ -96,10 +96,27 @@ namespace ProxySU_Core.Models.Developers
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("安装终止," + ex.Message);
|
||||
var errorLog = "安装终止," + ex.Message;
|
||||
WriteOutput(errorLog);
|
||||
MessageBox.Show(errorLog);
|
||||
}
|
||||
}
|
||||
|
||||
public void Uninstall()
|
||||
{
|
||||
EnsureRootAuth();
|
||||
WriteOutput("卸载Caddy");
|
||||
UninstallCaddy();
|
||||
WriteOutput("卸载Xray");
|
||||
UninstallXray();
|
||||
WriteOutput("卸载证书");
|
||||
UninstallAcme();
|
||||
WriteOutput("关闭端口");
|
||||
ClosePort(ConfigBuilder.ShadowSocksPort, ConfigBuilder.VLESS_mKCP_Port, ConfigBuilder.VMESS_mKCP_Port);
|
||||
|
||||
WriteOutput("************ 卸载完成 ************");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新xray内核
|
||||
/// </summary>
|
||||
|
@ -119,6 +136,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
{
|
||||
EnsureRootAuth();
|
||||
EnsureSystemEnv();
|
||||
ConfigureFirewall();
|
||||
var configJson = ConfigBuilder.BuildXrayConfig(Parameters);
|
||||
var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
|
||||
RunCmd("rm -rf /usr/local/etc/xray/config.json");
|
||||
|
@ -286,12 +304,24 @@ namespace ProxySU_Core.Models.Developers
|
|||
|
||||
}
|
||||
|
||||
private void UninstallXray()
|
||||
{
|
||||
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
|
||||
}
|
||||
|
||||
private void UninstallAcme()
|
||||
{
|
||||
RunCmd("acme.sh --uninstall");
|
||||
RunCmd("rm -r ~/.acme.sh");
|
||||
}
|
||||
|
||||
private void InstallXrayWithCert()
|
||||
{
|
||||
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
|
||||
|
||||
if (!FileExists("/usr/local/bin/xray"))
|
||||
{
|
||||
WriteOutput("Xray-Core安装失败,请联系开发者");
|
||||
throw new Exception("Xray-Core安装失败,请联系开发者");
|
||||
}
|
||||
|
||||
|
@ -333,6 +363,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("安装 acme.sh 失败,请联系开发者!");
|
||||
throw new Exception("安装 acme.sh 失败,请联系开发者!");
|
||||
}
|
||||
|
||||
|
@ -357,6 +388,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("申请证书失败,请联系开发者!");
|
||||
throw new Exception("申请证书失败,请联系开发者!");
|
||||
}
|
||||
|
||||
|
@ -370,6 +402,7 @@ namespace ProxySU_Core.Models.Developers
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("安装证书失败,请联系开发者!");
|
||||
throw new Exception("安装证书失败,请联系开发者!");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using ProxySU_Core.Common;
|
||||
using ProxySU_Core.Models.Developers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -13,21 +14,35 @@ namespace ProxySU_Core.Models
|
|||
{
|
||||
public static string Build(XrayType xrayType, XraySettings settings)
|
||||
{
|
||||
|
||||
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:
|
||||
case XrayType.VMESS_KCP:
|
||||
return BuildVmessShareLink(xrayType, settings);
|
||||
case XrayType.ShadowsocksAEAD:
|
||||
return BuildShadowSocksShareLink(settings);
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildShadowSocksShareLink(XraySettings settings)
|
||||
{
|
||||
var _method = settings.ShadowsocksMethod;
|
||||
var _password = settings.ShadowsocksPassword;
|
||||
var _server = settings.Domain;
|
||||
var _port = ConfigBuilder.ShadowSocksPort;
|
||||
|
||||
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
|
||||
return "ss://" + base64URL;
|
||||
}
|
||||
|
||||
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
|
||||
{
|
||||
|
@ -46,21 +61,28 @@ namespace ProxySU_Core.Models
|
|||
ps = "",
|
||||
};
|
||||
|
||||
|
||||
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";
|
||||
vmess.path = settings.VMESS_WS_Path;
|
||||
break;
|
||||
case XrayType.VMESS_KCP:
|
||||
vmess.ps = "vmess-mKCP";
|
||||
vmess.port = ConfigBuilder.VMESS_mKCP_Port.ToString();
|
||||
vmess.net = "kcp";
|
||||
vmess.type = settings.VMESS_KCP_Type;
|
||||
vmess.path = settings.VMESS_KCP_Seed;
|
||||
vmess.tls = "";
|
||||
break;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
|
@ -84,10 +106,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,29 +119,30 @@ 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";
|
||||
_uuid = settings.TrojanPassword;
|
||||
_descriptiveText = "trojan-tcp";
|
||||
break;
|
||||
default:
|
||||
|
@ -129,7 +151,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)}";
|
||||
|
|
|
@ -19,11 +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>
|
||||
|
@ -36,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>
|
||||
|
@ -69,13 +72,20 @@ namespace ProxySU_Core.Models
|
|||
/// <summary>
|
||||
/// vmess http2 path
|
||||
/// </summary>
|
||||
public string VMESS_HTTP2_Path { get; set; }
|
||||
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>
|
||||
|
@ -85,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>
|
||||
/// 域名
|
||||
|
@ -106,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;
|
||||
|
@ -141,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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
|||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("3.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0.0")]
|
||||
|
|
BIN
ProxySU_Core/ProxySU.ico
Normal file
BIN
ProxySU_Core/ProxySU.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -64,6 +64,9 @@
|
|||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>ProxySU.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ControlzEx, Version=5.0.0.0, Culture=neutral, PublicKeyToken=69f1c32f803d307e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ControlzEx.5.0.0\lib\net452\ControlzEx.dll</HintPath>
|
||||
|
@ -119,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" />
|
||||
|
@ -135,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" />
|
||||
|
@ -238,34 +243,37 @@
|
|||
<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">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\Trojan_WS_TLS.json">
|
||||
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_HTTP2_TLS.json">
|
||||
<None Include="Templates\xray\server\05_inbounds\Trojan_WS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_mKCP.json">
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_HTTP2.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<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">
|
||||
|
@ -333,6 +341,12 @@
|
|||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ProxySU.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="ProxySU.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
BIN
ProxySU_Core/Resources/ProxySU.ico
Normal file
BIN
ProxySU_Core/Resources/ProxySU.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"port": 12345,
|
||||
"protocol": "shadowsocks",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "",
|
||||
"method": "aes-128-gcm"
|
||||
}
|
||||
],
|
||||
"network": "tcp,udp"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
|
@ -15,7 +15,11 @@
|
|||
"network": "tcp",
|
||||
"security": "xtls",
|
||||
"xtlsSettings": {
|
||||
"alpn": [ "h2", "http/1.1" ],
|
||||
"allowInsecure": false,
|
||||
"minVersion": "1.2",
|
||||
"alpn": [
|
||||
"http/1.1"
|
||||
],
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
21
ProxySU_Core/ViewModels/IdValueViewModel.cs
Normal file
21
ProxySU_Core/ViewModels/IdValueViewModel.cs
Normal 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; }
|
||||
}
|
||||
}
|
|
@ -3,27 +3,34 @@ 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
|
||||
{
|
||||
get => settings.UUID;
|
||||
set => settings.UUID = value;
|
||||
set
|
||||
{
|
||||
settings.UUID = value;
|
||||
Notify("UUID");
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain
|
||||
|
@ -38,227 +45,224 @@ 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 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 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_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_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 VMESS_TCP_Path_Visibility
|
||||
public string VMESS_TCP_ShareLink
|
||||
{
|
||||
get
|
||||
{
|
||||
return Checked_VMESS_TCP ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
public Visibility VMESS_WS_Path_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
return Checked_VMESS_WS ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
public Visibility Trojan_TCP_Pwd_Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
return Checked_Trojan_TCP ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
get => ShareLink.Build(XrayType.VMESS_TCP, settings);
|
||||
}
|
||||
|
||||
// vmess ws
|
||||
public bool Checked_VMESS_WS
|
||||
{
|
||||
get => settings.Types.Contains(XrayType.VMESS_WS);
|
||||
set
|
||||
{
|
||||
CheckBoxChanged(value, XrayType.VMESS_WS);
|
||||
Notify("Checked_VMESS_WS");
|
||||
}
|
||||
}
|
||||
public string VMESS_WS_Path
|
||||
{
|
||||
get => settings.VMESS_WS_Path;
|
||||
set => settings.VMESS_WS_Path = value;
|
||||
}
|
||||
public string VMESS_WS_ShareLink
|
||||
{
|
||||
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 VMESS_TCP_TLS_ShareLink
|
||||
|
||||
|
||||
// vless ws
|
||||
public string VLESS_WS_Path
|
||||
{
|
||||
get => ShareLink.Build(XrayType.VMESS_TCP_TLS, settings);
|
||||
get => settings.VLESS_WS_Path;
|
||||
set => settings.VLESS_WS_Path = value;
|
||||
}
|
||||
public string VMESS_WS_TLS_ShareLink
|
||||
public bool Checked_VLESS_WS
|
||||
{
|
||||
get => ShareLink.Build(XrayType.VMESS_WS_TLS, settings);
|
||||
get
|
||||
{
|
||||
return settings.Types.Contains(XrayType.VLESS_WS);
|
||||
}
|
||||
set
|
||||
{
|
||||
CheckBoxChanged(value, XrayType.VLESS_WS);
|
||||
Notify("Checked_VLESS_WS");
|
||||
}
|
||||
}
|
||||
public string Trojan_TCP_TLS_ShareLink
|
||||
public string VLESS_WS_ShareLink
|
||||
{
|
||||
get => ShareLink.Build(XrayType.Trojan_TCP_TLS, settings);
|
||||
get => ShareLink.Build(XrayType.VLESS_WS, settings);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:local="clr-namespace:ProxySU_Core.Views"
|
||||
xmlns:dev="clr-namespace:ProxySU_Core.Models.Developers"
|
||||
mc:Ignorable="d"
|
||||
Title="查看配置" Height="450" Width="800">
|
||||
Title="查看配置" Height="500" Width="800">
|
||||
|
||||
|
||||
<Grid>
|
||||
<TabControl
|
||||
Background="#fff"
|
||||
|
@ -34,7 +37,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">
|
||||
|
@ -130,7 +133,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>
|
||||
|
@ -191,7 +194,7 @@
|
|||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VLESS_WS_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VLESS_WS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
@ -247,14 +250,14 @@
|
|||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_TCP_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VMESS_TCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="VLESS-WebSocket-TLS">
|
||||
Header="VMESS-WebSocket-TLS">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="地址(address)" Width="120" />
|
||||
|
@ -303,7 +306,63 @@
|
|||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_WS_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VMESS_WS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="VMESS-mKCP">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="地址(address)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="端口(port)" Width="120" />
|
||||
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.VMESS_mKCP_Port},Mode=OneTime}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="用户ID(id)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.UUID}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="加密(security)" Width="120" />
|
||||
<TextBox Text="none" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="传输协议(network)" Width="120" />
|
||||
<TextBox Text="kcp" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="伪装类型(type)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_Type}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="伪装域名(host)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="路径(path)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_Seed}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="传输安全(tls)" Width="120" />
|
||||
<TextBox Text="" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
@ -329,11 +388,41 @@
|
|||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Trojan_TCP_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.Trojan_TCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.CheckedShadowSocks}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="ShadowSocks">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="服务器地址" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="服务器端口" Width="120" />
|
||||
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.ShadowSocksPort},Mode=OneTime}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="密码" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksPassword}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="加密方式" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksMethod}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</metro:MetroWindow>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<ComboBox
|
||||
SelectionChanged="ChangeLanguage"
|
||||
x:Name="cmbLanguage"
|
||||
IsEnabled="False"
|
||||
SelectedIndex="0">
|
||||
<ComboBoxItem x:Name="zh_cn" Content="{DynamicResource LanguageChinese}"></ComboBoxItem>
|
||||
<ComboBoxItem x:Name="en" Content="{DynamicResource LanguageEnglish}"></ComboBoxItem>
|
||||
|
@ -106,10 +107,10 @@
|
|||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="{DynamicResource Connect}" FontSize="12" Height="24" Click="Connect" />
|
||||
<Button Content="{DynamicResource Edit}" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" />
|
||||
<Button Content="控制台" FontSize="12" Height="24" Click="Connect" />
|
||||
<Button Content="查看配置" FontSize="12" Height="24" Margin="10,0,0,0" Click="ShowClientInfo" />
|
||||
<Button Content="{DynamicResource Delete}" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" BorderBrush="IndianRed" Background="IndianRed" />
|
||||
<Button Content="编辑" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" />
|
||||
<Button Content="删除" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" BorderBrush="IndianRed" Background="IndianRed" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
|
|
|
@ -5,24 +5,14 @@ using ProxySU_Core.Common;
|
|||
using ProxySU_Core.Models;
|
||||
using ProxySU_Core.ViewModels;
|
||||
using ProxySU_Core.Views;
|
||||
using Renci.SshNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
|
||||
namespace ProxySU_Core
|
||||
|
|
|
@ -8,23 +8,28 @@
|
|||
xmlns:local="clr-namespace:ProxySU_Core.Views"
|
||||
xmlns:converters="clr-namespace:ProxySU_Core.Converters"
|
||||
mc:Ignorable="d"
|
||||
Title="编辑主机信息" Height="800" Width="710">
|
||||
Title="编辑主机信息" Height="600" Width="980">
|
||||
|
||||
<Window.Resources>
|
||||
<converters:LoginSecretTypeConverter x:Key="LoginSecretTypeConverter" />
|
||||
<converters:ProxyTypeConverter x:Key="ProxyTypeConverter" />
|
||||
<converters:VisibleConverter x:Key="VisibleConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="320" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="5"/>
|
||||
<RowDefinition Height="400" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="0" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0" Margin="10">
|
||||
<StackPanel Grid.Column="0" Grid.Row="0" Margin="10">
|
||||
<GroupBox
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}"
|
||||
Header="{StaticResource ConnectionGroupName}">
|
||||
|
@ -94,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}"
|
||||
|
@ -127,7 +132,7 @@
|
|||
</GroupBox>
|
||||
|
||||
<GroupBox
|
||||
Margin="20,0,0,0"
|
||||
Margin="0,10,0,0"
|
||||
Header="{DynamicResource ProxyGroupName}"
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}">
|
||||
<StackPanel Margin="10">
|
||||
|
@ -207,18 +212,19 @@
|
|||
</GroupBox>
|
||||
</StackPanel>
|
||||
|
||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" />
|
||||
<GridSplitter Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="10">
|
||||
<GroupBox
|
||||
Padding="10"
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}"
|
||||
Header="选择方式">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0" Margin="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<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" />
|
||||
|
||||
|
@ -246,17 +252,34 @@
|
|||
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="120,0,0,0">
|
||||
<StackPanel Margin="60,0,0,0">
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
|
||||
<Label Content="UUID" Width="80" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding Path=Settings.UUID}" Width="200" />
|
||||
<Button Style="{StaticResource MahApps.Styles.Button.Flat}"
|
||||
Margin="5,0,0,0"
|
||||
Click="RandomUuid"
|
||||
Content="随机" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||
|
@ -269,50 +292,109 @@
|
|||
<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}">
|
||||
<Label Content="Trojan密码" Width="120" VerticalAlignment="Center" />
|
||||
<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>
|
||||
</GroupBox>
|
||||
|
||||
<Button Content="保存"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Width="120"
|
||||
Height="32"
|
||||
Click="Save" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="保存"
|
||||
Grid.Row="3"
|
||||
Width="120" Height="32"
|
||||
Click="Save"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,20,0"></Button>
|
||||
</Grid>
|
||||
</metro:MetroWindow>
|
||||
|
|
|
@ -48,5 +48,11 @@ namespace ProxySU_Core.Views
|
|||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
public void RandomUuid(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.UUID = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,13 @@
|
|||
Height="26"
|
||||
IsEnabled="{Binding HasConnected}"
|
||||
Width="120"/>
|
||||
|
||||
<Button Content="卸载代理"
|
||||
Margin="10,0,0,0"
|
||||
Click="UninstallXray"
|
||||
Height="26"
|
||||
Width="120"
|
||||
IsEnabled="{Binding HasConnected}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
|
@ -54,7 +61,7 @@
|
|||
VerticalAlignment="Center"
|
||||
Margin="0,0,10,0"/>
|
||||
|
||||
<Button Content="生成证书"
|
||||
<Button Content="申请证书"
|
||||
Margin="0,0,0,0"
|
||||
Height="26"
|
||||
Width="120"
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace ProxySU_Core
|
|||
_vm = new Terminal(record.Host);
|
||||
DataContext = _vm;
|
||||
|
||||
WriteOutput("Connect ...");
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
try
|
||||
|
@ -105,10 +104,21 @@ namespace ProxySU_Core
|
|||
|
||||
private void OpenConnect(Host host)
|
||||
{
|
||||
|
||||
WriteOutput("正在登陆服务器 ...");
|
||||
var conneInfo = CreateConnectionInfo(host);
|
||||
_sshClient = new SshClient(conneInfo);
|
||||
_sshClient.Connect();
|
||||
WriteOutput("Connected");
|
||||
try
|
||||
{
|
||||
_sshClient.Connect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteOutput("登陆失败!");
|
||||
WriteOutput(ex.Message);
|
||||
return;
|
||||
}
|
||||
WriteOutput("登陆服务器成功!");
|
||||
|
||||
_vm.HasConnected = true;
|
||||
project = new XrayProject(_sshClient, Record.Settings, WriteOutput);
|
||||
|
@ -159,6 +169,14 @@ namespace ProxySU_Core
|
|||
});
|
||||
}
|
||||
|
||||
private void UninstallXray(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
project.Uninstall();
|
||||
});
|
||||
}
|
||||
|
||||
private void UploadCert(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var fileDialog = new OpenFileDialog();
|
||||
|
|
Loading…
Add table
Reference in a new issue