mirror of
https://github.com/proxysu/ProxySU.git
synced 2025-02-16 22:53:13 +03:00
update 4.0.4
This commit is contained in:
parent
b9b41b6554
commit
860dfb6520
@ -3,6 +3,7 @@ using ProxySuper.Core.Services;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
@ -37,33 +38,11 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool WithTLS
|
public bool IsIPAddress
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var withOutTLSList = new List<XrayType> {
|
return IPAddress.TryParse(Domain, out _);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,7 +722,6 @@ namespace ProxySuper.Core.Services
|
|||||||
throw new Exception("安装 acme.sh 失败,请联系开发者!");
|
throw new Exception("安装 acme.sh 失败,请联系开发者!");
|
||||||
}
|
}
|
||||||
|
|
||||||
RunCmd("cd ~/.acme.sh/");
|
|
||||||
RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
|
RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
|
||||||
|
|
||||||
// 申请证书
|
// 申请证书
|
||||||
|
@ -67,7 +67,7 @@ namespace ProxySuper.Core.Services
|
|||||||
public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
|
public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
|
||||||
{
|
{
|
||||||
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
|
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());
|
caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
|
||||||
|
|
||||||
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
|
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
|
||||||
@ -118,9 +118,6 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
var xrayConfig = LoadXrayConfig();
|
var xrayConfig = LoadXrayConfig();
|
||||||
|
|
||||||
if (parameters.IsFullbackMode)
|
|
||||||
{
|
|
||||||
#region Fullbacks
|
|
||||||
var baseBound = GetBound("VLESS_TCP_XTLS.json");
|
var baseBound = GetBound("VLESS_TCP_XTLS.json");
|
||||||
baseBound.port = parameters.Port;
|
baseBound.port = parameters.Port;
|
||||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||||
@ -130,6 +127,8 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(baseBound);
|
xrayConfig.inbounds.Add(baseBound);
|
||||||
SetClients(baseBound, uuidList, withXtls: true);
|
SetClients(baseBound, uuidList, withXtls: true);
|
||||||
|
|
||||||
|
#region Fullbacks
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VLESS_WS))
|
if (parameters.Types.Contains(XrayType.VLESS_WS))
|
||||||
{
|
{
|
||||||
var wsInbound = GetBound("VLESS_WS.json");
|
var wsInbound = GetBound("VLESS_WS.json");
|
||||||
@ -189,7 +188,6 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VLESS_gRPC))
|
if (parameters.Types.Contains(XrayType.VLESS_gRPC))
|
||||||
{
|
{
|
||||||
@ -211,8 +209,6 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VMESS_KCP))
|
if (parameters.Types.Contains(XrayType.VMESS_KCP))
|
||||||
{
|
{
|
||||||
var kcpBound = GetBound("VMESS_KCP.json");
|
var kcpBound = GetBound("VMESS_KCP.json");
|
||||||
@ -223,7 +219,6 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
||||||
{
|
{
|
||||||
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
||||||
|
@ -68,17 +68,16 @@ namespace ProxySuper.Core.Services
|
|||||||
SyncTimeDiff();
|
SyncTimeDiff();
|
||||||
WriteOutput("时间同步完成");
|
WriteOutput("时间同步完成");
|
||||||
|
|
||||||
if (Parameters.WithTLS)
|
if (!Parameters.IsIPAddress)
|
||||||
{
|
{
|
||||||
WriteOutput("检测域名是否绑定本机IP...");
|
WriteOutput("检测域名是否绑定本机IP...");
|
||||||
ValidateDomain();
|
ValidateDomain();
|
||||||
WriteOutput("域名检测完成");
|
WriteOutput("域名检测完成");
|
||||||
|
}
|
||||||
|
|
||||||
WriteOutput("安装Caddy...");
|
WriteOutput("安装Caddy...");
|
||||||
InstallCaddy();
|
InstallCaddy();
|
||||||
WriteOutput("Caddy安装完成");
|
WriteOutput("Caddy安装完成");
|
||||||
}
|
|
||||||
|
|
||||||
WriteOutput("安装Xray-Core...");
|
WriteOutput("安装Xray-Core...");
|
||||||
InstallXrayWithCert();
|
InstallXrayWithCert();
|
||||||
@ -297,7 +296,7 @@ namespace ProxySuper.Core.Services
|
|||||||
RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
|
RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Parameters.WithTLS)
|
if (!Parameters.IsIPAddress)
|
||||||
{
|
{
|
||||||
WriteOutput("安装TLS证书");
|
WriteOutput("安装TLS证书");
|
||||||
InstallCertToXray();
|
InstallCertToXray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user