1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 05:06:08 +03:00

update 4.0.4

This commit is contained in:
autumn 2021-07-13 11:05:10 +08:00
parent b9b41b6554
commit 860dfb6520
4 changed files with 75 additions and 103 deletions

View File

@ -3,6 +3,7 @@ using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace ProxySuper.Core.Models.Projects
{
@ -37,33 +38,11 @@ namespace ProxySuper.Core.Models.Projects
}
[JsonIgnore]
public bool WithTLS
public bool IsIPAddress
{
get
{
var withOutTLSList = new List<XrayType> {
XrayType.ShadowsocksAEAD,
XrayType.VLESS_KCP,
XrayType.VMESS_KCP
};
return Types.Except(withOutTLSList).Count() > 0;
}
}
[JsonIgnore]
public bool IsFullbackMode
{
get
{
var withoutFullback = new List<XrayType> {
XrayType.ShadowsocksAEAD,
XrayType.VLESS_KCP,
XrayType.VMESS_KCP,
XrayType.VLESS_gRPC,
};
return Types.Except(withoutFullback).Count() > 0;
return IPAddress.TryParse(Domain, out _);
}
}

View File

@ -722,7 +722,6 @@ namespace ProxySuper.Core.Services
throw new Exception("安装 acme.sh 失败,请联系开发者!");
}
RunCmd("cd ~/.acme.sh/");
RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
// 申请证书

View File

@ -67,7 +67,7 @@ namespace ProxySuper.Core.Services
public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
{
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
@ -118,9 +118,6 @@ namespace ProxySuper.Core.Services
var xrayConfig = LoadXrayConfig();
if (parameters.IsFullbackMode)
{
#region Fullbacks
var baseBound = GetBound("VLESS_TCP_XTLS.json");
baseBound.port = parameters.Port;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
@ -130,6 +127,8 @@ namespace ProxySuper.Core.Services
xrayConfig.inbounds.Add(baseBound);
SetClients(baseBound, uuidList, withXtls: true);
#region Fullbacks
if (parameters.Types.Contains(XrayType.VLESS_WS))
{
var wsInbound = GetBound("VLESS_WS.json");
@ -189,7 +188,6 @@ namespace ProxySuper.Core.Services
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
}
#endregion
}
if (parameters.Types.Contains(XrayType.VLESS_gRPC))
{
@ -211,8 +209,6 @@ namespace ProxySuper.Core.Services
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
if (parameters.Types.Contains(XrayType.VMESS_KCP))
{
var kcpBound = GetBound("VMESS_KCP.json");
@ -223,7 +219,6 @@ namespace ProxySuper.Core.Services
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
{
var ssBound = GetBound("Shadowsocks-AEAD.json");

View File

@ -68,17 +68,16 @@ namespace ProxySuper.Core.Services
SyncTimeDiff();
WriteOutput("时间同步完成");
if (Parameters.WithTLS)
if (!Parameters.IsIPAddress)
{
WriteOutput("检测域名是否绑定本机IP...");
ValidateDomain();
WriteOutput("域名检测完成");
}
WriteOutput("安装Caddy...");
InstallCaddy();
WriteOutput("Caddy安装完成");
}
WriteOutput("安装Xray-Core...");
InstallXrayWithCert();
@ -297,7 +296,7 @@ namespace ProxySuper.Core.Services
RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
}
if (Parameters.WithTLS)
if (!Parameters.IsIPAddress)
{
WriteOutput("安装TLS证书");
InstallCertToXray();