diff --git a/ProxySuper.Core/Models/Projects/IProjectSettings.cs b/ProxySuper.Core/Models/Projects/IProjectSettings.cs
index 6bd2874..4d5f085 100644
--- a/ProxySuper.Core/Models/Projects/IProjectSettings.cs
+++ b/ProxySuper.Core/Models/Projects/IProjectSettings.cs
@@ -27,5 +27,10 @@ namespace ProxySuper.Core.Models.Projects
/// 类型
///
ProjectType Type { get; set; }
+
+ ///
+ /// 邮箱
+ ///
+ string Email { get; }
}
}
diff --git a/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs
index 76fb1c4..fab1a64 100644
--- a/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs
+++ b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -26,5 +27,24 @@ namespace ProxySuper.Core.Models.Projects
public string Password { get; set; }
public string MaskDomain { get; set; }
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+
+ return $"{UserName + Port.ToString()}@gmail.com";
+ }
+ }
}
}
diff --git a/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
index cf84518..79859f3 100644
--- a/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
+++ b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
@@ -14,6 +14,7 @@ namespace ProxySuper.Core.Models.Projects
{
Port = 443;
WebSocketPath = "/ws";
+ Password = Guid.NewGuid().ToString();
}
public List FreePorts
@@ -63,5 +64,25 @@ namespace ProxySuper.Core.Models.Projects
///
public string WebSocketPath { get; set; }
+
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ var prefix = Password.Length > 7 ? Password.Substring(0, 7) : Password;
+ return $"{prefix}@gmail.com";
+ }
+ }
+
}
}
diff --git a/ProxySuper.Core/Models/Projects/XraySettings.cs b/ProxySuper.Core/Models/Projects/XraySettings.cs
index d9fe96f..f74272a 100644
--- a/ProxySuper.Core/Models/Projects/XraySettings.cs
+++ b/ProxySuper.Core/Models/Projects/XraySettings.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -71,6 +72,24 @@ namespace ProxySuper.Core.Models.Projects
///
public string MaskDomain { get; set; }
+ [JsonIgnore]
+ public string Email
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(Domain))
+ {
+ var arr = Domain.Split('.');
+ if (arr.Length == 3)
+ {
+ return $"{arr[0]}@{arr[1]}.{arr[2]}";
+ }
+ }
+
+ return $"{UUID.Substring(2, 6)}@gmail.com";
+ }
+ }
+
///
/// 安装类型
///
diff --git a/ProxySuper.Core/Services/NaiveProxyProject.cs b/ProxySuper.Core/Services/NaiveProxyProject.cs
index 26d125a..0c11622 100644
--- a/ProxySuper.Core/Services/NaiveProxyProject.cs
+++ b/ProxySuper.Core/Services/NaiveProxyProject.cs
@@ -101,6 +101,8 @@ namespace ProxySuper.Core.Services
{
WriteOutput("安装 NaiveProxy");
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash");
+ // 允许开机启动
+ RunCmd("systemctl enable caddy");
UploadCaddyFile(false);
ConfigNetwork();
WriteOutput("NaiveProxy 安装完成");
diff --git a/ProxySuper.Core/Services/ProjectBase.cs b/ProxySuper.Core/Services/ProjectBase.cs
index 970217a..4cee6b8 100644
--- a/ProxySuper.Core/Services/ProjectBase.cs
+++ b/ProxySuper.Core/Services/ProjectBase.cs
@@ -70,7 +70,7 @@ namespace ProxySuper.Core.Services
// 确认安装命令
if (CmdType == CmdType.None)
{
- cmd = RunCmd("command -v apt-get");
+ cmd = RunCmd("command -v apt");
if (!string.IsNullOrEmpty(cmd))
{
CmdType = CmdType.Apt;
@@ -105,7 +105,7 @@ namespace ProxySuper.Core.Services
if (CmdType == CmdType.None || !hasSystemCtl)
{
- throw new Exception("系统缺乏必要的安装组件如:apt-get||dnf||yum||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本");
+ throw new Exception("系统缺乏必要的安装组件如:apt||dnf||yum||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本");
}
@@ -157,6 +157,8 @@ namespace ProxySuper.Core.Services
///
protected void ConfigureSoftware()
{
+ RunCmd(GetUpdateCmd());
+
string cmd = RunCmd("command -v sudo");
if (string.IsNullOrEmpty(cmd))
{
@@ -188,17 +190,14 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
- RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("dnsutils"));
}
else if (CmdType == CmdType.Dnf)
{
- RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("bind-utils"));
}
else if (CmdType == CmdType.Yum)
{
- RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("bind-utils"));
}
}
@@ -397,25 +396,25 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
- RunCmd("sudo apt -y install debian-keyring debian-archive-keyring apt-transport-https");
+ RunCmd("apt install -y debian-keyring debian-archive-keyring apt-transport-https");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list");
RunCmd("sudo apt -y update");
- RunCmd("sudo apt -y install caddy");
+ RunCmd("sudo apt install -y caddy");
}
if (CmdType == CmdType.Dnf)
{
- RunCmd("dnf -y install 'dnf-command(copr)'");
- RunCmd("dnf -y copr enable @caddy/caddy");
- RunCmd("dnf -y install caddy");
+ RunCmd("dnf install -y 'dnf-command(copr)'");
+ RunCmd("dnf copr enable @caddy/caddy");
+ RunCmd("dnf install -y caddy");
}
if (CmdType == CmdType.Yum)
{
- RunCmd("yum -y install yum-plugin-copr");
- RunCmd("yum -y copr enable @caddy/caddy");
- RunCmd("yum -y install caddy");
+ RunCmd("yum install -y yum-plugin-copr");
+ RunCmd("yum copr enable @caddy/caddy");
+ RunCmd("yum install -y caddy");
}
RunCmd("systemctl enable caddy.service");
@@ -468,7 +467,7 @@ namespace ProxySuper.Core.Services
if (string.IsNullOrEmpty(IPv6))
{
- throw new Exception("未检测到可用的的IP地址");
+ throw new Exception("未检测到可用的的IP地址,请重试安装");
}
OnlyIpv6 = true;
@@ -662,7 +661,8 @@ namespace ProxySuper.Core.Services
RunCmd(GetInstallCmd("automake autoconf libtool"));
// 安装Acme
- var result = RunCmd($"curl https://get.acme.sh yes | sh");
+
+ var result = RunCmd($"curl https://get.acme.sh yes | sh -s email={Parameters.Email}");
if (result.Contains("Install success"))
{
WriteOutput("安装 acme.sh 成功");
@@ -740,7 +740,7 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
- return "apt-get update";
+ return "apt update";
}
else if (CmdType == CmdType.Dnf)
{
@@ -763,15 +763,15 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
- return "apt-get -y install " + soft;
+ return "apt install -y " + soft;
}
else if (CmdType == CmdType.Dnf)
{
- return "dnf -y install " + soft;
+ return "dnf install -y " + soft;
}
else if (CmdType == CmdType.Yum)
{
- return "yum -y install " + soft;
+ return "yum install -y " + soft;
}
throw new Exception("未识别的系统");
diff --git a/ProxySuper.WPF/Properties/AssemblyInfo.cs b/ProxySuper.WPF/Properties/AssemblyInfo.cs
index 945398a..48b954e 100644
--- a/ProxySuper.WPF/Properties/AssemblyInfo.cs
+++ b/ProxySuper.WPF/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.0.1.0")]
-[assembly: AssemblyFileVersion("4.0.1.0")]
+[assembly: AssemblyVersion("4.0.2.0")]
+[assembly: AssemblyFileVersion("4.0.2.0")]
diff --git a/ProxySuper.WPF/Templates/NaiveProxy/caddy.service b/ProxySuper.WPF/Templates/NaiveProxy/caddy.service
new file mode 100644
index 0000000..aa0070b
--- /dev/null
+++ b/ProxySuper.WPF/Templates/NaiveProxy/caddy.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Caddy
+Documentation=https://caddyserver.com/docs/
+After=network.target network-online.target
+Requires=network-online.target
+
+[Service]
+User=caddy
+Group=caddy
+ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
+ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
+TimeoutStopSec=5s
+LimitNOFILE=1048576
+LimitNPROC=512
+PrivateTmp=true
+ProtectSystem=full
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file