1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

release 4.0.1

This commit is contained in:
next-autumn 2021-05-25 18:28:37 +08:00
parent 888e981d41
commit 97ae49c60c
40 changed files with 1245 additions and 174 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -1,48 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProxySU_Core.Properties {
using System;
namespace ProxySU_Core.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 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() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[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;
}
@ -55,14 +51,11 @@ namespace ProxySU_Core.Properties
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[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;
}
}

View File

@ -1,27 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>ProxySU_Core</RootNamespace>
<AssemblyName>ProxySU_Core</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@ -32,6 +32,7 @@
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -74,14 +75,14 @@
<Reference Include="MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.2.4.5\lib\net46\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignColors, Version=2.0.0.2422, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.2.0.0\lib\net452\MaterialDesignColors.dll</HintPath>
<Reference Include="MaterialDesignColors, Version=2.0.1.2556, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.2.0.1\lib\net452\MaterialDesignColors.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignThemes.MahApps, Version=0.1.6.2422, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.MahApps.0.1.6\lib\net452\MaterialDesignThemes.MahApps.dll</HintPath>
<Reference Include="MaterialDesignThemes.MahApps, Version=0.1.7.2556, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.MahApps.0.1.7\lib\net452\MaterialDesignThemes.MahApps.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignThemes.Wpf, Version=4.0.0.2422, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.4.0.0\lib\net452\MaterialDesignThemes.Wpf.dll</HintPath>
<Reference Include="MaterialDesignThemes.Wpf, Version=4.1.0.2556, Culture=neutral, PublicKeyToken=df2a72020bd7962a, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.4.1.0\lib\net452\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.31\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
@ -451,12 +452,12 @@
<Resource Include="ProxySU.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets')" />
<ProjectExtensions />
<Import Project="..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MaterialDesignThemes.4.0.0\build\MaterialDesignThemes.targets'))" />
<Error Condition="!Exists('..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MaterialDesignThemes.4.1.0\build\MaterialDesignThemes.targets'))" />
</Target>
<ProjectExtensions />
</Project>

View File

@ -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();
}
}
}

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ControlzEx" version="5.0.0" targetFramework="net461" />
<package id="MahApps.Metro" version="2.4.5" targetFramework="net461" />
<package id="MaterialDesignColors" version="2.0.0" targetFramework="net461" />
<package id="MaterialDesignThemes" version="4.0.0" targetFramework="net461" />
<package id="MaterialDesignThemes.MahApps" version="0.1.6" targetFramework="net461" />
<package id="ControlzEx" version="5.0.0" targetFramework="net461" requireReinstallation="true" />
<package id="MahApps.Metro" version="2.4.5" targetFramework="net461" requireReinstallation="true" />
<package id="MaterialDesignColors" version="2.0.1" targetFramework="net472" />
<package id="MaterialDesignThemes" version="4.1.0" targetFramework="net472" />
<package id="MaterialDesignThemes.MahApps" version="0.1.7" targetFramework="net472" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.31" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
<package id="QRCoder" version="1.4.1" targetFramework="net461" />

View File

@ -28,5 +28,10 @@ namespace ProxySuper.Core.Services
var serialized = JsonConvert.SerializeObject(obj);
return JsonConvert.DeserializeObject<T>(serialized);
}
public static string GetTickID()
{
return DateTime.Now.Ticks.ToString();
}
}
}

View File

@ -24,5 +24,7 @@ namespace ProxySuper.Core.Models.Projects
public string UserName { get; set; }
public string Password { get; set; }
public string MaskDomain { get; set; }
}
}

View File

@ -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;
}
}
}

View File

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProxySuper.Core</RootNamespace>
<AssemblyName>ProxySuper.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -91,6 +92,10 @@
<Compile Include="Services\XrayConfigBuilder.cs" />
<Compile Include="Services\XrayProject.cs" />
<Compile Include="ViewModels\HomeViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyConfigViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyEditorViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyInstallerViewModel.cs" />
<Compile Include="ViewModels\ShareLinkViewModel.cs" />
<Compile Include="ViewModels\TrojanGoConfigViewModel.cs" />
<Compile Include="ViewModels\TrojanGoEditorViewModel.cs" />
<Compile Include="ViewModels\TrojanGoInstallerViewModel.cs" />

View File

@ -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<NaiveProxySettings>
{
public NaiveProxyProject(SshClient sshClient, NaiveProxySettings parameters, Action<string> 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;
}
}
}

View File

@ -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();

View File

@ -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<Record> records = new List<Record>();
@ -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<string>(DeleteRecord);
public IMvxCommand EditCommand => new MvxAsyncCommand<string>(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<NaiveProxyEditorViewModel, Record, Record>(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<NaiveProxyEditorViewModel, Record, Record>(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<TrojanGoConfigViewModel, TrojanGoSettings>(record.TrojanGoSettings);
}
if (record.Type == ProjectType.NaiveProxy)
{
await _navigationService.Navigate<NaiveProxyConfigViewModel, NaiveProxySettings>(record.NaiveProxySettings);
}
}
public async Task GoToInstall(string id)
@ -172,6 +200,10 @@ namespace ProxySuper.Core.ViewModels
{
await _navigationService.Navigate<TrojanGoInstallerViewModel, Record>(record);
}
if (record.Type == ProjectType.NaiveProxy)
{
await _navigationService.Navigate<NaiveProxyInstallerViewModel, Record>(record);
}
}
}
}

View File

@ -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<NaiveProxySettings>
{
public NaiveProxySettings Settings { get; set; }
public override void Prepare(NaiveProxySettings parameter)
{
Settings = parameter;
}
public string Link
{
get
{
return ShareLink.BuildNaiveProxy(Settings);
}
}
}
}

View File

@ -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<Record, Record>
{
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
});
}
}
}

View File

@ -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<Record>
{
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; }
}
}

View File

@ -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<List<Record>>
{
public List<Record> Records { get; set; }
public override void Prepare(List<Record> parameter)
{
Records = parameter;
}
public string ShareLinks
{
get
{
StringBuilder sb = new StringBuilder();
Records.ForEach(record =>
{
var link = record.GetShareLink();
sb.AppendLine(link);
});
return sb.ToString();
}
}
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View File

@ -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")]

View File

@ -1,48 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProxySuper.WPF.Properties {
using System;
namespace ProxySuper.WPF.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 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() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[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;
}
@ -55,14 +51,11 @@ namespace ProxySuper.WPF.Properties
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[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;
}
}

View File

@ -1,27 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}

BIN
ProxySuper.WPF/ProxySU.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>ProxySuper.WPF</RootNamespace>
<AssemblyName>ProxySuper.WPF</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@ -16,6 +16,22 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -36,6 +52,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ProxySU.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="MvvmCross, Version=7.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.7.1.2\lib\net461\MvvmCross.dll</HintPath>
@ -122,6 +141,18 @@
<Compile Include="Views\HomeView.xaml.cs">
<DependentUpon>HomeView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NaiveProxyConfigView.xaml.cs">
<DependentUpon>NaiveProxyConfigView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NaiveProxyEditorView.xaml.cs">
<DependentUpon>NaiveProxyEditorView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NaiveProxyInstallerView.xaml.cs">
<DependentUpon>NaiveProxyInstallerView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ShareLinkView.xaml.cs">
<DependentUpon>ShareLinkView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\TrojanGoConfigView.xaml.cs">
<DependentUpon>TrojanGoConfigView.xaml</DependentUpon>
</Compile>
@ -192,6 +223,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Languages\tw_cn.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Views\HomeView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -215,6 +251,22 @@
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Views\NaiveProxyConfigView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NaiveProxyEditorView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NaiveProxyInstallerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ShareLinkView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\TrojanGoConfigView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -263,6 +315,9 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Templates\NaiveProxy\naive_server.caddyfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\trojan-go\base.caddyfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@ -395,12 +450,27 @@
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<ItemGroup>
<Resource Include="ProxySU.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets" Condition="Exists('..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets')" />
<Import Project="..\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\System.Runtime.WindowsRuntime.targets" Condition="Exists('..\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\System.Runtime.WindowsRuntime.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets'))" />
<Error Condition="!Exists('..\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\System.Runtime.WindowsRuntime.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\System.Runtime.WindowsRuntime.targets'))" />
</Target>
</Project>

View File

@ -19,6 +19,7 @@
<sys:String x:Key="MainMenuLanguage">Language</sys:String>
<sys:String x:Key="MainMenuLanguageEn">English</sys:String>
<sys:String x:Key="MainMenuLanguageCn">中文</sys:String>
<sys:String x:Key="MainMenuLanguageTw">正體</sys:String>
<sys:String x:Key="MainMenuHelper">Helper</sys:String>
<sys:String x:Key="MainMenuHelperGithub">Github</sys:String>
@ -101,4 +102,11 @@
<sys:String x:Key="TrojanGoMaskDomain">GuiseHost</sys:String>
<sys:String x:Key="TrojanGoWebSocketPath">WS Path</sys:String>
<sys:String x:Key="TrojanGoWebSocketDomain">WS Domain</sys:String>
<!--Naive Proxy-->
<sys:String x:Key="NaiveProxyDomain">Address</sys:String>
<sys:String x:Key="NaiveProxyPort">Port</sys:String>
<sys:String x:Key="NaiveProxyUserName">UserName</sys:String>
<sys:String x:Key="NaiveProxyPassword">Password</sys:String>
<sys:String x:Key="NaiveProxyMaskDomain">GuiseHost</sys:String>
</ResourceDictionary>

View File

@ -0,0 +1,112 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!--common-->
<sys:String x:Key="Random">隨機</sys:String>
<sys:String x:Key="Save">保存</sys:String>
<sys:String x:Key="SaveAs">另存為</sys:String>
<sys:String x:Key="Install">安裝</sys:String>
<sys:String x:Key="Settings">配置</sys:String>
<sys:String x:Key="ReadmeWebsiteDemo">如下是網友提供的靜態網頁連接請自行檢查是否有index.html文件</sys:String>
<!--Main Menu-->
<sys:String x:Key="MainMenuAddHost">添加主機</sys:String>
<sys:String x:Key="MainMenuActions">操作</sys:String>
<sys:String x:Key="MainMenuActionsExportSettings">導出配置</sys:String>
<sys:String x:Key="MainMenuActionsExportSubscribe">導出訂閲</sys:String>
<sys:String x:Key="MainMenuLanguage">語言(Language)</sys:String>
<sys:String x:Key="MainMenuLanguageEn">English</sys:String>
<sys:String x:Key="MainMenuLanguageCn">中文</sys:String>
<sys:String x:Key="MainMenuLanguageTw">正體</sys:String>
<sys:String x:Key="MainMenuHelper">幫助</sys:String>
<sys:String x:Key="MainMenuHelperGithub">Github</sys:String>
<!--Main DataGrid-->
<sys:String x:Key="MainDataGridColumnTag">名稱</sys:String>
<sys:String x:Key="MainDataGridColumnAddress">地址</sys:String>
<sys:String x:Key="MainDataGridColumnType">類型</sys:String>
<sys:String x:Key="MainDataGridColumnAction">操作</sys:String>
<sys:String x:Key="MainDataGridColumnActionInstall">安裝</sys:String>
<sys:String x:Key="MainDataGridColumnActionEdit">編輯</sys:String>
<sys:String x:Key="MainDataGridColumnActionViewConfig">查看配置</sys:String>
<sys:String x:Key="MainDataGridColumnActionDelete">刪除</sys:String>
<!--Editor Window-->
<sys:String x:Key="HostGroupName">主機</sys:String>
<sys:String x:Key="HostTag">名稱</sys:String>
<sys:String x:Key="HostAddress">IP/地址</sys:String>
<sys:String x:Key="HostUserName">用戶名</sys:String>
<sys:String x:Key="HostPassword">密碼</sys:String>
<sys:String x:Key="HostPort">端口</sys:String>
<sys:String x:Key="HostSecretType">登録驗證</sys:String>
<sys:String x:Key="HostUploadSecretKey">上傳Key</sys:String>
<sys:String x:Key="HostSertTypePassword">密碼</sys:String>
<sys:String x:Key="HostSertTypePrivateKey">私鑰</sys:String>
<sys:String x:Key="ProxyGroupName">代理</sys:String>
<sys:String x:Key="ProxyAddress">IP/地址</sys:String>
<sys:String x:Key="ProxyPort">端口</sys:String>
<sys:String x:Key="ProxyUserName">用戶名</sys:String>
<sys:String x:Key="ProxyPassword">密碼</sys:String>
<sys:String x:Key="ProxyType">類型</sys:String>
<sys:String x:Key="ProxyTypeNone">無</sys:String>
<sys:String x:Key="ProxyTypeHttp">Http</sys:String>
<sys:String x:Key="ProxyTypeSocks5">Socks5</sys:String>
<!--Xray-->
<sys:String x:Key="VlessXtlsDesc" xml:space="preserve">VLESS Over TCP With XTLS&#x0a;性能數倍,首選方式。</sys:String>
<sys:String x:Key="VlessTcpDesc" xml:space="preserve">VLESS over TCP with TLS&#x0a;仍推薦XTLS。</sys:String>
<sys:String x:Key="VlessWsDesc" xml:space="preserve">VLESS over WS with TLS&#x0a;推薦支持CDN。</sys:String>
<sys:String x:Key="VlessKcpDesc" xml:space="preserve">VLESS mKCP&#x0a;遊戲推薦,延遲低。</sys:String>
<sys:String x:Key="VmessWsDesc" xml:space="preserve">VMESS over WS with TLS&#x0a;推薦支持CDN。</sys:String>
<sys:String x:Key="VmessKcpDesc" xml:space="preserve">VMESS mKCP&#x0a;遊戲推薦,延遲低。</sys:String>
<sys:String x:Key="SSDesc" xml:space="preserve">ShadowSocks&#x0a;SS支持udp。</sys:String>
<sys:String x:Key="TrojanDesc" xml:space="preserve">Trojan over TCP with TLS&#x0a;Trojan。</sys:String>
<sys:String x:Key="XrayDomain">域名</sys:String>
<sys:String x:Key="XrayMarkDomain">偽裝域名</sys:String>
<sys:String x:Key="XrayUUID">UUID</sys:String>
<sys:String x:Key="VlessWsPath">VLESS WS路徑</sys:String>
<sys:String x:Key="VlessKcpSeed">VLESS KCP Seed</sys:String>
<sys:String x:Key="VlessKcpType">VLESS KCP偽裝</sys:String>
<sys:String x:Key="VlessKcpPort">VLESS KCP端口</sys:String>
<sys:String x:Key="VmessWsPath">VMESS WS路徑</sys:String>
<sys:String x:Key="VmessKcpSeed">VMESS KCP Seed</sys:String>
<sys:String x:Key="VmessKcpType">VMESS KCP偽裝</sys:String>
<sys:String x:Key="VmessKcpPort">VMESS KCP端口</sys:String>
<sys:String x:Key="SSPassword">SS密碼</sys:String>
<sys:String x:Key="SSMethods">SS加密方式</sys:String>
<sys:String x:Key="TrojanPassword">Trojan密碼</sys:String>
<sys:String x:Key="XrayPort">xray端口</sys:String>
<sys:String x:Key="XrayPortDefault">默認端口443不建議修改</sys:String>
<!--xray installer-->
<sys:String x:Key="XrayInstallerInstall">一鍵安裝</sys:String>
<sys:String x:Key="XrayInstallerUpdateSettings">更新配置</sys:String>
<sys:String x:Key="XrayInstallerUpdateCore">更新內核</sys:String>
<sys:String x:Key="XrayInstallerUninstall">卸載代理</sys:String>
<sys:String x:Key="XrayInstallerInstallCert">手動續簽證書</sys:String>
<sys:String x:Key="XrayInstallerUploadWeb">上傳偽裝網站</sys:String>
<sys:String x:Key="XrayInstallerUploadCert">上傳自有證書</sys:String>
<!--Trojan-GO-->
<sys:String x:Key="TrojanGoDomain">域名</sys:String>
<sys:String x:Key="TrojanGoPort">端口</sys:String>
<sys:String x:Key="TrojanGoPassword">密碼</sys:String>
<sys:String x:Key="TrojanGoMaskDomain">偽裝網址</sys:String>
<sys:String x:Key="TrojanGoWebSocketPath">WS 路徑</sys:String>
<sys:String x:Key="TrojanGoWebSocketDomain">WS 域名</sys:String>
<!--Naive Proxy-->
<sys:String x:Key="NaiveProxyDomain">地址</sys:String>
<sys:String x:Key="NaiveProxyPort">端口</sys:String>
<sys:String x:Key="NaiveProxyUserName">用戶名</sys:String>
<sys:String x:Key="NaiveProxyPassword">密碼</sys:String>
<sys:String x:Key="NaiveProxyMaskDomain">偽裝網站</sys:String>
</ResourceDictionary>

View File

@ -14,11 +14,12 @@
<sys:String x:Key="MainMenuAddHost">添加主机</sys:String>
<sys:String x:Key="MainMenuActions">操作</sys:String>
<sys:String x:Key="MainMenuActionsExportSettings">导出配置</sys:String>
<sys:String x:Key="MainMenuActionsExportSubscribe">导出配置</sys:String>
<sys:String x:Key="MainMenuActionsExportSubscribe">导出订阅</sys:String>
<sys:String x:Key="MainMenuLanguage">语言(Language)</sys:String>
<sys:String x:Key="MainMenuLanguageEn">English</sys:String>
<sys:String x:Key="MainMenuLanguageCn">中文</sys:String>
<sys:String x:Key="MainMenuLanguageTw">正體</sys:String>
<sys:String x:Key="MainMenuHelper">帮助</sys:String>
<sys:String x:Key="MainMenuHelperGithub">Github</sys:String>
@ -34,6 +35,7 @@
<sys:String x:Key="MainDataGridColumnActionDelete">删除</sys:String>
<!--Editor Window-->
<sys:String x:Key="HostGroupName">主机</sys:String>
<sys:String x:Key="HostTag">名称</sys:String>
@ -101,4 +103,11 @@
<sys:String x:Key="TrojanGoMaskDomain">伪装网址</sys:String>
<sys:String x:Key="TrojanGoWebSocketPath">WS 路径</sys:String>
<sys:String x:Key="TrojanGoWebSocketDomain">WS 域名</sys:String>
<!--Naive Proxy-->
<sys:String x:Key="NaiveProxyDomain">地址</sys:String>
<sys:String x:Key="NaiveProxyPort">端口</sys:String>
<sys:String x:Key="NaiveProxyUserName">用户名</sys:String>
<sys:String x:Key="NaiveProxyPassword">密码</sys:String>
<sys:String x:Key="NaiveProxyMaskDomain">伪装网站</sys:String>
</ResourceDictionary>

View File

@ -0,0 +1,11 @@
:##port##, ##domain##
route {
forward_proxy {
##basicauth##
hide_ip
hide_via
probe_resistance
}
#file_server { root /usr/share/caddy }
}
##reverse_proxy##

View File

@ -17,16 +17,16 @@
<MenuItem Header="{DynamicResource MainMenuAddHost}" Padding="10,3">
<MenuItem Padding="0,5" Header="Xray" Command="{Binding AddXrayCommand}"></MenuItem>
<MenuItem Padding="0,5" Header="Trojan-Go" Command="{Binding AddTrojanGoCommand}"></MenuItem>
<MenuItem Padding="0,5" Header="NaiveProxy"></MenuItem>
<MenuItem Padding="0,5" Header="NaiveProxy" Command="{Binding AddNaiveProxyCommand}"></MenuItem>
</MenuItem>
<!--<MenuItem Header="{DynamicResource MainMenuActions}" Padding="10,3">
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuActionsExportSettings}"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuActionsExportSubscribe}"></MenuItem>
</MenuItem>-->
<MenuItem Header="{DynamicResource MainMenuActions}" Padding="10,3">
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuActionsExportSettings}" Click="ShowShareLinks"></MenuItem>
</MenuItem>
<MenuItem Header="{DynamicResource MainMenuLanguage}" Padding="10,3">
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageEn}" Click="SetEnglish"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageTw}" Click="SetTwCN"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageCn}" Click="SetSimpleChinese"></MenuItem>
</MenuItem>
@ -48,7 +48,10 @@
<DataGridTemplateColumn Width="40">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox ></CheckBox>
<CheckBox IsChecked="{Binding IsChecked,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged
}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

View File

@ -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<ShareLinkViewModel, List<Record>>(checkedRecords);
}
}
}

View File

@ -0,0 +1,41 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.NaiveProxyConfigView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
mc:Ignorable="d"
Icon="/Resources/ProxySU.ico"
WindowStartupLocation="CenterScreen"
Title="NaiveProxyConfigView" Height="450" Width="800">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="主机(Host)" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Settings.Domain}" IsReadOnly="True" />
<Label Grid.Row="1" Grid.Column="0" Content="端口(Port)" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Settings.Port}" IsReadOnly="True" />
<Label Grid.Row="2" Grid.Column="0" Content="用户名(UserName)" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Settings.Domain}" IsReadOnly="True" />
<Label Grid.Row="3" Grid.Column="0" Content="密码(Password)" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Settings.Password}" IsReadOnly="True" />
<Label Grid.Row="4" Grid.Column="0" Content="链接(ShareLink)" />
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Link, Mode=OneTime}" IsReadOnly="True" />
</Grid>
</views:MvxWindow>

View File

@ -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
{
/// <summary>
/// NaiveProxyConfigView.xaml 的交互逻辑
/// </summary>
public partial class NaiveProxyConfigView : MvxWindow
{
public NaiveProxyConfigView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,68 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.NaiveProxyEditorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
mc:Ignorable="d"
BorderThickness="0,1,0,0"
BorderBrush="#eee"
Icon="/Resources/ProxySU.ico"
WindowStartupLocation="CenterScreen"
Title="NaiveProxy" Height="600" Width="1000">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="310" />
<ColumnDefinition Width="1" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="10">
<ctrl:HostControl />
</StackPanel>
<StackPanel Grid.Column="1" Background="#EEE"></StackPanel>
<StackPanel Grid.Column="2">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<Label Content="{DynamicResource NaiveProxyDomain}" Grid.Row="0" Grid.Column="0" />
<TextBox Text="{Binding Settings.Domain}" Grid.Row="0" Grid.Column="1" />
<Label Content="{DynamicResource NaiveProxyPort}" Grid.Row="1" Grid.Column="0" />
<TextBox Text="{Binding Settings.Port}" Grid.Row="1" Grid.Column="1" />
<Label Content="{DynamicResource NaiveProxyUserName}" Grid.Row="2" Grid.Column="0" />
<TextBox Text="{Binding Settings.UserName}" Grid.Row="2" Grid.Column="1" />
<Label Content="{DynamicResource NaiveProxyPassword}" Grid.Row="3" Grid.Column="0" />
<TextBox Text="{Binding Settings.Password}" Grid.Row="3" Grid.Column="1" />
<Label Content="{DynamicResource NaiveProxyMaskDomain}" Grid.Row="4" Grid.Column="0" />
<TextBox Text="{Binding Settings.MaskDomain}" Grid.Row="4" Grid.Column="1" />
</Grid>
<Border BorderBrush="#eee" BorderThickness="0,1,0,0">
<Button Content="{DynamicResource Save}"
Command="{Binding SaveCommand}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Height="30"
Width="100"
Margin="40,20" />
</Border>
</StackPanel>
</Grid>
</views:MvxWindow>

View File

@ -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
{
/// <summary>
/// NaiveProxyEditorView.xaml 的交互逻辑
/// </summary>
public partial class NaiveProxyEditorView : MvxWindow
{
public NaiveProxyEditorView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,55 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.NaiveProxyInstallerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
Icon="/Resources/ProxySU.ico"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="NaiveProxyInstallerView" Height="450" Width="800">
<StackPanel>
<TextBox IsReadOnly="True"
Block.LineHeight="18"
Background="#000"
Foreground="LawnGreen"
FontSize="14"
FontFamily="Consolas"
x:Name="OutputTextBox"
Height="260"
Padding="10"
BorderThickness="0"
VerticalAlignment="Top"
VerticalContentAlignment="Top"
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Install}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="Install" Content="{DynamicResource XrayInstallerInstall}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="Uninstall" Content="{DynamicResource XrayInstallerUninstall}" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Settings}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UploadWeb" Content="{DynamicResource XrayInstallerUploadWeb}" />
</StackPanel>
<Label Margin="5" Content="{DynamicResource ReadmeWebsiteDemo}" />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10,0,0,0">
<Hyperlink NavigateUri="https://www.themezy.com" Click="OpenLink">Themezy</Hyperlink>
</TextBlock>
<TextBlock Margin="20,0,0,0">
<Hyperlink NavigateUri="https://onepagelove.com/templates/free-templates" Click="OpenLink">One Page Love</Hyperlink>
</TextBlock>
<TextBlock Margin="20,0,0,0">
<Hyperlink NavigateUri="https://html5up.net/" Click="OpenLink">HTML5 UP</Hyperlink>
</TextBlock>
<TextBlock Margin="20,0,0,0">
<Hyperlink NavigateUri="https://templatemo.com/" Click="OpenLink">template mo</Hyperlink>
</TextBlock>
</StackPanel>
</StackPanel>
</views:MvxWindow>

View File

@ -0,0 +1,166 @@
using Microsoft.Win32;
using MvvmCross.Platforms.Wpf.Views;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Services;
using ProxySuper.Core.ViewModels;
using Renci.SshNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
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
{
/// <summary>
/// NaiveProxyInstallerView.xaml 的交互逻辑
/// </summary>
public partial class NaiveProxyInstallerView : MvxWindow
{
public NaiveProxyInstallerView()
{
InitializeComponent();
}
public new NaiveProxyInstallerViewModel ViewModel
{
get
{
return (NaiveProxyInstallerViewModel)base.ViewModel;
}
}
public NaiveProxyProject Project { get; set; }
private SshClient _sshClient;
private void OpenConnect()
{
WriteOutput("正在登陆服务器 ...");
var conneInfo = CreateConnectionInfo(ViewModel.Host);
_sshClient = new SshClient(conneInfo);
try
{
_sshClient.Connect();
}
catch (Exception ex)
{
WriteOutput("登陆失败!");
WriteOutput(ex.Message);
return;
}
WriteOutput("登陆服务器成功!");
ViewModel.Connected = true;
Project = new NaiveProxyProject(_sshClient, ViewModel.Settings, WriteOutput);
}
private void WriteOutput(string outShell)
{
if (!outShell.EndsWith("\n"))
{
outShell += "\n";
}
Dispatcher.Invoke(() =>
{
OutputTextBox.AppendText(outShell);
OutputTextBox.ScrollToEnd();
});
}
private ConnectionInfo CreateConnectionInfo(Host host)
{
AuthenticationMethod auth = null;
if (host.SecretType == LoginSecretType.Password)
{
auth = new PasswordAuthenticationMethod(host.UserName, host.Password);
}
else if (host.SecretType == LoginSecretType.PrivateKey)
{
auth = new PrivateKeyAuthenticationMethod(host.UserName, new PrivateKeyFile(host.PrivateKeyPath));
}
if (host.Proxy.Type == LocalProxyType.None)
{
return new ConnectionInfo(host.Address, host.Port, host.UserName, auth);
}
else
{
return new ConnectionInfo(
host: host.Address,
port: host.Port,
username: host.UserName,
proxyType: (ProxyTypes)(int)host.Proxy.Type,
proxyHost: host.Proxy.Address,
proxyPort: host.Proxy.Port,
proxyUsername: host.Proxy.UserName,
proxyPassword: host.Proxy.Password,
authenticationMethods: auth);
}
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
base.Loaded += (sender, arg) =>
{
Task.Factory.StartNew(OpenConnect);
};
}
private void OpenLink(object sender, RoutedEventArgs e)
{
Hyperlink link = sender as Hyperlink;
Process.Start(new ProcessStartInfo(link.NavigateUri.AbsoluteUri));
}
private void Install(object sender, RoutedEventArgs e)
{
Task.Factory.StartNew(Project.Install);
}
private void Uninstall(object sender, RoutedEventArgs e)
{
var result = MessageBox.Show("您确认要卸载代理吗?", "提示", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
Task.Factory.StartNew(Project.Uninstall);
}
}
private void UploadWeb(object sender, RoutedEventArgs e)
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
Project.UploadWeb(stream);
}
});
}
}
}

View File

@ -0,0 +1,15 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.ShareLinkView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
mc:Ignorable="d"
Icon="/Resources/ProxySU.ico"
WindowStartupLocation="CenterScreen"
Title="ShareLinkView" Height="450" Width="800">
<Grid>
<TextBox IsReadOnly="True" Margin="10" Text="{Binding ShareLinks,Mode=OneTime}" TextWrapping="WrapWithOverflow" Height="400" />
</Grid>
</views:MvxWindow>

View File

@ -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
{
/// <summary>
/// ShareLinkView.xaml 的交互逻辑
/// </summary>
public partial class ShareLinkView : MvxWindow
{
public ShareLinkView()
{
InitializeComponent();
}
}
}

View File

@ -7,6 +7,7 @@
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
mc:Ignorable="d"
Icon="/Resources/ProxySU.ico"
WindowStartupLocation="CenterScreen"
Title="TrojanGoInstallerView" Height="450" Width="800">
<StackPanel>
<TextBox IsReadOnly="True"
@ -24,19 +25,19 @@
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="10" Orientation="Horizontal">
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Install}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="Install" Content="{DynamicResource XrayInstallerInstall}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="Uninstall" Content="{DynamicResource XrayInstallerUninstall}" />
</StackPanel>
<StackPanel Margin="10" Orientation="Horizontal">
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Settings}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="InstallCert" Content="{DynamicResource XrayInstallerInstallCert}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UploadWeb" Content="{DynamicResource XrayInstallerUploadWeb}" />
</StackPanel>
<Label Margin="10" Content="{DynamicResource ReadmeWebsiteDemo}" />
<Label Margin="5" Content="{DynamicResource ReadmeWebsiteDemo}" />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10,0,0,0">
<Hyperlink NavigateUri="https://www.themezy.com" Click="OpenLink">Themezy</Hyperlink>

View File

@ -25,7 +25,7 @@
Text="{Binding Path=OutputText}"
/>
<StackPanel Margin="10" Orientation="Horizontal">
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Install}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="Install" Content="{DynamicResource XrayInstallerInstall}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UpdateXraySettings" Content="{DynamicResource XrayInstallerUpdateSettings}" />
@ -33,14 +33,14 @@
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UninstallXray" Content="{DynamicResource XrayInstallerUninstall}" />
</StackPanel>
<StackPanel Margin="10" Orientation="Horizontal">
<StackPanel Margin="5" Orientation="Horizontal">
<Label Content="{DynamicResource Settings}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="InstallCert" Content="{DynamicResource XrayInstallerInstallCert}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UploadWeb" Content="{DynamicResource XrayInstallerUploadWeb}" />
<Button Height="24" Padding="10,0" Margin="10,0,0,0" IsEnabled="{Binding Connected}" Click="UploadCert" Content="{DynamicResource XrayInstallerUploadCert}" />
</StackPanel>
<Label Margin="10" Content="{DynamicResource ReadmeWebsiteDemo}" />
<Label Margin="5" Content="{DynamicResource ReadmeWebsiteDemo}" />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10,0,0,0">
<Hyperlink NavigateUri="https://www.themezy.com" Click="OpenLink">Themezy</Hyperlink>

View File

@ -5,6 +5,6 @@
<package id="QRCoder" version="1.4.1" targetFramework="net461" />
<package id="SSH.NET" version="2020.0.1" targetFramework="net461" />
<package id="System.Console" version="4.3.1" targetFramework="net461" />
<package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.WindowsRuntime" version="4.7.0" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" requireReinstallation="true" />
</packages>