diff --git a/ProxySuper.Core/Models/Projects/XraySettings.cs b/ProxySuper.Core/Models/Projects/XraySettings.cs index 3aa5ed0..4a55620 100644 --- a/ProxySuper.Core/Models/Projects/XraySettings.cs +++ b/ProxySuper.Core/Models/Projects/XraySettings.cs @@ -42,13 +42,28 @@ namespace ProxySuper.Core.Models.Projects { get { - return new List + var list = new List(); + if (Types.Contains(XrayType.VLESS_KCP)) { - VLESS_KCP_Port, - VMESS_KCP_Port, - ShadowSocksPort, - VLESS_gRPC_Port, - }; + list.Add(VLESS_KCP_Port); + } + + if (Types.Contains(XrayType.VMESS_KCP)) + { + list.Add(VMESS_KCP_Port); + } + + if (Types.Contains(XrayType.ShadowsocksAEAD)) + { + list.Add(ShadowSocksPort); + } + + if (Types.Contains(XrayType.VLESS_gRPC)) + { + list.Add(VLESS_gRPC_Port); + } + + return list; } } diff --git a/ProxySuper.Core/Services/XrayConfigBuilder.cs b/ProxySuper.Core/Services/XrayConfigBuilder.cs index 1f4759d..f46cbdb 100644 --- a/ProxySuper.Core/Services/XrayConfigBuilder.cs +++ b/ProxySuper.Core/Services/XrayConfigBuilder.cs @@ -28,8 +28,6 @@ namespace ProxySuper.Core.Services public static int VLESS_TCP_Port = 1110; public static int VLESS_WS_Port = 1111; public static int VLESS_H2_Port = 1112; - public static int VLESS_mKCP_Port = 1113; - public static int VLESS_gRPC_Port = 1114; public static int VMESS_TCP_Port = 1210; public static int VMESS_WS_Port = 1211; @@ -127,7 +125,7 @@ namespace ProxySuper.Core.Services if (parameters.Types.Contains(XrayType.VLESS_gRPC)) { var gRPCInBound = GetBound("VLESS_gRPC.json"); - gRPCInBound.port = VLESS_gRPC_Port; + gRPCInBound.port = parameters.VLESS_gRPC_Port; gRPCInBound.settings.clients[0].id = parameters.UUID; gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName; gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain; diff --git a/ProxySuper.Core/Services/XrayProject.cs b/ProxySuper.Core/Services/XrayProject.cs index a079ca6..b4fceb7 100644 --- a/ProxySuper.Core/Services/XrayProject.cs +++ b/ProxySuper.Core/Services/XrayProject.cs @@ -113,7 +113,7 @@ namespace ProxySuper.Core.Services WriteOutput("卸载证书"); UninstallAcme(); WriteOutput("关闭端口"); - ClosePort(Parameters.ShadowSocksPort, Parameters.VMESS_KCP_Port); + ClosePort(Parameters.FreePorts.ToArray()); WriteOutput("************ 卸载完成 ************"); } @@ -137,12 +137,13 @@ namespace ProxySuper.Core.Services { EnsureRootAuth(); EnsureSystemEnv(); + ConfigurePort(); ConfigureFirewall(); var configJson = XrayConfigBuilder.BuildXrayConfig(Parameters); var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson)); RunCmd("rm -rf /usr/local/etc/xray/config.json"); UploadFile(stream, "/usr/local/etc/xray/config.json"); - ConfigurePort(); + UploadCaddyFile(string.IsNullOrEmpty(Parameters.MaskDomain)); RunCmd("systemctl restart xray"); WriteOutput("************ 更新Xray配置成功,更新配置不包含域名,如果域名更换请重新安装。 ************"); diff --git a/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs index 3420b36..f064dca 100644 --- a/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs +++ b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs @@ -56,6 +56,14 @@ namespace ProxySuper.Core.ViewModels } } + public bool Checked_VLESS_gRPC + { + get + { + return Settings.Types.Contains(XrayType.VLESS_gRPC); + } + } + public bool Checked_VMESS_TCP { get diff --git a/ProxySuper.WPF/Resources/Languages/en.xaml b/ProxySuper.WPF/Resources/Languages/en.xaml index 68c1ea0..29551b7 100644 --- a/ProxySuper.WPF/Resources/Languages/en.xaml +++ b/ProxySuper.WPF/Resources/Languages/en.xaml @@ -15,6 +15,7 @@ Actions Export Settings Export Subscribe + Get Root Language English diff --git a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml index 414fe65..5d67a04 100644 --- a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml +++ b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml @@ -15,6 +15,7 @@ 操作 導出配置 導出訂閲 + 啓用Root賬戶 語言(Language) English diff --git a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml index 4ef5155..c375f65 100644 --- a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml +++ b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml @@ -15,6 +15,7 @@ 操作 导出配置 导出订阅 + 启用Root账户 语言(Language) English diff --git a/ProxySuper.WPF/Views/XrayConfigView.xaml b/ProxySuper.WPF/Views/XrayConfigView.xaml index b594416..6b4f765 100644 --- a/ProxySuper.WPF/Views/XrayConfigView.xaml +++ b/ProxySuper.WPF/Views/XrayConfigView.xaml @@ -51,9 +51,9 @@ -