From 97ae49c60c7e630e0add2df5529d7e2a1c39fb17 Mon Sep 17 00:00:00 2001 From: next-autumn Date: Tue, 25 May 2021 18:28:37 +0800 Subject: [PATCH] release 4.0.1 --- ProxySU_Core/App.config | 4 +- ProxySU_Core/Properties/Resources.Designer.cs | 55 +++--- ProxySU_Core/Properties/Settings.Designer.cs | 29 ++- ProxySU_Core/ProxySU_Core.csproj | 21 +-- .../Views/ClientInfo/ClientInfoWindow.xaml.cs | 87 +++++++++ ProxySU_Core/packages.config | 10 +- ProxySuper.Core/Helpers/Utils.cs | 5 + .../Models/Projects/NaiveProxySettings.cs | 2 + ProxySuper.Core/Models/Record.cs | 54 +++++- ProxySuper.Core/ProxySuper.Core.csproj | 7 +- ProxySuper.Core/Services/NaiveProxyProject.cs | 136 ++++++++++---- ProxySuper.Core/Services/ShareLink.cs | 11 ++ ProxySuper.Core/ViewModels/HomeViewModel.cs | 42 ++++- .../ViewModels/NaiveProxyConfigViewModel.cs | 29 +++ .../ViewModels/NaiveProxyEditorViewModel.cs | 53 ++++++ .../NaiveProxyInstallerViewModel.cs | 44 +++++ .../ViewModels/ShareLinkViewModel.cs | 34 ++++ ProxySuper.WPF/App.config | 6 +- ProxySuper.WPF/Properties/AssemblyInfo.cs | 4 +- .../Properties/Resources.Designer.cs | 55 +++--- .../Properties/Settings.Designer.cs | 29 ++- ProxySuper.WPF/ProxySU.ico | Bin 0 -> 16958 bytes ProxySuper.WPF/ProxySuper.WPF.csproj | 76 +++++++- ProxySuper.WPF/Resources/Languages/en.xaml | 8 + ProxySuper.WPF/Resources/Languages/tw_cn.xaml | 112 ++++++++++++ ProxySuper.WPF/Resources/Languages/zh_cn.xaml | 11 +- .../NaiveProxy/naive_server.caddyfile | 11 ++ ProxySuper.WPF/Views/HomeView.xaml | 15 +- ProxySuper.WPF/Views/HomeView.xaml.cs | 23 +++ .../Views/NaiveProxyConfigView.xaml | 41 +++++ .../Views/NaiveProxyConfigView.xaml.cs | 28 +++ .../Views/NaiveProxyEditorView.xaml | 68 +++++++ .../Views/NaiveProxyEditorView.xaml.cs | 28 +++ .../Views/NaiveProxyInstallerView.xaml | 55 ++++++ .../Views/NaiveProxyInstallerView.xaml.cs | 166 ++++++++++++++++++ ProxySuper.WPF/Views/ShareLinkView.xaml | 15 ++ ProxySuper.WPF/Views/ShareLinkView.xaml.cs | 28 +++ .../Views/TrojanGoInstallerView.xaml | 7 +- ProxySuper.WPF/Views/XrayInstallerView.xaml | 6 +- ProxySuper.WPF/packages.config | 4 +- 40 files changed, 1245 insertions(+), 174 deletions(-) create mode 100644 ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs create mode 100644 ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs create mode 100644 ProxySuper.Core/ViewModels/NaiveProxyInstallerViewModel.cs create mode 100644 ProxySuper.Core/ViewModels/ShareLinkViewModel.cs create mode 100644 ProxySuper.WPF/ProxySU.ico create mode 100644 ProxySuper.WPF/Resources/Languages/tw_cn.xaml create mode 100644 ProxySuper.WPF/Templates/NaiveProxy/naive_server.caddyfile create mode 100644 ProxySuper.WPF/Views/NaiveProxyConfigView.xaml create mode 100644 ProxySuper.WPF/Views/NaiveProxyConfigView.xaml.cs create mode 100644 ProxySuper.WPF/Views/NaiveProxyEditorView.xaml create mode 100644 ProxySuper.WPF/Views/NaiveProxyEditorView.xaml.cs create mode 100644 ProxySuper.WPF/Views/NaiveProxyInstallerView.xaml create mode 100644 ProxySuper.WPF/Views/NaiveProxyInstallerView.xaml.cs create mode 100644 ProxySuper.WPF/Views/ShareLinkView.xaml create mode 100644 ProxySuper.WPF/Views/ShareLinkView.xaml.cs diff --git a/ProxySU_Core/App.config b/ProxySU_Core/App.config index 9626b5e..824190f 100644 --- a/ProxySU_Core/App.config +++ b/ProxySU_Core/App.config @@ -1,7 +1,7 @@  - + @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/ProxySU_Core/Properties/Resources.Designer.cs b/ProxySU_Core/Properties/Resources.Designer.cs index 5d55848..e7f1775 100644 --- a/ProxySU_Core/Properties/Resources.Designer.cs +++ b/ProxySU_Core/Properties/Resources.Designer.cs @@ -1,68 +1,61 @@ //------------------------------------------------------------------------------ // // 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 +// 运行时版本:4.0.30319.42000 // -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ - -namespace ProxySU_Core.Properties -{ +namespace ProxySU_Core.Properties { + using System; + + /// - /// 强类型资源类,用于查找本地化字符串等。 + /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// - /// 返回此类使用的缓存 ResourceManager 实例。 + /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxySU_Core.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// 重写当前线程的 CurrentUICulture 属性,对 /// 使用此强类型资源类的所有资源查找执行重写。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/ProxySU_Core/Properties/Settings.Designer.cs b/ProxySU_Core/Properties/Settings.Designer.cs index e09e8d5..a45c35e 100644 --- a/ProxySU_Core/Properties/Settings.Designer.cs +++ b/ProxySU_Core/Properties/Settings.Designer.cs @@ -1,27 +1,24 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ - -namespace ProxySU_Core.Properties -{ +namespace ProxySU_Core.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj index eae68c3..aeca57f 100644 --- a/ProxySU_Core/ProxySU_Core.csproj +++ b/ProxySU_Core/ProxySU_Core.csproj @@ -8,7 +8,7 @@ WinExe ProxySU_Core ProxySU_Core - v4.6.1 + v4.7.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -32,6 +32,7 @@ false true true + AnyCPU @@ -74,14 +75,14 @@ ..\packages\MahApps.Metro.2.4.5\lib\net46\MahApps.Metro.dll - - ..\packages\MaterialDesignColors.2.0.0\lib\net452\MaterialDesignColors.dll + + ..\packages\MaterialDesignColors.2.0.1\lib\net452\MaterialDesignColors.dll - - ..\packages\MaterialDesignThemes.MahApps.0.1.6\lib\net452\MaterialDesignThemes.MahApps.dll + + ..\packages\MaterialDesignThemes.MahApps.0.1.7\lib\net452\MaterialDesignThemes.MahApps.dll - - ..\packages\MaterialDesignThemes.4.0.0\lib\net452\MaterialDesignThemes.Wpf.dll + + ..\packages\MaterialDesignThemes.4.1.0\lib\net452\MaterialDesignThemes.Wpf.dll ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.31\lib\net45\Microsoft.Xaml.Behaviors.dll @@ -451,12 +452,12 @@ - + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + - \ No newline at end of file diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs index 001c7bd..518fa9f 100644 --- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs +++ b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs @@ -36,5 +36,92 @@ namespace ProxySuper.WPF.Controls Settings = new XraySettingsViewModel(record.Settings); DataContext = this; } + + private void BuildQrCode(object sender, SelectionChangedEventArgs e) + { + var tabControl = e.Source as TabControl; + var item = (tabControl.SelectedItem as TabItem); + if (item == null) return; + var type = (XrayType)item.Tag; + BuildQrCode(type); + } + + private void SaveImage(object sender, RoutedEventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.FileName += QrImage.Tag; + sfd.Filter = "Image Files (*.bmp, *.png, *.jpg)|*.bmp;*.png;*.jpg | All Files | *.*"; + sfd.RestoreDirectory = true;//保存对话框是否记忆上次打开的目录 + if (sfd.ShowDialog() == true) + { + var encoder = new PngBitmapEncoder(); + encoder.Frames.Add(BitmapFrame.Create((BitmapSource)QrImage.Source)); + using (FileStream stream = new FileStream(sfd.FileName, FileMode.Create)) + encoder.Save(stream); + } + } + + private void BuildQrCode(XrayType type) + { + string shareLink = string.Empty; + switch (type) + { + case XrayType.VLESS_TCP_XTLS: + shareLink = Settings.VLESS_TCP_XTLS_ShareLink; + break; + case XrayType.VLESS_TCP: + shareLink = Settings.VLESS_TCP_ShareLink; + break; + case XrayType.VLESS_WS: + shareLink = Settings.VLESS_WS_ShareLink; + break; + case XrayType.VLESS_H2: + break; + case XrayType.VLESS_KCP: + shareLink = Settings.VLESS_KCP_ShareLink; + break; + case XrayType.VLESS_gRPC: + shareLink = Settings.VLESS_gRPC_ShareLink; + break; + case XrayType.VMESS_TCP: + shareLink = Settings.VMESS_TCP_ShareLink; + break; + case XrayType.VMESS_WS: + shareLink = Settings.VMESS_WS_ShareLink; + break; + case XrayType.VMESS_H2: + break; + case XrayType.VMESS_KCP: + shareLink = Settings.VMESS_KCP_ShareLink; + break; + case XrayType.Trojan_TCP: + shareLink = Settings.Trojan_TCP_ShareLink; + break; + case XrayType.Trojan_WS: + break; + case XrayType.ShadowsocksAEAD: + shareLink = Settings.ShadowSocksShareLink; + break; + default: + break; + } + + + QRCodeGenerator qrGenerator = new QRCodeGenerator(); + QRCodeData qrCodeData = qrGenerator.CreateQrCode(shareLink, QRCodeGenerator.ECCLevel.Q); + QRCode qrCode = new QRCode(qrCodeData); + + Bitmap qrCodeImage = qrCode.GetGraphic(20); + MemoryStream ms = new MemoryStream(); + qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); + byte[] bytes = ms.GetBuffer(); + ms.Close(); + BitmapImage image = new BitmapImage(); + image.BeginInit(); + image.StreamSource = new MemoryStream(bytes); + image.EndInit(); + QrImage.Source = image; + QrImage.Tag = type.ToString(); + } } } diff --git a/ProxySU_Core/packages.config b/ProxySU_Core/packages.config index 5b9579c..15ab180 100644 --- a/ProxySU_Core/packages.config +++ b/ProxySU_Core/packages.config @@ -1,10 +1,10 @@  - - - - - + + + + + diff --git a/ProxySuper.Core/Helpers/Utils.cs b/ProxySuper.Core/Helpers/Utils.cs index 764c276..6d5d0ff 100644 --- a/ProxySuper.Core/Helpers/Utils.cs +++ b/ProxySuper.Core/Helpers/Utils.cs @@ -28,5 +28,10 @@ namespace ProxySuper.Core.Services var serialized = JsonConvert.SerializeObject(obj); return JsonConvert.DeserializeObject(serialized); } + + public static string GetTickID() + { + return DateTime.Now.Ticks.ToString(); + } } } diff --git a/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs index 72927e1..76fb1c4 100644 --- a/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs +++ b/ProxySuper.Core/Models/Projects/NaiveProxySettings.cs @@ -24,5 +24,7 @@ namespace ProxySuper.Core.Models.Projects public string UserName { get; set; } public string Password { get; set; } + + public string MaskDomain { get; set; } } } diff --git a/ProxySuper.Core/Models/Record.cs b/ProxySuper.Core/Models/Record.cs index 2480b21..a1feec8 100644 --- a/ProxySuper.Core/Models/Record.cs +++ b/ProxySuper.Core/Models/Record.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using ProxySuper.Core.Models.Hosts; using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; using ProxySuper.Core.ViewModels; using System; using System.Collections.Generic; @@ -19,7 +20,13 @@ namespace ProxySuper.Core.Models [JsonObject] public class Record : MvxViewModel { + public Record() + { + _isChecked = false; + } + private Host _host; + private bool _isChecked; [JsonProperty("id")] public string Id { get; set; } @@ -41,6 +48,9 @@ namespace ProxySuper.Core.Models [JsonProperty("trojanGoSettings")] public TrojanGoSettings TrojanGoSettings { get; set; } + [JsonProperty("naiveProxySettings")] + public NaiveProxySettings NaiveProxySettings { get; set; } + [JsonIgnore] public ProjectType Type @@ -48,10 +58,52 @@ namespace ProxySuper.Core.Models get { if (XraySettings != null) return ProjectType.Xray; - return ProjectType.TrojanGo; + + if (TrojanGoSettings != null) return ProjectType.TrojanGo; + + return ProjectType.NaiveProxy; + } + } + + [JsonIgnore] + public bool IsChecked + { + get + { + return _isChecked; + } + set + { + _isChecked = value; + RaisePropertyChanged("IsChecked"); } } + public string GetShareLink() + { + if (Type == ProjectType.Xray) + { + StringBuilder strBuilder = new StringBuilder(); + XraySettings.Types.ForEach(type => + { + var link = ShareLink.Build(type, XraySettings); + strBuilder.AppendLine(link); + }); + return strBuilder.ToString(); + } + + if (Type == ProjectType.TrojanGo) + { + return ShareLink.BuildTrojanGo(TrojanGoSettings); + } + + if (Type == ProjectType.NaiveProxy) + { + return ShareLink.BuildNaiveProxy(NaiveProxySettings); + } + + return string.Empty; + } } } diff --git a/ProxySuper.Core/ProxySuper.Core.csproj b/ProxySuper.Core/ProxySuper.Core.csproj index ffee9a3..db1bc85 100644 --- a/ProxySuper.Core/ProxySuper.Core.csproj +++ b/ProxySuper.Core/ProxySuper.Core.csproj @@ -9,9 +9,10 @@ Properties ProxySuper.Core ProxySuper.Core - v4.6.1 + v4.7.2 512 true + true @@ -91,6 +92,10 @@ + + + + diff --git a/ProxySuper.Core/Services/NaiveProxyProject.cs b/ProxySuper.Core/Services/NaiveProxyProject.cs index 4d49668..0d25b6b 100644 --- a/ProxySuper.Core/Services/NaiveProxyProject.cs +++ b/ProxySuper.Core/Services/NaiveProxyProject.cs @@ -1,6 +1,10 @@ -using ProxySuper.Core.Models.Projects; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ProxySuper.Core.Models.Projects; +using Renci.SshNet; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,22 +14,39 @@ namespace ProxySuper.Core.Services { public class NaiveProxyProject : ProjectBase { + public NaiveProxyProject(SshClient sshClient, NaiveProxySettings parameters, Action writeOutput) : base(sshClient, parameters, writeOutput) + { + } + + public void Uninstall() + { + UninstallCaddy(); + WriteOutput("ProxyNaive卸载完成"); + } + + public void UploadWeb(Stream stream) + { + EnsureRootAuth(); + EnsureSystemEnv(); + + if (!FileExists("/usr/share/caddy")) + { + RunCmd("mkdir /usr/share/caddy"); + } + RunCmd("rm -rf /usr/share/caddy/*"); + UploadFile(stream, "/usr/share/caddy/caddy.zip"); + RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy"); + RunCmd("chmod -R 777 /usr/share/caddy"); + UploadCaddyFile(useCustomWeb: true); + WriteOutput("************ 上传网站模板完成 ************"); + } + public override void Install() { try { EnsureRootAuth(); - if (FileExists("/usr/local/bin/trojan-go")) - { - var btnResult = MessageBox.Show("已经安装Trojan-Go,是否需要重装?", "提示", MessageBoxButton.YesNo); - if (btnResult == MessageBoxResult.No) - { - MessageBox.Show("安装终止", "提示"); - return; - } - } - WriteOutput("检测安装系统环境..."); EnsureSystemEnv(); WriteOutput("检测安装系统环境完成"); @@ -54,19 +75,13 @@ namespace ProxySuper.Core.Services ValidateDomain(); WriteOutput("域名检测完成"); - WriteOutput("安装Trojan-Go..."); - // InstallTrojanGo(); - WriteOutput("Trojan-Go安装完成"); - - WriteOutput("安装Caddy..."); - InstallCaddy(); - // UploadCaddyFile(); - WriteOutput("Caddy安装完成"); + WriteOutput("安装NaiveProxy..."); + InstallNaiveProxy(); + WriteOutput("NaiveProxy安装完成"); WriteOutput("启动BBR"); EnableBBR(); - RunCmd("systemctl restart trojan-go"); WriteOutput("************"); WriteOutput("安装完成,尽情享用吧......"); WriteOutput("************"); @@ -83,20 +98,75 @@ namespace ProxySuper.Core.Services { WriteOutput("安装 NaiveProxy"); RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash"); - var success = FileExists("/usr/local/bin/trojan-go"); - if (success == false) - { - throw new Exception("trojan-go 安装失败,请联系开发者!"); - } - - RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/trojan-go.service"); - RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/trojan-go.service"); - RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/trojan-go.service"); - RunCmd($"systemctl daemon-reload"); - - RunCmd("systemctl enable trojan-go"); - RunCmd("systemctl start trojan-go"); + UploadCaddyFile(false); + ConfigNetwork(); WriteOutput("NaiveProxy 安装完成"); } + + private void ConfigNetwork() + { + WriteOutput("优化网络参数"); + RunCmd(@"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'"); + RunCmd(@"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'"); + RunCmd(@"sysctl -p"); + WriteOutput("网络参数优化完成"); + } + + private void UploadCaddyFile(bool useCustomWeb = false) + { + var caddyStr = BuildConfig(useCustomWeb); + var stream = new MemoryStream(Encoding.UTF8.GetBytes(caddyStr)); + + if (FileExists("/etc/caddy/Caddyfile")) + { + RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back"); + } + UploadFile(stream, "/etc/caddy/Caddyfile"); + RunCmd("systemctl restart caddy"); + } + + private string BuildConfig(bool useCustomWeb = false) + { + var jsonStr = File.ReadAllText("Templates/NaiveProxy/naive_server.caddyfile"); + jsonStr = jsonStr.Replace("##port##", Parameters.Port.ToString()); + jsonStr = jsonStr.Replace("##domain##", Parameters.Domain); + jsonStr = jsonStr.Replace("##basicauth##", $"basic_auth {Parameters.UserName} {Parameters.Password}"); + + if (!useCustomWeb && !string.IsNullOrEmpty(Parameters.MaskDomain)) + { + var prefix = "http://"; + if (Parameters.MaskDomain.StartsWith("https://")) + { + prefix = "https://"; + } + var domain = Parameters.MaskDomain + .TrimStart("http://".ToCharArray()) + .TrimStart("https://".ToCharArray()); + + jsonStr = jsonStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}"); + } + else + { + jsonStr = jsonStr.Replace("##reverse_proxy##", ""); + jsonStr = jsonStr.Replace("#file_server", "file_server"); + } + return jsonStr; + } } } diff --git a/ProxySuper.Core/Services/ShareLink.cs b/ProxySuper.Core/Services/ShareLink.cs index ce72bf3..d669aaf 100644 --- a/ProxySuper.Core/Services/ShareLink.cs +++ b/ProxySuper.Core/Services/ShareLink.cs @@ -11,6 +11,17 @@ namespace ProxySuper.Core.Services { public class ShareLink { + public static string BuildNaiveProxy(NaiveProxySettings settings) + { + StringBuilder strBuilder = new StringBuilder(); + strBuilder.Append("naive+https://"); + strBuilder.Append($"{settings.UserName}:{settings.Password}"); + strBuilder.Append($"@{settings.Domain}:{settings.Port}"); + strBuilder.Append("?padding=true#naive_proxy"); + + return strBuilder.ToString(); + } + public static string BuildTrojanGo(TrojanGoSettings settings) { StringBuilder strBuilder = new StringBuilder(); diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs index 50c4f73..80c6bff 100644 --- a/ProxySuper.Core/ViewModels/HomeViewModel.cs +++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json.Serialization; using ProxySuper.Core.Models; using ProxySuper.Core.Models.Hosts; using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; using System; using System.Collections.Generic; using System.IO; @@ -27,8 +28,6 @@ namespace ProxySuper.Core.ViewModels ReadRecords(); } - - public void ReadRecords() { List records = new List(); @@ -65,6 +64,8 @@ namespace ProxySuper.Core.ViewModels public IMvxCommand AddTrojanGoCommand => new MvxAsyncCommand(AddTrojanGoRecord); + public IMvxCommand AddNaiveProxyCommand => new MvxAsyncCommand(AddNaiveProxyRecord); + public IMvxCommand RemoveCommand => new MvxAsyncCommand(DeleteRecord); public IMvxCommand EditCommand => new MvxAsyncCommand(EditRecord); @@ -76,7 +77,7 @@ namespace ProxySuper.Core.ViewModels public async Task AddXrayRecord() { Record record = new Record(); - record.Id = Guid.NewGuid().ToString(); + record.Id = Utils.GetTickID(); record.Host = new Host(); record.XraySettings = new XraySettings(); @@ -90,7 +91,7 @@ namespace ProxySuper.Core.ViewModels public async Task AddTrojanGoRecord() { Record record = new Record(); - record.Id = Guid.NewGuid().ToString(); + record.Id = Utils.GetTickID(); record.Host = new Host(); record.TrojanGoSettings = new TrojanGoSettings(); @@ -102,6 +103,22 @@ namespace ProxySuper.Core.ViewModels SaveToJson(); } + public async Task AddNaiveProxyRecord() + { + Record record = new Record(); + record.Id = Utils.GetTickID(); + record.Host = new Host(); + record.NaiveProxySettings = new NaiveProxySettings(); + + var result = await _navigationService.Navigate(record); + if (result == null) return; + + Records.Add(result); + + SaveToJson(); + } + + public async Task EditRecord(string id) { var record = Records.FirstOrDefault(x => x.Id == id); @@ -124,7 +141,14 @@ namespace ProxySuper.Core.ViewModels record.Host = result.Host; record.TrojanGoSettings = result.TrojanGoSettings; } - if (result == null) return; + if (record.Type == ProjectType.NaiveProxy) + { + result = await _navigationService.Navigate(record); + if (result == null) return; + + record.Host = result.Host; + record.NaiveProxySettings = result.NaiveProxySettings; + } SaveToJson(); } @@ -157,6 +181,10 @@ namespace ProxySuper.Core.ViewModels { await _navigationService.Navigate(record.TrojanGoSettings); } + if (record.Type == ProjectType.NaiveProxy) + { + await _navigationService.Navigate(record.NaiveProxySettings); + } } public async Task GoToInstall(string id) @@ -172,6 +200,10 @@ namespace ProxySuper.Core.ViewModels { await _navigationService.Navigate(record); } + if (record.Type == ProjectType.NaiveProxy) + { + await _navigationService.Navigate(record); + } } } } diff --git a/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs new file mode 100644 index 0000000..ca22cd0 --- /dev/null +++ b/ProxySuper.Core/ViewModels/NaiveProxyConfigViewModel.cs @@ -0,0 +1,29 @@ +using MvvmCross.ViewModels; +using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.ViewModels +{ + public class NaiveProxyConfigViewModel : MvxViewModel + { + public NaiveProxySettings Settings { get; set; } + + public override void Prepare(NaiveProxySettings parameter) + { + Settings = parameter; + } + + public string Link + { + get + { + return ShareLink.BuildNaiveProxy(Settings); + } + } + } +} diff --git a/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs new file mode 100644 index 0000000..442d1b6 --- /dev/null +++ b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs @@ -0,0 +1,53 @@ +using MvvmCross.Commands; +using MvvmCross.Navigation; +using MvvmCross.ViewModels; +using ProxySuper.Core.Models; +using ProxySuper.Core.Models.Hosts; +using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.ViewModels +{ + public class NaiveProxyEditorViewModel : MvxViewModel + { + public NaiveProxyEditorViewModel(IMvxNavigationService navigationService) + { + NavigationService = navigationService; + } + + public IMvxNavigationService NavigationService { get; } + + public string Id { get; set; } + + public Host Host { get; set; } + + public NaiveProxySettings Settings { get; set; } + + public override void Prepare(Record parameter) + { + var record = Utils.DeepClone(parameter); + + Id = record.Id; + Host = record.Host; + Settings = record.NaiveProxySettings; + } + + + public IMvxCommand SaveCommand => new MvxCommand(Save); + + private void Save() + { + NavigationService.Close(this, new Record + { + Id = Id, + Host = Host, + NaiveProxySettings = Settings + }); + } + } +} diff --git a/ProxySuper.Core/ViewModels/NaiveProxyInstallerViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyInstallerViewModel.cs new file mode 100644 index 0000000..e21e425 --- /dev/null +++ b/ProxySuper.Core/ViewModels/NaiveProxyInstallerViewModel.cs @@ -0,0 +1,44 @@ +using MvvmCross.ViewModels; +using ProxySuper.Core.Models; +using ProxySuper.Core.Models.Hosts; +using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.ViewModels +{ + public class NaiveProxyInstallerViewModel : MvxViewModel + { + public Host Host { get; set; } + + public NaiveProxySettings Settings { get; set; } + + public override void Prepare(Record parameter) + { + var record = Utils.DeepClone(parameter); + Host = record.Host; + Settings = record.NaiveProxySettings; + } + + private bool _connected; + public bool Connected + { + get + { + return _connected; + } + set + { + _connected = value; + RaisePropertyChanged("Connected"); + } + } + + public string CommandText { get; set; } + + } +} diff --git a/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs b/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs new file mode 100644 index 0000000..d9d79b0 --- /dev/null +++ b/ProxySuper.Core/ViewModels/ShareLinkViewModel.cs @@ -0,0 +1,34 @@ +using MvvmCross.ViewModels; +using ProxySuper.Core.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.ViewModels +{ + public class ShareLinkViewModel : MvxViewModel> + { + public List Records { get; set; } + + public override void Prepare(List parameter) + { + Records = parameter; + } + + public string ShareLinks + { + get + { + StringBuilder sb = new StringBuilder(); + Records.ForEach(record => + { + var link = record.GetShareLink(); + sb.AppendLine(link); + }); + return sb.ToString(); + } + } + } +} diff --git a/ProxySuper.WPF/App.config b/ProxySuper.WPF/App.config index 731f6de..ecdcf8a 100644 --- a/ProxySuper.WPF/App.config +++ b/ProxySuper.WPF/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/ProxySuper.WPF/Properties/AssemblyInfo.cs b/ProxySuper.WPF/Properties/AssemblyInfo.cs index 1894aa9..945398a 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("4.0.1.0")] +[assembly: AssemblyFileVersion("4.0.1.0")] diff --git a/ProxySuper.WPF/Properties/Resources.Designer.cs b/ProxySuper.WPF/Properties/Resources.Designer.cs index 8dede1c..e60c15c 100644 --- a/ProxySuper.WPF/Properties/Resources.Designer.cs +++ b/ProxySuper.WPF/Properties/Resources.Designer.cs @@ -1,68 +1,61 @@ //------------------------------------------------------------------------------ // // 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 +// 运行时版本:4.0.30319.42000 // -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ - -namespace ProxySuper.WPF.Properties -{ +namespace ProxySuper.WPF.Properties { + using System; + + /// - /// 强类型资源类,用于查找本地化字符串等。 + /// 一个强类型的资源类,用于查找本地化的字符串等。 /// // 此类是由 StronglyTypedResourceBuilder // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// - /// 返回此类使用的缓存 ResourceManager 实例。 + /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxySuper.WPF.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// 重写当前线程的 CurrentUICulture 属性,对 /// 使用此强类型资源类的所有资源查找执行重写。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/ProxySuper.WPF/Properties/Settings.Designer.cs b/ProxySuper.WPF/Properties/Settings.Designer.cs index df66621..1b2e07c 100644 --- a/ProxySuper.WPF/Properties/Settings.Designer.cs +++ b/ProxySuper.WPF/Properties/Settings.Designer.cs @@ -1,27 +1,24 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ - -namespace ProxySuper.WPF.Properties -{ +namespace ProxySuper.WPF.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/ProxySuper.WPF/ProxySU.ico b/ProxySuper.WPF/ProxySU.ico new file mode 100644 index 0000000000000000000000000000000000000000..9d7a128c59c121d3e72c9d81575b05bde4971b2c GIT binary patch literal 16958 zcmeI3cZd{87r^H@@cug$Gw6C4PZ87;b6Nu!K~#*$f&u+QF=1A8F<`=+bIxMUaTRk~ z^O@J2vl!M?SHCw~{q^+pj2mWFclUcsZB18Kzk2z-s+sn9e$#)Ekskg3FVEjKJ)WE% zkLPdQ^pGc7H^v1by;Wo^0Om?CjyuFCOSI;zUM)K6XFQ zOq1i%a-2`9-r&{BjrudWGNVCvV*{G;*l;rc{rh)C`}XZyIG0H(?pXNO4^h*G4dUbD zRoAXv)zYO)Rj*#X)WU@e)uKg3I0?p<1zGg**#R+W!6f z)u&IN5{*MoH1&K^o=NgtXfyEj>sNL7@L`e1k|j&jh7B9k+qZ9(;b-Q|nd;uXduF;{ z|LWB%HDksMwQ18P_5S^P>pu2%?bp<;xefY}qn(>JrXh7}GSIwU$ebLLFI7>JDU z4Fkvty&8bW&6_uyOX;6Hd7{>=S>rQiF0h}ICr^qU1c|$5|85@pDLu9^efo4u{}6$` z?fkD=waUlenM3?=+5_VN&*KN@&Ye?7j~?|7`u~5Shx`rFe_q%|@aajDCP^HyF9Q7w z7A&xaun)!z@EM;E20V}M?eW(!|EKXzd`73}*iDD0PMz|Jf#}-Fzg<2KzT|S(u3eH# z>~`cfFSW*?|Hh3Q5~GQ4FJHcNU7B2IkB3Zh@=wkT({Rr8?!%a$D10T$?=mXPxgynW^H&y zF4R8M2yV1G^-p}KjtB-yw(Vi+|Geh~~-uU_pVzkU1mDe`vi;Puji=s@7%d#N9+0-zd3#Sw7PKN zg6sWo4^r1U*TyDq-@YAiX*c^PChpuxx#orA$B(PamoJ;kfIYeI>C>lvwNt%nsQP0=`UWtRq7C9J*jg1xG zz(3sDty{Ou)SuEne*9SN*s(+GnfQ#)lc&rWc1_Fz$cy+3@jp;IaNvN*^`|fs=0!Q< zLGLtdqgAU`a`r+LsgF+Jwz8= zvv=6GZJX2wpshkj$mWd+1OKo0tJ+FAMSi^!h{Jjm-&1S1f19B z&YfH3&!1nlZQEAG*=jR#9OK|HXBzN@Z6Q~DoN@Ls$cQoK!tch78`Y>$qvV=#YKfEr zaRgj6&Y^+<^*ww+54p&$Kl2=8b?ep@eAGTsQBkUB(V{+Qe((VfY?(F5>0I06IyE3V zVZ3kOzN%TXW-5F3?5cnN{xZh6y+$_cC$)#(3Kc2{&XFTW27R2l(8$^};-M3mQ?6V& zl{s@}In$@MAzpLtX@EK1yLT5H$fjn^nqm{=76a^ejqV2w7$CByHq4nbr_Z>VpOSvi zpg}@Q_3G7Kb!x{=-Ddc&Ql*ODcTe!vxN&2lkvhi6qd|iPKDap}D^;qLg=_5CvG!$D zoc0;RKXC^D7j=+XziHE^J~(|4B;kT{ID@lVwQ8zgzkYH?<#t{{jZO|U^Xu2IFLf)l z(b#VdA3j{}6Ym+TRH>3QKHGu4vB86l+wb$;pW(kojT+WHVrZd4h2*)?rAu4mcDzab z44=doXn_vw0pDXCY%fmh!q7(Fu3bBYt)NpwW66>w#m~__`*q?(!-frI?}LpG9z58O zte!o4%9@dpk^JqElh1(z2g-c>DimjZ@I?NDfBX`_K8Fn(rgG)VCH~vH zcW>Flakj>OjqkUqPpL_wqoWn~*|VDO{P_L~8D`6tO=LmdvY+7+yOB|uGG!!A6e&_f z6)afLsx6_ZR;^k>6S6h(hc@_P_u58I0KFLA$Gmb!O zL$hgd+J>N;eK7mfV#SK75+zDlIc)FVy&@}Y#^@B=gQnWGYx~dyPHYC*hU$Fd{{8#1 z7VDAc?0_#;tXNU*bKa5?AZJkL5X-4?48Rj-9IQWj^l0IieIGt(KMOPSiLLCBLj|l~ zzI=IEpZ$OnsA-@rCAGg3r}G*bIL9L|@ZCTdARe697rsrbYT2@-_%dfurncn##R;6V zz(3zxgd31U7y#b+4%n(8;m56E>%=s4fsGLxsFCW`tCuLh4+HI?Knd^i`v-iuMT-^^ zpH2R9lY<#!PW$%lef%{P1f?<#c;9K(#Kzd~T)cQu&KtXQ>7tr6X(Bm?*h=o9=Ee@p zxw?5ajrQ>Vzal&U6UfE108`THFuX^lRpLWHH@ruL08d&)A@2%l;=}s;*I!gP^843> z-@tkc{9lyNFp*{d{d0!?{duZQZe+uD@CV6z*lcy zU2f|Muf5lqZ+rVcOdsRD{@wJ^-s|6-y?6Nk{}U?#r~J%yj2D3=@7vz%KTL1*Wb|hA MX!L67IYICL0XR=#Gynhq literal 0 HcmV?d00001 diff --git a/ProxySuper.WPF/ProxySuper.WPF.csproj b/ProxySuper.WPF/ProxySuper.WPF.csproj index b3456fe..de7f3a5 100644 --- a/ProxySuper.WPF/ProxySuper.WPF.csproj +++ b/ProxySuper.WPF/ProxySuper.WPF.csproj @@ -8,7 +8,7 @@ WinExe ProxySuper.WPF ProxySuper.WPF - v4.6.1 + v4.7.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -16,6 +16,22 @@ true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + AnyCPU @@ -36,6 +52,9 @@ prompt 4 + + ProxySU.ico + ..\packages\MvvmCross.7.1.2\lib\net461\MvvmCross.dll @@ -122,6 +141,18 @@ HomeView.xaml + + NaiveProxyConfigView.xaml + + + NaiveProxyEditorView.xaml + + + NaiveProxyInstallerView.xaml + + + ShareLinkView.xaml + TrojanGoConfigView.xaml @@ -192,6 +223,11 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + PreserveNewest + Designer MSBuild:Compile @@ -215,6 +251,22 @@ MSBuild:Compile PreserveNewest + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -263,6 +315,9 @@ SettingsSingleFileGenerator Settings.Designer.cs + + PreserveNewest + PreserveNewest @@ -395,12 +450,27 @@ + + + + + + False + Microsoft .NET Framework 4.6.1 %28x86 和 x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + - + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + \ No newline at end of file diff --git a/ProxySuper.WPF/Resources/Languages/en.xaml b/ProxySuper.WPF/Resources/Languages/en.xaml index b433a4e..b3aed44 100644 --- a/ProxySuper.WPF/Resources/Languages/en.xaml +++ b/ProxySuper.WPF/Resources/Languages/en.xaml @@ -19,6 +19,7 @@ Language English 中文 + 正體 Helper Github @@ -101,4 +102,11 @@ GuiseHost WS Path WS Domain + + + Address + Port + UserName + Password + GuiseHost \ No newline at end of file diff --git a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml new file mode 100644 index 0000000..fa1569c --- /dev/null +++ b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml @@ -0,0 +1,112 @@ + + + + 隨機 + 保存 + 另存為 + 安裝 + 配置 + 如下是網友提供的靜態網頁連接,請自行檢查是否有index.html文件 + + + 添加主機 + 操作 + 導出配置 + 導出訂閲 + + 語言(Language) + English + 中文 + 正體 + 幫助 + Github + + + + 名稱 + 地址 + 類型 + 操作 + 安裝 + 編輯 + 查看配置 + 刪除 + + + + 主機 + 名稱 + IP/地址 + 用戶名 + 密碼 + 端口 + 登録驗證 + 上傳Key + 密碼 + 私鑰 + + 代理 + IP/地址 + 端口 + 用戶名 + 密碼 + 類型 + + Http + Socks5 + + + VLESS Over TCP With XTLS 性能數倍,首選方式。 + VLESS over TCP with TLS 仍推薦XTLS。 + VLESS over WS with TLS 推薦,支持CDN。 + VLESS mKCP 遊戲推薦,延遲低。 + VMESS over WS with TLS 推薦,支持CDN。 + VMESS mKCP 遊戲推薦,延遲低。 + ShadowSocks SS,支持udp。 + Trojan over TCP with TLS Trojan。 + + + 域名 + 偽裝域名 + UUID + VLESS WS路徑 + VLESS KCP Seed + VLESS KCP偽裝 + VLESS KCP端口 + VMESS WS路徑 + VMESS KCP Seed + VMESS KCP偽裝 + VMESS KCP端口 + SS密碼 + SS加密方式 + Trojan密碼 + xray端口 + 默認端口443,不建議修改 + + + 一鍵安裝 + 更新配置 + 更新內核 + 卸載代理 + 手動續簽證書 + 上傳偽裝網站 + 上傳自有證書 + + + + 域名 + 端口 + 密碼 + 偽裝網址 + WS 路徑 + WS 域名 + + + 地址 + 端口 + 用戶名 + 密碼 + 偽裝網站 + \ No newline at end of file diff --git a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml index 81b4201..8faa65e 100644 --- a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml +++ b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml @@ -14,11 +14,12 @@ 添加主机 操作 导出配置 - 导出配置 + 导出订阅 语言(Language) English 中文 + 正體 帮助 Github @@ -34,6 +35,7 @@ 删除 + 主机 名称 @@ -101,4 +103,11 @@ 伪装网址 WS 路径 WS 域名 + + + 地址 + 端口 + 用户名 + 密码 + 伪装网站 \ No newline at end of file diff --git a/ProxySuper.WPF/Templates/NaiveProxy/naive_server.caddyfile b/ProxySuper.WPF/Templates/NaiveProxy/naive_server.caddyfile new file mode 100644 index 0000000..61b5a69 --- /dev/null +++ b/ProxySuper.WPF/Templates/NaiveProxy/naive_server.caddyfile @@ -0,0 +1,11 @@ +:##port##, ##domain## +route { + forward_proxy { + ##basicauth## + hide_ip + hide_via + probe_resistance + } + #file_server { root /usr/share/caddy } +} +##reverse_proxy## \ No newline at end of file diff --git a/ProxySuper.WPF/Views/HomeView.xaml b/ProxySuper.WPF/Views/HomeView.xaml index 7c1578d..95f8377 100644 --- a/ProxySuper.WPF/Views/HomeView.xaml +++ b/ProxySuper.WPF/Views/HomeView.xaml @@ -17,16 +17,16 @@ - + - + + + + @@ -48,7 +48,10 @@ - + diff --git a/ProxySuper.WPF/Views/HomeView.xaml.cs b/ProxySuper.WPF/Views/HomeView.xaml.cs index e2ae53f..d8b839f 100644 --- a/ProxySuper.WPF/Views/HomeView.xaml.cs +++ b/ProxySuper.WPF/Views/HomeView.xaml.cs @@ -4,6 +4,9 @@ using MvvmCross.Platforms.Wpf.Views; using ProxySuper.Core.Models; using ProxySuper.Core.ViewModels; using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Windows; namespace ProxySuper.WPF.Views @@ -57,5 +60,25 @@ namespace ProxySuper.WPF.Views resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative); Application.Current.Resources.MergedDictionaries[0] = resource; } + + private void SetTwCN(object sender, RoutedEventArgs e) + { + resource.Source = new Uri(@"Resources\Languages\tw_cn.xaml", UriKind.Relative); + Application.Current.Resources.MergedDictionaries[0] = resource; + } + + + + private void ShowShareLinks(object sender, RoutedEventArgs e) + { + var checkedRecords = ViewModel.Records.Where(x => x.IsChecked).ToList(); + if (checkedRecords.Count == 0) + { + MessageBox.Show("您没有选择任何主机"); + return; + } + + NavigationService.Navigate>(checkedRecords); + } } } diff --git a/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml b/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml new file mode 100644 index 0000000..ed4d12f --- /dev/null +++ b/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml.cs b/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml.cs new file mode 100644 index 0000000..5ee9403 --- /dev/null +++ b/ProxySuper.WPF/Views/NaiveProxyConfigView.xaml.cs @@ -0,0 +1,28 @@ +using MvvmCross.Platforms.Wpf.Views; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +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.Shapes; + +namespace ProxySuper.WPF.Views +{ + /// + /// NaiveProxyConfigView.xaml 的交互逻辑 + /// + public partial class NaiveProxyConfigView : MvxWindow + { + public NaiveProxyConfigView() + { + InitializeComponent(); + } + } +} diff --git a/ProxySuper.WPF/Views/NaiveProxyEditorView.xaml b/ProxySuper.WPF/Views/NaiveProxyEditorView.xaml new file mode 100644 index 0000000..d62781a --- /dev/null +++ b/ProxySuper.WPF/Views/NaiveProxyEditorView.xaml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +