diff --git a/7z/7z.exe b/7z/7z.exe
deleted file mode 100644
index 3a8ee47..0000000
Binary files a/7z/7z.exe and /dev/null differ
diff --git a/7z/readme.md b/7z/readme.md
deleted file mode 100644
index 892f500..0000000
--- a/7z/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-这个7z.exe文件,只是为了生成Release.zip方便。可有可无。ProxySU并不调用。
\ No newline at end of file
diff --git a/ProxySU.sln b/ProxySU.sln
index b6c6063..78ce6b6 100644
--- a/ProxySU.sln
+++ b/ProxySU.sln
@@ -3,15 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySU", "ProxySU\ProxySU.csproj", "{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySU_Core", "ProxySU_Core\ProxySU_Core.csproj", "{B066015C-D347-4493-92F1-6556D3863996}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{18714411-764D-47E5-AFE6-A96200B7CE41}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- EndProjectSection
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{CE908112-DB46-4B91-8236-9139A19D66E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySuper.WPF", "ProxySuper.WPF\ProxySuper.WPF.csproj", "{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}"
@@ -24,14 +15,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.Build.0 = Release|Any CPU
- {B066015C-D347-4493-92F1-6556D3863996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B066015C-D347-4493-92F1-6556D3863996}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B066015C-D347-4493-92F1-6556D3863996}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B066015C-D347-4493-92F1-6556D3863996}.Release|Any CPU.Build.0 = Release|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/ProxySU/App.xaml b/ProxySU/App.xaml
deleted file mode 100644
index 4a9db0e..0000000
--- a/ProxySU/App.xaml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/App.xaml.cs b/ProxySU/App.xaml.cs
deleted file mode 100644
index 6ed5114..0000000
--- a/ProxySU/App.xaml.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace ProxySU
-{
- ///
- /// App.xaml 的交互逻辑
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/ProxySU/ClassModel.cs b/ProxySU/ClassModel.cs
deleted file mode 100644
index 4bea9a7..0000000
--- a/ProxySU/ClassModel.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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.Navigation;
-using System.Windows.Shapes;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.ComponentModel;
-using System.Net.Sockets;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-using Microsoft.Win32;
-using System.Security;
-
-namespace ProxySU
-{
- class ClassModel
- {
- //检测域名是否为空
- public static bool TestDomainIsEmpty(string domainStr)
- {
- domainStr = domainStr.Trim();
- if (string.IsNullOrEmpty(domainStr) == true)
- {
- //****** "域名不能为空,请检查相关参数设置!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- return false;
- }
- else
- {
- return true;
- }
- }
- //伪装网站预处理
- public static bool PreDomainMask(string uri)
- {
- uri = uri.Trim();
- if (String.IsNullOrEmpty(uri) == false)
- {
- if (uri.Contains("/") == true)
- {
- //MessageBox.Show("伪装网址输入格式错误!请重新输入!");
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_MaskSitesToolTip").ToString());
- return false;
- }
- }
- return true;
- }
- //伪装网址的处理
- public static string DisguiseURLprocessing(string fakeUrl)
- {
- fakeUrl = fakeUrl.Trim();
- return fakeUrl;
- //处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // var uri = new Uri(fakeUrl);
- // return uri.Host;
- // }
-
- //}
-
- }
- }
-}
diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml
deleted file mode 100644
index 9a26b7b..0000000
--- a/ProxySU/MainWindow.xaml
+++ /dev/null
@@ -1,849 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs
deleted file mode 100644
index 7350959..0000000
--- a/ProxySU/MainWindow.xaml.cs
+++ /dev/null
@@ -1,10528 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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.Navigation;
-using System.Windows.Shapes;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.ComponentModel;
-using System.Net.Sockets;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-using Microsoft.Win32;
-using System.Security;
-
-namespace ProxySU
-{
- class NatDns64
- {
- private string ipaddr { set; get; } //Dns64网关地址
- private int avg { set; get; } //ping的平均值
-
- public NatDns64(string IpAddr, int Avg)
- {
- this.ipaddr = IpAddr;
- this.avg = Avg;
- }
-
- public string IpAddr
- {
- get { return ipaddr; }
- set { this.ipaddr = IpAddr; }
- }
-
- public int Avg
- {
- get { return avg; }
- set { this.avg = Avg; }
- }
- }
- ///
- /// MainWindow.xaml 的交互逻辑
- ///
- public partial class MainWindow : Window
- {
- //多语言参数
- public class LanguageInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
- public static string[] ReceiveConfigurationParameters { get; set; }
-
- //ReceiveConfigurationParameters[0]----模板类型
- //ReceiveConfigurationParameters[1]----服务端口
- //ReceiveConfigurationParameters[2]----V2Ray uuid/(naive/Trojan-go/Trojan/SSR/SS)' Password
- //ReceiveConfigurationParameters[3]----QUIC加密方式/SSR 加密方法/SS 加密方式/naive'user/VLESS ws Path/trojan-go mux concurrency
- //ReceiveConfigurationParameters[4]----Domain
- //ReceiveConfigurationParameters[5]----伪装类型/插件名称/trojan-go mux idle_timeout
- //ReceiveConfigurationParameters[6]----V2Ray&Trojan-go&SS--Websocket'Path/http2'Path/QUIC密钥/mKCP Seed/VMESS ws Path
- //ReceiveConfigurationParameters[7]----伪装网站
- //ReceiveConfigurationParameters[8]----方案名称
- //ReceiveConfigurationParameters[9]----插件参数选项/VMESS tcp Path/MTProto Parameters/trojan-go是否启用Mux(true)
- //public static ConnectionInfo ConnectionInfo;
-
- public static string proxyType = "V2Ray"; //代理类型标识: V2Ray\TrojanGo\Trojan\NaiveProxy
- public static readonly string pwdir = AppDomain.CurrentDomain.BaseDirectory; //执行文件所在目录
- public static bool mKCPvlessIsSet = false; //mKCP是否使用VLESS协议
- static bool testDomain = false; //设置标识--域名是否需要检测解析,初始化为不需要
- static string ipv4 = String.Empty; //保存获取的ipv4地址
- static string ipv6 = String.Empty; //保存获取的ipv6地址
- static bool onlyIpv6 = false; //主机是否基于纯ipv6地址
- static bool functionResult = true; //标示功能函数是否执行状态(true无错误发生/false有错误发生)
- static string sshShellCommand = String.Empty; //定义保存执行的命令
- static string currentStatus = String.Empty; //定议保存要显示的状态
- static string currentShellCommandResult = String.Empty; //定义Shell命令执行结果保存变量
- static bool getApt = false; //判断系统软件管理,下同
- static bool getDnf = false;
- static bool getYum = false;
- static string sshCmdUpdate = String.Empty; //保存软件安装所用更新软件库命令
- static string sshCmdInstall = String.Empty; //保存软件安装所用命令格式
- static int randomCaddyListenPort = 8800; //Caddy做伪装网站所监听的端口,随机10001-60000
- static int installationDegree = 0; //安装进度条显示的百分比
- static string saveShellScriptFileName = "install.sh"; //用来保存下载的脚本名称
- static string acmeEmail = "";
-
- //****** ******
- // Application.Current.FindResource("").ToString()
- //
- // {DynamicResource }
- //SetUpProgressBarProcessing(0);
- public MainWindow()
- {
- InitializeComponent();
-
- #region 多语言选择设置 初始设置为auto
- List languageList = new List();
-
- languageList.Add(new LanguageInfo { Name = "auto", Value = "auto" });
- languageList.Add(new LanguageInfo { Name = "English", Value = "en-US" });
- languageList.Add(new LanguageInfo { Name = "简体中文", Value = "zh-CN" });
- languageList.Add(new LanguageInfo { Name = "正體中文", Value = "zh-TW" });
-
- ComboBoxLanguage.ItemsSource = languageList;
-
- ComboBoxLanguage.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxLanguage.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxLanguage.SelectedIndex = 0;
-
- DataContext = this;
- string Culture = System.Globalization.CultureInfo.InstalledUICulture.Name;
- //Culture = "en-US";
- ResourcesLoad(Culture);
- #endregion
-
- //初始化参数设置数组
- ReceiveConfigurationParameters = new string[10];
-
- //初始化选定密码登录
- RadioButtonPasswordLogin.IsChecked = true;
- //初始化选定无代理
- RadioButtonNoProxy.IsChecked = true;
- //初始化代理无需登录
- RadioButtonProxyNoLogin.IsChecked = true;
- //初始化隐藏Socks4代理,
- RadioButtonSocks4.Visibility = Visibility.Collapsed;
-
- //初始化Trojan的密码
- TextBoxTrojanPassword.Text = RandomUUID();
-
- //初始化NaiveProxy的用户名和密码
- TextBoxNaivePassword.Text = RandomUUID();
- TextBoxNaiveUser.Text = RandomUserName();
-
- //初始化SSR的密码
- TextBoxSSRPassword.Text = RandomUUID();
-
- //初始化V2Ray所选方案面板为不显示
- GridV2rayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- //初始化Xray所选方案面板为不显示
- GridXrayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- //自动检查ProxySU是否有新版本发布,有则显示更新提示
- Thread thread = new Thread(() => TestLatestVersionProxySU(TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- #region 检测新版本代码
-
- //检测ProxySU新版本
- private void TestLatestVersionProxySU(TextBlock TextBlockLastVersionProxySU, TextBlock TextBlockNewVersionReminder, Button ButtonUpgradeProxySU)
- {
- string strJson = GetLatestJson(@"https://api.github.com/repos/proxysu/windows/releases/latest");
- if (String.IsNullOrEmpty(strJson) == false)
- {
- JObject lastVerJsonObj = JObject.Parse(strJson);
- string lastVersion = (string)lastVerJsonObj["tag_name"];//得到远程版本信息
-
- string lastVersionNoV = lastVersion.Replace("v", String.Empty);
-
- Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
- //MessageBox.Show(version.ToString());
- string cerversion = version.ToString().Substring(0, 6); //获取本地版本信息
- //MessageBox.Show(cerversion);
- string[] lastVerComp = lastVersionNoV.Split('.');
- string[] localVerComp = cerversion.Split('.');
-
- //版本信息不相同,则认为新版本发布,显示出新版本信息及更新提醒,下载按钮
- if (int.Parse(lastVerComp[0]) > int.Parse(localVerComp[0]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- else if (int.Parse(lastVerComp[0]) == int.Parse(localVerComp[0]))
- {
- if (int.Parse(lastVerComp[1]) > int.Parse(localVerComp[1]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- else if (int.Parse(lastVerComp[1]) == int.Parse(localVerComp[1]))
- {
- if (int.Parse(lastVerComp[2]) > int.Parse(localVerComp[2]))
- {
- TextBlockLastVersionProxySU.Dispatcher.BeginInvoke(updateNewVersionProxySUAction, TextBlockLastVersionProxySU, TextBlockNewVersionReminder, ButtonUpgradeProxySU, lastVersion);
- return;
- }
- }
- }
- }
- }
-
- //下载最新版ProxySU
- private void ButtonUpgradeProxySU_Click(object sender, RoutedEventArgs e)
- {
- TextBlockNewVersionReminder.Visibility = Visibility.Hidden;
- TextBlockNewVersionDown.Visibility = Visibility.Visible;
- //TextBlockNewVersionReminder.Text = Application.Current.FindResource("TextBlockNewVersionDown").ToString();
- try
- {
- string strJson = GetLatestJson(@"https://api.github.com/repos/proxysu/windows/releases/latest");
- if (String.IsNullOrEmpty(strJson) == false)
- {
- JObject lastVerJsonObj = JObject.Parse(strJson);
- string lastVersion = (string)lastVerJsonObj["tag_name"];//得到远程版本信息
- string latestVerDownUrl = (string)lastVerJsonObj["assets"][0]["browser_download_url"];//得到最新版文件下载地址
- string latestNewVerFileName = (string)lastVerJsonObj["assets"][0]["name"];//得到最新版文件名
- string latestNewVerExplanation = (string)lastVerJsonObj["body"];//得到更新说明
-
- WebClient webClientNewVer = new WebClient();
- webClientNewVer.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
- //webClientNewVer.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
- if (CheckDir(lastVersion))
- {
- Uri latestVerDownUri = new Uri(latestVerDownUrl);
- webClientNewVer.DownloadFileAsync(latestVerDownUri, lastVersion + @"\" + latestNewVerFileName);
- //webClientNewVer.DownloadFile(latestVerDownUrl, latestNewVerFileName);
-
- using (StreamWriter sw = new StreamWriter(lastVersion + @"\" + "readme.txt"))
- {
- sw.WriteLine(latestNewVerExplanation);
- }
- }
- }
- }
- catch (Exception ex1)
- {
- // MessageBox.Show(ex1.ToString());
-
- return;
- }
- }
- //文件下载完处理方法
- private void Completed(object sender, AsyncCompletedEventArgs e)
- {
- if (e.Cancelled == true)
- {
- MessageBox.Show(e.Error.ToString());
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDownProxyFail").ToString());
- //label1.Text = "Download cancelled!";
- }
- else
- {
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDownProxySuccess").ToString());
- }
- }
-
- //获取LatestJson
- private string GetLatestJson(string theLatestUrl)
- {
- try
- {
- //ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | (SecurityProtocolType)3072 | (SecurityProtocolType)768 | SecurityProtocolType.Tls;
- ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
- // ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x30);
- //string url = "https://api.github.com/repos/proxysu/windows/releases/latest";
- Uri uri = new Uri(theLatestUrl);
- HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
- req.Accept = @"application/json";
- req.UserAgent = @"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0";
- HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
- Stream stream = resp.GetResponseStream();
- StreamReader sr = new StreamReader(stream);
- string strJson = sr.ReadToEnd();
- return strJson;
- }
- catch (Exception ex1)
- {
- return null;
- }
- }
-
-
- //更新新版本提醒显示
- Action updateNewVersionProxySUAction = new Action(UpdateNewVersionProxySU);
- private static void UpdateNewVersionProxySU(TextBlock TextBlockLastVersionProxySU, TextBlock TextBlockNewVersionReminder, Button ButtonUpgradeProxySU, string theLatestVersion)
- {
- TextBlockLastVersionProxySU.Text = theLatestVersion;
- TextBlockLastVersionProxySU.Visibility = Visibility.Visible;
- TextBlockNewVersionReminder.Visibility = Visibility.Visible;
- ButtonUpgradeProxySU.Visibility = Visibility.Visible;
- }
-
- #endregion
-
- #region 安装过程信息显示 端口数字防错代码,密钥选择代码
-
- //更新状态条显示
- Action updateAction = new Action(UpdateTextBlock);
- private static void UpdateTextBlock(TextBlock textBlockName, ProgressBar progressBar, string currentStatus)
- {
- textBlockName.Text = currentStatus;
-
- //if (currentStatus.Contains("成功") == true || currentStatus.ToLower().Contains("success") == true)
- //{
- // progressBar.IsIndeterminate = false;
- // progressBar.Value = 100;
- //}
- //else
- if (currentStatus.Contains("失败") == true || currentStatus.Contains("取消") == true || currentStatus.Contains("退出") == true || currentStatus.ToLower().Contains("fail") == true || currentStatus.ToLower().Contains("cancel") == true || currentStatus.ToLower().Contains("exit") == true)
- {
- progressBar.IsIndeterminate = false;
- progressBar.Value = 0;
- }
- //else
- //{
- // progressBar.IsIndeterminate = true;
- // //progressBar.Value = 0;
- //}
-
-
- }
-
- //进度条更新百分比
- private void SetUpProgressBarProcessing(int max)
- {
-
- for (int i = installationDegree; i <= max; i++)
- {
- Thread.Sleep(100);
- Dispatcher.Invoke(new Action(ProgressBarSetUpProcessing.SetValue), System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, Convert.ToDouble(i) });
- }
- installationDegree = max;
- }
-
-
- //更新监视窗内的显示
- //结尾自动添加一个换行符
- Action updateMonitorAction = new Action(UpdateTextBox);
- private static void UpdateTextBox(TextBox textBoxName, string currentResult)
- {
- textBoxName.Text = textBoxName.Text + currentResult + Environment.NewLine;
- textBoxName.ScrollToEnd();
- }
-
- //结尾不添加换行符
- Action updateMonitorActionNoWrap = new Action(UpdateTextBoxNoWrap);
- private static void UpdateTextBoxNoWrap(TextBox textBoxName, string currentResult)
- {
- textBoxName.Text = textBoxName.Text + currentResult;
- textBoxName.ScrollToEnd();
- }
-
- //退出主程序
- private void Button_canel_Click(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
-
- // private static readonly Regex _regex = new Regex("[^0-9]+");
-
- //检测数字输入
- private void TextBoxPort_PreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- Regex regex = new Regex("[^0-9]+");
- e.Handled = regex.IsMatch(e.Text);
- }
-
- //检测字符串是否只由数字组成
- private bool IsOnlyNumber(string value)
- {
- value = value.Trim();
- Regex r = new Regex(@"^[0-9]+$");
- return r.Match(value).Success;
- }
-
- //端口输入框是否可使用粘贴命令
- private void TextBoxPort_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
- {
- if (e.Command == ApplicationCommands.Paste)
- {
- e.Handled = false;//true为不能使用粘贴命令,false为可以使用粘贴命令
- }
- }
-
- //打开证书浏览
- private void ButtonOpenFileDialog_Click(object sender, RoutedEventArgs e)
- {
- var openFileDialog = new Microsoft.Win32.OpenFileDialog()
- {
- Filter = "Cert Files (*.*)|*.*"
- };
- var result = openFileDialog.ShowDialog();
- if (result == true)
- {
- TextBoxCertFilePath.Text = openFileDialog.FileName;
- }
- }
- #endregion
-
- #region 主界面控件的有效无效控制代码块及界面语言
-
- //加载语言资源文件
- private void ResourcesLoad(string Culture)
- {
- List dictionaryList = new List();
- foreach (ResourceDictionary dictionary in Application.Current.Resources.MergedDictionaries)
- {
- dictionaryList.Add(dictionary);
- }
- string requestedCulture = string.Format(@"Translations\ProxySU.{0}.xaml", Culture);
- //string requestedCulture = string.Format(@"Translations\ProxySU.{0}.xaml", "default");
- ResourceDictionary resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedCulture));
- if (resourceDictionary == null)
- {
- requestedCulture = @"Translations\ProxySU.en-US.xaml";
- resourceDictionary = dictionaryList.FirstOrDefault(d => d.Source.OriginalString.Equals(requestedCulture));
- }
- if (resourceDictionary != null)
- {
- Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary);
- Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
- }
- }
-
- //界面语言处理
- private void ComboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string languageCulture;
- object languageSelected;
- languageSelected = ComboBoxLanguage.SelectedValue;
- languageCulture = languageSelected.ToString();
- if (languageCulture.Equals("auto"))
- {
- languageCulture = System.Globalization.CultureInfo.InstalledUICulture.Name;
- ResourcesLoad(languageCulture);
- }
- else
- {
- ResourcesLoad(languageCulture);
- }
- //display.Text = language;
- }
- private void RadioButtonNoProxy_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyHost.IsEnabled = false;
- TextBlockProxyHost.Visibility = Visibility.Collapsed;
- TextBoxProxyHost.IsEnabled = false;
- TextBoxProxyHost.Visibility = Visibility.Collapsed;
- TextBlockProxyPort.IsEnabled = false;
- TextBlockProxyPort.Visibility = Visibility.Collapsed;
- TextBoxProxyPort.IsEnabled = false;
- TextBoxProxyPort.Visibility = Visibility.Collapsed;
- RadioButtonProxyNoLogin.IsEnabled = false;
- RadioButtonProxyNoLogin.Visibility = Visibility.Collapsed;
- RadiobuttonProxyYesLogin.IsEnabled = false;
- RadiobuttonProxyYesLogin.Visibility = Visibility.Collapsed;
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
-
- private void RadioButtonNoProxy_Unchecked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyHost.IsEnabled = true;
- TextBlockProxyHost.Visibility = Visibility.Visible;
- TextBoxProxyHost.IsEnabled = true;
- TextBoxProxyHost.Visibility = Visibility.Visible;
- TextBlockProxyPort.IsEnabled = true;
- TextBlockProxyPort.Visibility = Visibility.Visible;
- TextBoxProxyPort.IsEnabled = true;
- TextBoxProxyPort.Visibility = Visibility.Visible;
- RadioButtonProxyNoLogin.IsEnabled = true;
- RadioButtonProxyNoLogin.Visibility = Visibility.Visible;
- RadiobuttonProxyYesLogin.IsEnabled = true;
- RadiobuttonProxyYesLogin.Visibility = Visibility.Visible;
- if (RadioButtonProxyNoLogin.IsChecked == true)
- {
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
- else
- {
- TextBlockProxyUser.IsEnabled = true;
- TextBlockProxyUser.Visibility = Visibility.Visible;
- TextBoxProxyUserName.IsEnabled = true;
- TextBoxProxyUserName.Visibility = Visibility.Visible;
- TextBlockProxyPassword.IsEnabled = true;
- TextBlockProxyPassword.Visibility = Visibility.Visible;
- PasswordBoxProxyPassword.IsEnabled = true;
- PasswordBoxProxyPassword.Visibility = Visibility.Visible;
- }
- }
-
- private void RadioButtonPasswordLogin_Checked(object sender, RoutedEventArgs e)
- {
- ButtonOpenFileDialog.IsEnabled = false;
- ButtonOpenFileDialog.Visibility = Visibility.Collapsed;
- TextBoxCertFilePath.IsEnabled = false;
- TextBoxCertFilePath.Visibility = Visibility.Collapsed;
- TextBlockCert.Visibility = Visibility.Collapsed;
- TextBlockPassword.Visibility = Visibility.Visible;
- PasswordBoxHostPassword.IsEnabled = true;
- PasswordBoxHostPassword.Visibility = Visibility.Visible;
- }
-
- private void RadioButtonCertLogin_Checked(object sender, RoutedEventArgs e)
- {
- //TextBlockPassword.Text = "密钥:";
- TextBlockCert.Visibility = Visibility.Visible;
- TextBlockPassword.Visibility = Visibility.Collapsed;
- PasswordBoxHostPassword.IsEnabled = false;
- PasswordBoxHostPassword.Visibility = Visibility.Collapsed;
- ButtonOpenFileDialog.IsEnabled = true;
- ButtonOpenFileDialog.Visibility = Visibility.Visible;
- TextBoxCertFilePath.IsEnabled = true;
- TextBoxCertFilePath.Visibility = Visibility.Visible;
- }
-
- private void RadioButtonProxyNoLogin_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyUser.IsEnabled = false;
- TextBlockProxyUser.Visibility = Visibility.Collapsed;
- TextBlockProxyPassword.IsEnabled = false;
- TextBlockProxyPassword.Visibility = Visibility.Collapsed;
- TextBoxProxyUserName.IsEnabled = false;
- TextBoxProxyUserName.Visibility = Visibility.Collapsed;
- PasswordBoxProxyPassword.IsEnabled = false;
- PasswordBoxProxyPassword.Visibility = Visibility.Collapsed;
- }
-
- private void RadiobuttonProxyYesLogin_Checked(object sender, RoutedEventArgs e)
- {
- TextBlockProxyUser.IsEnabled = true;
- TextBlockProxyUser.Visibility = Visibility.Visible;
- TextBlockProxyPassword.IsEnabled = true;
- TextBlockProxyPassword.Visibility = Visibility.Visible;
- TextBoxProxyUserName.IsEnabled = true;
- TextBoxProxyUserName.Visibility = Visibility.Visible;
- PasswordBoxProxyPassword.IsEnabled = true;
- PasswordBoxProxyPassword.Visibility = Visibility.Visible;
- }
- #endregion
-
- //远程主机连接信息
- private ConnectionInfo GenerateConnectionInfo()
- {
- acmeEmail = AcmeEmailTextBox.Text;
-
- ConnectionInfo connectionInfo;
-
- if (string.IsNullOrEmpty(acmeEmail))
- {
- var acmeEmailDesc = Application.Current.FindResource("AcmeEmailDesc").ToString();
- MessageBox.Show(acmeEmailDesc);
- return connectionInfo = null;
- }
-
- #region 检测输入的内容是否有错,并读取内容
- if (string.IsNullOrEmpty(PreTrim(TextBoxHost.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxPort.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxUserName.Text)) == true)
- {
- //******"主机地址、主机端口、用户名为必填项,不能为空"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostPortUserNotEmpty").ToString());
-
- return connectionInfo = null;
- }
- string sshHostName = PreTrim(TextBoxHost.Text);
- int sshPort = 22;
-
- if (IsOnlyNumber(PreTrim(TextBoxPort.Text)) == true)
- {
- TextBoxPort.Text = PreTrim(TextBoxPort.Text);
- sshPort = int.Parse(TextBoxPort.Text);
- }
- else
- {
- //******"连接端口含有非数字字符!"******
- MessageBox.Show("Host Port" + Application.Current.FindResource("MessageBoxShow_ErrorHostPortErr").ToString());
- return connectionInfo = null;
- }
-
- string sshUser = PreTrim(TextBoxUserName.Text);
-
- if (RadioButtonPasswordLogin.IsChecked == true && string.IsNullOrEmpty(PasswordBoxHostPassword.Password) == true)
- {
- //****** "登录密码为必填项,不能为空!!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostPasswordNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshPassword = PasswordBoxHostPassword.Password.ToString();
- if (RadioButtonCertLogin.IsChecked == true && string.IsNullOrEmpty(TextBoxCertFilePath.Text) == true)
- {
- //****** "密钥文件为必填项,不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostKeyNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshPrivateKey = TextBoxCertFilePath.Text.ToString();
- ProxyTypes proxyTypes = new ProxyTypes();//默认为None
-
- //proxyTypes = ProxyTypes.Socks5;
- if (RadioButtonHttp.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Http;
- }
- else if (RadioButtonSocks4.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Socks4;
- }
- else if (RadioButtonSocks5.IsChecked == true)
- {
- proxyTypes = ProxyTypes.Socks5;
- }
- else
- {
- proxyTypes = ProxyTypes.None;
- }
-
- //MessageBox.Show(proxyTypes.ToString());
- if (RadioButtonNoProxy.IsChecked == false && (string.IsNullOrEmpty(PreTrim(TextBoxProxyHost.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxProxyPort.Text)) == true))
- {
- //****** "如果选择了代理,则代理地址与端口不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorProxyAddressPortNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshProxyHost = PreTrim(TextBoxProxyHost.Text);
-
- int sshProxyPort = 1080;
- if (IsOnlyNumber(PreTrim(TextBoxProxyPort.Text)) == true)
- {
- TextBoxProxyPort.Text = PreTrim(TextBoxProxyPort.Text);
- sshProxyPort = int.Parse(TextBoxProxyPort.Text);
- }
- else
- {
- //******"连接端口含有非数字字符!"******
- MessageBox.Show("Proxy Port" + Application.Current.FindResource("MessageBoxShow_ErrorHostPortErr").ToString());
- return connectionInfo = null;
- }
-
- if (RadioButtonNoProxy.IsChecked == false && RadiobuttonProxyYesLogin.IsChecked == true && (string.IsNullOrEmpty(PreTrim(TextBoxProxyUserName.Text)) == true || string.IsNullOrEmpty(PasswordBoxProxyPassword.Password) == true))
- {
- //****** "如果代理需要登录,则代理登录的用户名与密码不能为空!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorProxyUserPasswordNotEmpty").ToString());
- return connectionInfo = null;
- }
- string sshProxyUser = PreTrim(TextBoxProxyUserName.Text);
- string sshProxyPassword = PasswordBoxProxyPassword.Password;
-
- #endregion
-
-
- //var connectionInfo = new PasswordConnectionInfo(sshHostName, sshPort, sshUser, sshPassword);
-
- connectionInfo = new ConnectionInfo(
- sshHostName,
- sshPort,
- sshUser,
- proxyTypes,
- sshProxyHost,
- sshProxyPort,
- sshProxyUser,
- sshProxyPassword,
- new PasswordAuthenticationMethod(sshUser, sshPassword)
- //new PrivateKeyAuthenticationMethod(sshUser, new PrivateKeyFile(sshPrivateKey))
- );
-
- if (RadioButtonCertLogin.IsChecked == true)
- {
- connectionInfo = new ConnectionInfo(
- sshHostName,
- sshPort,
- sshUser,
- proxyTypes,
- sshProxyHost,
- sshProxyPort,
- sshProxyUser,
- sshProxyPassword,
- //new PasswordAuthenticationMethod(sshUser, sshPassword)
- new PrivateKeyAuthenticationMethod(sshUser, new PrivateKeyFile(sshPrivateKey))
- );
-
- }
- return connectionInfo;
- }
-
- //登录主机过程中出现的异常处理
- private void ProcessException(string exceptionMessage)
- {
- //下面代码需要保留,以备将来启用
- //if (exceptionMessage.Contains("连接尝试失败") == true)
- //{
- // //****** "请检查主机地址及端口是否正确,如果通过代理,请检查代理是否正常工作!" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginHostOrPort").ToString());
- //}
-
- //else if (exceptionMessage.Contains("denied (password)") == true)
- //{
- // //****** "密码错误或用户名错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginUserOrPassword").ToString());
- //}
- //else if (exceptionMessage.Contains("Invalid private key file") == true)
- //{
- // //****** "所选密钥文件错误或者格式不对!" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginKey").ToString());
- //}
- //else if (exceptionMessage.Contains("denied (publickey)") == true)
- //{
- // //****** "使用密钥登录,密钥文件错误或用户名错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginKeyOrUser").ToString());
- //}
- //else if (exceptionMessage.Contains("目标计算机积极拒绝") == true)
- //{
- // //****** "主机地址错误,如果使用了代理,也可能是连接代理的端口错误" ******
- // MessageBox.Show($"{exceptionMessage}\n" +
- // Application.Current.FindResource("MessageBoxShow_ErrorLoginHostOrProxyPort").ToString());
- //}
- //else
- //{
- //****** "发生错误" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorLoginOccurred").ToString());
- MessageBox.Show(exceptionMessage);
- //}
-
- }
-
-
- #region V2Ray相关
-
- //打开v2ray模板设置窗口
- private void ButtonTemplateConfiguration_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- WindowTemplateConfiguration windowTemplateConfiguration = new WindowTemplateConfiguration();
- windowTemplateConfiguration.Closed += windowTemplateConfigurationClosed;
- windowTemplateConfiguration.ShowDialog();
- }
-
- //V2Ray模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlan.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- GridV2rayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- return;
- }
- else
- {
- GridV2rayCurrentlyPlan.Visibility = Visibility.Visible;
- }
- TextBlockCurrentlySelectedPlan.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPort.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUID.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- //MessageBox.Show(ReceiveConfigurationParameters[7]);
- TextBlockCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //显示复合方案路径
- ShowVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideV2RayPathSeedKey();
- HideVlessVmessXtlsTcpWs();
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- HideV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示域名
- ShowV2RayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- ShowV2RayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- //显示Path
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- //显示mKCP Seed
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "mKCP Seed:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideV2RayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- //显示QUIC Key
- ShowV2RayPathSeedKey();
- TextBlockV2RayShowPathSeedKey.Text = "QUIC Key:";
- TextBlockCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示Quic加密方式
- ShowV2RayDomainQuicEncrypt();
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockQuicEncryption").ToString();
- TextBlockCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[3]; //Quic加密方式
- if (String.Equals(TextBlockCurrentlySelectedPlanDomain.Text, "none") == true)
- {
- HideV2RayPathSeedKey();
- }
-
-
- //隐藏伪装网站
- HideV2RayMaskSites();
- }
- }
-
- #region 当前方案界面控制
- //显示端口与UUID
- private void ShowV2RayCurrentPortUUID()
- {
- TextBlockV2RayShowPort.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockV2RayShowUUID.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUID.Visibility = Visibility.Visible;
- }
-
- //显示Path/mKCP Seed/Quic Key
- private void ShowV2RayPathSeedKey()
- {
- HideVlessVmessXtlsTcpWs();
- TextBlockV2RayShowPathSeedKey.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Visible;
- }
-
- //隐藏Path/mKCP Seed/Quic Key
- private void HideV2RayPathSeedKey()
- {
- TextBlockV2RayShowPathSeedKey.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
- }
-
- //显示VLESS VMESS XTLS TCP WS 复合方案
- private void ShowVlessVmessXtlsTcpWs()
- {
- HideV2RayPathSeedKey();
- GridVlessVmessXtlsTcpWs.Visibility = Visibility.Visible;
- TextBlockBoxPathVlessWS.Text = ReceiveConfigurationParameters[3];
- TextBlockBoxPathVmessTcp.Text = ReceiveConfigurationParameters[9];
- TextBlockBoxPathVmessWS.Text = ReceiveConfigurationParameters[6];
- }
-
- //隐藏VLESS VMESS XTLS TCP WS 复合方案
- private void HideVlessVmessXtlsTcpWs()
- {
- GridVlessVmessXtlsTcpWs.Visibility = Visibility.Collapsed;
- }
-
- //显示域名/Quic加密方式
- private void ShowV2RayDomainQuicEncrypt()
- {
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockV2RayDomain").ToString();
- TextBlockCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[4]; //域名
-
- }
-
- //隐藏域名/Quic加密方式
- private void HideV2RayDomainQuicEncrypt()
- {
- TextBlockV2RayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- }
- //显示伪装网站
- private void ShowV2RayMaskSites()
- {
- TextBlockV2RayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- }
-
- //隐藏伪装网站
- private void HideV2RayMaskSites()
- {
- TextBlockV2RayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- }
- #endregion
-
- //传送V2Ray模板参数,启动V2Ray安装进程
- private void Button_Login_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || ReceiveConfigurationParameters[0].Contains("mKCP") == true
- || ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- testDomain = false;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- testDomain = true;
-
- }
-
-
- //Thread thread
- //SetUpProgressBarProcessing(0); //重置安装进度
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- //Thread thread = new Thread(() => StartSetUpV2ray(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing));
- Thread thread = new Thread(() => StartSetUpV2ray(connectionInfo));
-
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
-
- }
-
- //登录远程主机布署V2ray程序
- private void StartSetUpV2ray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测系统是否符合安装要求 11--30
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测校对时间 31--33
- functionResult = CheckProofreadingTime(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名解析是否正确 34---36
- if (testDomain == true)
- {
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
-
- //下载安装脚本安装 37--40
- functionResult = ProxySoftInstall(client, @"V2Ray", @"https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh");
- //functionResult = ProxySoftInstallV2ray(client, @"V2Ray", @"https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh");
-
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = V2RayInstallScript(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成服务端配置 44--46
- functionResult = GenerateServerConfigurationV2Ray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ****** 47--50
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- string serverRemoteConfig = @"/usr/local/etc/v2ray/config.json";
- UploadConfig(connectionInfo, @"config.json", serverRemoteConfig);
- File.Delete(@"config.json");
- SetUpProgressBarProcessing(50);
-
- //如果使用http2/WebSocketTLS/tcpTLS/VlessTcpTlsWeb/VLESS+TCP+XTLS+Web模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装acme.sh与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装证书到V2Ray 58--60
- functionResult = CertInstallToV2ray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
-
- #region Caddy安装 61--70
-
- //如果是VLESS+TCP+XTLS+Web/VLESS+TCP+TLS+Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web/WebSocket+TLS+Web/http2Web模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装Caddy 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #region 上传Caddy配置文件 67--70
-
- //******"上传Caddy配置文件"******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = "";
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\vlessTcpTlsWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\WebSocketTLSWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\v2ray\caddy\Http2Web.caddyfile";
- }
-
- string upLoadPath = "/etc/caddy/Caddyfile";
- client.RunCommand("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak");
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- functionResult = FileCheckExists(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false)
- {
- //****** "Caddy配置文件上传失败!" ******32
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //****** "Caddy配置文件上传成功,OK!" ******32
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #endregion
-
- //启动Caddy服务
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
- #endregion
-
- //****** "正在启动V2ray......" ******35
- functionResult = SoftStartDetect(client, "v2ray", @"/usr/local/bin/v2ray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //测试BBR条件,若满足提示是否启用
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //生成客户端配置 96--98
- functionResult = GenerateClientConfigurationV2Ray();
-
- //****** "V2Ray安装成功,祝你玩的愉快!!" ******40
- SetUpProgressBarProcessing(100);
- currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //显示服务端连接参数
- proxyType = "V2Ray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
-
- }
- }
- catch (Exception ex1)//例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- #region V2Ray专用调用函数
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool ProxySoftInstallV2ray(SshClient client, string proxyName, string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName} --version v4.32.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
-
-
- //生成V2Ray服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationV2Ray(SshClient client)
- {
- SetUpProgressBarProcessing(44);
- //修改v2ray.service
-
- sshShellCommand = $"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/v2ray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备用下载地址:https://raw.githubusercontent.com/proxysu/Resources/master/v2ray/v2ray.service
-
- //sshShellCommand = $"yes | curl -o /etc/systemd/system/v2ray.service https://raw.githubusercontent.com/proxysu/Resources/master/v2ray/v2ray.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备份原来的文件
- functionResult = FileCheckExists(client, @"/usr/local/etc/v2ray/config.json");
- if (functionResult == true)
- {
-
- sshShellCommand = @"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- //读取配置文件各个模块
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\base.json";
-
- //配置文件模块合成
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["reverse"] = jObjectJson["reverse"];
- }
-
- //依据安装模式读取相应模板
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_http_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcp_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\tcpTLSselfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_tcp_xtls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_tcp_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_ws_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_http2_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_vmess_xtls_tcp_websocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\webSocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocket_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocketTLS_selfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\WebSocketTLSWeb_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\http2_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\Http2Web_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\Http2selfSigned_server_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\vless_mkcp_server_config.json";
- }
- else
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\mkcp_server_config.json";
- }
-
- }
-
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\quic_server_config.json";
- }
-
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJsonTmp = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- var jObjectJson = (dynamic)jObjectJsonTmp;
-
- //Padavan路由固件服务端设置(因为客户端分流有问题所以在服务端弥补)加上后会影响一定的速度
-
- //string sniffingAddServer = $"{pwdir}" + @"TemplateConfg\v2ray\server\05_inbounds\00_padavan_router.json";
- //using (StreamReader readerSniffingJson = File.OpenText(sniffingAddServer))
- //{
- // JObject jObjectSniffingJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerSniffingJson));
- // jObjectJson["inbounds"][0]["sniffing"] = jObjectSniffingJson["sniffing"];
- //}
-
- //设置uuid
- jObjectJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //除WebSocketTLSWeb/http2Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web模式外设置监听端口
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "http2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == false)
- {
- jObjectJson["inbounds"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- }
-
- //设置VLESS协议的回落端口,指向Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- }
- //设置VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web协议
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][1]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- //设置其他模式的UUID
- jObjectJson["inbounds"][1]["settings"]["clients"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][2]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][3]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][4]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //设置Vless回落与分流的Path
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][1]["path"] = ReceiveConfigurationParameters[3];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][2]["path"] = ReceiveConfigurationParameters[9];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][3]["path"] = ReceiveConfigurationParameters[6];
-
- //设置Vless ws Path
- jObjectJson["inbounds"][2]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
- //设置Vmess tcp Path
- jObjectJson["inbounds"][3]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
- //设置Vmess ws Path
- jObjectJson["inbounds"][4]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- }
-
- //TLS自签证书/WebSocketTLS(自签证书)/http2自签证书模式下,使用v2ctl 生成自签证书
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- string selfSignedCa = client.RunCommand("/usr/local/bin/v2ctl cert --ca").Result;
- JObject selfSignedCaJObject = JObject.Parse(selfSignedCa);
- jObjectJson["inbounds"][0]["streamSettings"]["tlsSettings"]["certificates"][0] = selfSignedCaJObject;
- }
-
- //如果是WebSocketTLSWeb/WebSocketTLS/WebSocketTLS(自签证书)/VLESS+WebSocket+TLS+Web模式,则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2/http2Web/http2自签/VLESS+http2+TLS+Web模式下,设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2+Web/VLESS+http2+TLS+Web模式下,设置host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //mkcp模式下,设置伪装类型
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //quic模式下设置伪装类型及密钥
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
-
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- SetUpProgressBarProcessing(46);
- return true;
- }
-
- //安装证书到V2Ray 58--60
- //functionResult = CertInstallToV2ray(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CertInstallToV2ray(SshClient client)
- {
- //****** "安装证书到V2ray......" ******26
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mkdir -p /usr/local/etc/v2ray/ssl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/v2ray/ssl/v2ray_ssl.crt --keypath /usr/local/etc/v2ray/ssl/v2ray_ssl.key --capath /usr/local/etc/v2ray/ssl/v2ray_ssl.crt --reloadcmd \"systemctl restart v2ray\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/v2ray/ssl/v2ray_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到V2ray!" ******27
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到V2ray失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "V2Ray" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- //设置私钥权限
- sshShellCommand = @"chmod 644 /usr/local/etc/v2ray/ssl/v2ray_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- return true;
- }
-
- //生成V2Ray客户端配置 96--98
- //functionResult = GenerateClientConfiguration();
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateClientConfigurationV2Ray()
- {
- //****** "生成客户端配置......" ******39
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\base.json";
- //Thread.Sleep(1000);
- if (!Directory.Exists("v2ray_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("v2ray_config");//创建该文件夹
- }
-
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["reverse"] = jObjectJson["reverse"];
- }
-
- //根据不同的安装方案,选择相应的客户端模板
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- //根据选择的不同模式,选择相应的配置文件
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_http_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcp_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\tcpTLSselfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_ws_tls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_http2_tls_server_config.json";
- }
-
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\webSocket_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocket_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLS_selfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\http2_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\Http2Web_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\Http2selfSigned_client_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_mkcp_client_config.json";
- }
- else
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\mkcp_client_config.json";
- }
-
- }
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\quic_client_config.json";
- }
-
-
- //读取"相应模板的outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
-
- //设置WebSocket模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2+TLS+Web/VLESS+http2+TLS+Web模式下的host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //设置VLESS+TCP+XTLS+Web模式下的serverName
- //if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- //{
- // jObjectJson["outbounds"][0]["streamSettings"]["xtlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
- //}
-
- //设置mkcp
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //设置QUIC
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
-
- }
-
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
-
- #endregion
-
- }
- else
- {
- //复合方案所需要的配置文件
- //VLESS over TCP with XTLS模式
- //string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- //using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- //{
- // JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- // //设置客户端的地址/端口/id
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- // jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- // clientJson["outbounds"] = jObjectJson["outbounds"];
- // if (!Directory.Exists(@"v2ray_config\vless_tcp_xtls_client_config"))//如果不存在就创建file文件夹
- // {
- // Directory.CreateDirectory(@"v2ray_config\vless_tcp_xtls_client_config");//创建该文件夹
- // }
- // using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_tcp_xtls_client_config\config.json"))
- // {
- // sw.Write(clientJson.ToString());
- // }
- //}
-
- //VLESS over TCP with TLS模式
- string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vless_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vless_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over WS with TLS 模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vless_ws_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vless_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vless_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vless_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\vmess_tcp_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vmess_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vmess_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vmess_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over WS with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\vmess_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\vmess_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\vmess_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //Trojan over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\v2ray\client\06_outbounds\trojan_tcp_tls.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"v2ray_config\trojan_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"v2ray_config\trojan_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"v2ray_config\trojan_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- }
- }
- SetUpProgressBarProcessing(98);
- return true;
- }
-
-
- #endregion
-
- //检测升级远程主机端的V2Ray版本
- private void ButtonUpdateV2ray_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateV2ray(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级V2ray主程序
- private void UpdateV2ray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装V2ray......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- //Thread.Sleep(1000);
- //检测是否安装V2Ray
- //sshShellCommand = @"find / -name v2ray";
- //sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装V2ray"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
-
- //sshcmd = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string v2rayCurrentVersion = currentShellCommandResult;//不含字母v
-
- //sshcmd = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/v2ray-core/releases/latest"" --connect-timeout 10| grep 'tag_name' | cut -d\"" -f4";
- sshShellCommand = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/v2ray-core/releases/latest"" --connect-timeout 10 | grep 'tag_name' | cut -d\"" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string v2rayNewVersion = currentShellCommandResult;//包含字母v
-
- if (v2rayNewVersion.Contains(v2rayCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{v2rayCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{v2rayNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.RunCommand(@"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
- sshShellCommand = $"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- //sshcmd = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/v2ray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- v2rayCurrentVersion = currentShellCommandResult;//不含字母v
- if (v2rayNewVersion.Contains(v2rayCurrentVersion) == true)
- {
- //****** "升级成功!当前已是最新版本!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{v2rayNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
- #endregion
-
- #region Xray相关
- //打开Xray模板设置窗口
- private void ButtonTemplateConfigurationXray_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- XrayWindowTemplateConfiguration XraywindowTemplateConfiguration = new XrayWindowTemplateConfiguration();
- XraywindowTemplateConfiguration.Closed += XraywindowTemplateConfigurationClosed;
- XraywindowTemplateConfiguration.ShowDialog();
- }
-
- //Xay模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void XraywindowTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlanXray.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- GridXrayCurrentlyPlan.Visibility = Visibility.Hidden;
-
- return;
- }
- else
- {
- GridXrayCurrentlyPlan.Visibility = Visibility.Visible;
- }
- TextBlockCurrentlySelectedPlanXray.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPortXray.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUIDXray.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- //MessageBox.Show(ReceiveConfigurationParameters[7]);
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //显示复合方案路径
- ShowVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //隐藏Path/mKCP Seed/Quic Key
- HideXayPathSeedKey();
- HideVlessVmessXtlsTcpWsXray();
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站(暂时不显示)
- HideXrayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示域名
- ShowXrayDomainQuicEncrypt();
-
- //显示伪装网站
- ShowXayMaskSites();
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- //显示Path
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "Path:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- //显示mKCP Seed
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "mKCP Seed:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //隐藏域名/Quic加密方式
- HideXrayDomainQuicEncrypt();
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- //显示QUIC Key
- ShowXayPathSeedKey();
- TextBlockXrayShowPathSeedKey.Text = "QUIC Key:";
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
- //显示Quic加密方式
- ShowXrayDomainQuicEncrypt();
- TextBlockXrayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockQuicEncryption").ToString();
- TextBlockCurrentlySelectedPlanDomainXray.Text = ReceiveConfigurationParameters[3]; //Quic加密方式
- if (String.Equals(TextBlockCurrentlySelectedPlanDomain.Text, "none") == true)
- {
- HideXayPathSeedKey();
- }
-
-
- //隐藏伪装网站
- HideXrayMaskSites();
- }
- }
-
- #region 当前方案界面控制
- //显示端口与UUID
- private void ShowXrayCurrentPortUUID()
- {
- TextBlockXrayShowPort.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortXray.Visibility = Visibility.Visible;
-
- TextBlockXrayShowUUID.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDXray.Visibility = Visibility.Visible;
- }
-
- //显示Path/mKCP Seed/Quic Key
- private void ShowXayPathSeedKey()
- {
- HideVlessVmessXtlsTcpWsXray();
- TextBlockXrayShowPathSeedKey.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Visibility = Visibility.Visible;
- }
-
- //隐藏Path/mKCP Seed/Quic Key
- private void HideXayPathSeedKey()
- {
- TextBlockXrayShowPathSeedKey.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSeedKeyXray.Visibility = Visibility.Hidden;
- }
-
- //显示VLESS VMESS XTLS TCP WS 复合方案
- private void ShowVlessVmessXtlsTcpWsXray()
- {
- HideXayPathSeedKey();
- GridVlessVmessXtlsTcpWsXray.Visibility = Visibility.Visible;
- TextBlockBoxPathVlessWSXray.Text = ReceiveConfigurationParameters[3];
- TextBlockBoxPathVmessTcpXray.Text = ReceiveConfigurationParameters[9];
- TextBlockBoxPathVmessWSXray.Text = ReceiveConfigurationParameters[6];
- }
-
- //隐藏VLESS VMESS XTLS TCP WS 复合方案
- private void HideVlessVmessXtlsTcpWsXray()
- {
- GridVlessVmessXtlsTcpWsXray.Visibility = Visibility.Collapsed;
- }
-
- //显示域名/Quic加密方式
- private void ShowXrayDomainQuicEncrypt()
- {
- TextBlockXrayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainXray.Visibility = Visibility.Visible;
- TextBlockXrayShowCurrentlySelectedPlanDomain.Text = Application.Current.FindResource("TextBlockV2RayDomain").ToString();
- TextBlockCurrentlySelectedPlanDomainXray.Text = ReceiveConfigurationParameters[4]; //域名
-
- }
-
- //隐藏域名/Quic加密方式
- private void HideXrayDomainQuicEncrypt()
- {
- TextBlockXrayShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainXray.Visibility = Visibility.Hidden;
- }
- //显示伪装网站
- private void ShowXayMaskSites()
- {
- TextBlockXrayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Visibility = Visibility.Visible;
- }
-
- //隐藏伪装网站
- private void HideXrayMaskSites()
- {
- TextBlockXrayShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsiteXray.Visibility = Visibility.Hidden;
- }
- #endregion
-
- //传送Xray模板参数,启动Xray安装进程
- private void ButtonXraySetUP_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true
- || String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || ReceiveConfigurationParameters[0].Contains("mKCP") == true
- || ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- testDomain = false;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- testDomain = true;
-
- }
-
-
- //Thread thread
- //SetUpProgressBarProcessing(0); //重置安装进度
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- //Thread thread = new Thread(() => StartSetUpXray(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing));
- Thread thread = new Thread(() => StartSetUpXray(connectionInfo));
-
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
-
- }
-
- //登录远程主机布署Xray程序
- private void StartSetUpXray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测系统是否符合安装要求 11--30
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测校对时间 31--33
- functionResult = CheckProofreadingTime(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名解析是否正确 34---36
- if (testDomain == true)
- {
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
-
- //下载安装脚本安装 37--40
- //functionResult = ProxySoftInstall(client, @"Xray", @"https://raw.githubusercontent.com/v2fly/fhs-install-Xray/master/install-release.sh");
- functionResult = ProxySoftInstall(client, @"Xray", @"https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh");
-
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = XrayInstallScript(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成服务端配置 44--46
- functionResult = GenerateServerConfigurationXray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ****** 47--50
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- string serverRemoteConfig = @"/usr/local/etc/xray/config.json";
- UploadConfig(connectionInfo, @"config.json", serverRemoteConfig);
- File.Delete(@"config.json");
- SetUpProgressBarProcessing(50);
-
- //如果使用http2/WebSocketTLS/tcpTLS/VlessTcpTlsWeb/VLESS+TCP+XTLS+Web模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装acme.sh与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装证书到Xray 58--60
- functionResult = CertInstallToXray(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
-
- #region Caddy安装 61--70
-
- //如果是VLESS+TCP+XTLS+Web/VLESS+TCP+TLS+Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web/WebSocket+TLS+Web/http2Web模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //安装Caddy 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #region 上传Caddy配置文件 67--70
-
- //******"上传Caddy配置文件"******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = "";
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\vlessTcpTlsWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\WebSocketTLSWeb.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\xray\caddy\Http2Web.caddyfile";
- }
-
- string upLoadPath = "/etc/caddy/Caddyfile";
- client.RunCommand("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak");
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- functionResult = FileCheckExists(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false)
- {
- //****** "Caddy配置文件上传失败!" ******32
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //****** "Caddy配置文件上传成功,OK!" ******32
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- #endregion
-
- //启动Caddy服务
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- }
- #endregion
-
- //****** "正在启动Xray......" ******35
- functionResult = SoftStartDetect(client, "xray", @"/usr/local/bin/xray");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //测试BBR条件,若满足提示是否启用
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //生成客户端配置 96--98
- functionResult = GenerateClientConfigurationXray();
-
- //****** "Xray安装成功,祝你玩的愉快!!" ******40
- SetUpProgressBarProcessing(100);
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //显示服务端连接参数
- proxyType = "Xray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
-
- }
- }
- catch (Exception ex1)//例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- #region Xray专用调用函数
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- /* private bool ProxySoftInstallV2ray(SshClient client, string proxyName, string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName} --version v4.32.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- } */
-
-
- //生成Xray服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationXray(SshClient client)
- {
- SetUpProgressBarProcessing(44);
- //修改xray.service
-
- sshShellCommand = $"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备用下载地址:https://raw.githubusercontent.com/proxysu/Resources/master/xray/xray.service
-
- //sshShellCommand = $"yes | curl -o /etc/systemd/system/xray.service https://raw.githubusercontent.com/proxysu/Resources/master/xray/xray.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //备份原来的文件
- functionResult = FileCheckExists(client, @"/usr/local/etc/xray/config.json");
- if (functionResult == true)
- {
-
- sshShellCommand = @"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- //读取配置文件各个模块
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\base.json";
-
- //配置文件模块合成
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- serverJson["reverse"] = jObjectJson["reverse"];
- }
-
- //依据安装模式读取相应模板
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_http_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcp_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\tcpTLSselfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_tcp_xtls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_tcp_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_ws_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_http2_tls_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_vmess_xtls_tcp_websocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\webSocket_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocket_TLS_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocketTLS_selfSigned_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\WebSocketTLSWeb_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\http2_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\Http2Web_server_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\Http2selfSigned_server_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\vless_mkcp_server_config.json";
- }
- else
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\mkcp_server_config.json";
- }
-
- }
-
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\quic_server_config.json";
- }
-
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJsonTmp = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- var jObjectJson = (dynamic)jObjectJsonTmp;
-
- //Padavan路由固件服务端设置(因为客户端分流有问题所以在服务端弥补)加上后会影响一定的速度
-
- //string sniffingAddServer = $"{pwdir}" + @"TemplateConfg\xray\server\05_inbounds\00_padavan_router.json";
- //using (StreamReader readerSniffingJson = File.OpenText(sniffingAddServer))
- //{
- // JObject jObjectSniffingJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerSniffingJson));
- // jObjectJson["inbounds"][0]["sniffing"] = jObjectSniffingJson["sniffing"];
- //}
-
- //设置uuid
- jObjectJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //除WebSocketTLSWeb/http2Web/VLESS+WebSocket+TLS+Web/VLESS+http2+TLS+Web模式外设置监听端口
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "http2Web") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == false)
- {
- jObjectJson["inbounds"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- }
-
- //设置VLESS协议的回落端口,指向Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- }
- //设置VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web协议
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == true)
- {
- //设置Caddy随机监听的端口
- randomCaddyListenPort = GetRandomPort();
-
- //指向Caddy监听的随机端口
- jObjectJson["inbounds"][1]["settings"]["fallbacks"][0]["dest"] = randomCaddyListenPort;
- //设置其他模式的UUID
- jObjectJson["inbounds"][1]["settings"]["clients"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][2]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][3]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["inbounds"][4]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
-
- //设置Vless回落与分流的Path
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][1]["path"] = ReceiveConfigurationParameters[3];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][2]["path"] = ReceiveConfigurationParameters[9];
- jObjectJson["inbounds"][0]["settings"]["fallbacks"][3]["path"] = ReceiveConfigurationParameters[6];
-
- //设置Vless ws Path
- jObjectJson["inbounds"][2]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
- //设置Vmess tcp Path
- jObjectJson["inbounds"][3]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
- //设置Vmess ws Path
- jObjectJson["inbounds"][4]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- }
-
- //TLS自签证书/WebSocketTLS(自签证书)/http2自签证书模式下,使用v2ctl 生成自签证书
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- string selfSignedCa = client.RunCommand("/usr/local/bin/xray tls cert --ca").Result;
- JObject selfSignedCaJObject = JObject.Parse(selfSignedCa);
- jObjectJson["inbounds"][0]["streamSettings"]["tlsSettings"]["certificates"][0] = selfSignedCaJObject;
- }
-
- //如果是WebSocketTLSWeb/WebSocketTLS/WebSocketTLS(自签证书)/VLESS+WebSocket+TLS+Web模式,则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2/http2Web/http2自签/VLESS+http2+TLS+Web模式下,设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //如果是Http2+Web/VLESS+http2+TLS+Web模式下,设置host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //mkcp模式下,设置伪装类型
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //quic模式下设置伪装类型及密钥
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
-
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["inbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- serverJson["inbounds"] = jObjectJson["inbounds"];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- SetUpProgressBarProcessing(46);
- return true;
- }
-
- //安装证书到Xray 58--60
- //functionResult = CertInstallToXray(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CertInstallToXray(SshClient client)
- {
- //****** "安装证书到Xray......" ******26
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mkdir -p /usr/local/etc/xray/ssl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/xray/ssl/xray_ssl.crt --keypath /usr/local/etc/xray/ssl/xray_ssl.key --capath /usr/local/etc/xray/ssl/xray_ssl.crt --reloadcmd \"systemctl restart xray\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/xray/ssl/xray_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Xray!" ******27
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Xray失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Xray" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- //设置私钥权限
- sshShellCommand = @"chmod 644 /usr/local/etc/xray/ssl/xray_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- return true;
- }
-
- //生成Xray客户端配置 96--98
- //functionResult = GenerateClientConfiguration();
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateClientConfigurationXray()
- {
- //****** "生成客户端配置......" ******39
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string logConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\00_log\00_log.json";
- string apiConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\01_api\01_api.json";
- string dnsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\02_dns\02_dns.json";
- string routingConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\03_routing\03_routing.json";
- string policyConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\04_policy\04_policy.json";
- string inboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\05_inbounds\05_inbounds.json";
- string outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\06_outbounds.json";
- string transportConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\07_transport\07_transport.json";
- string statsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\08_stats\08_stats.json";
- string reverseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\09_reverse\09_reverse.json";
- string baseConfigJson = $"{pwdir}" + @"TemplateConfg\xray\base.json";
- //Thread.Sleep(1000);
- if (!Directory.Exists("xray_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("xray_config");//创建该文件夹
- }
-
- using (StreamReader reader = File.OpenText(baseConfigJson))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //读取"log"
- using (StreamReader readerJson = File.OpenText(logConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["log"] = jObjectJson["log"];
- }
- //读取"api"
- using (StreamReader readerJson = File.OpenText(apiConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["api"] = jObjectJson["api"];
- }
- //读取"dns"
- using (StreamReader readerJson = File.OpenText(dnsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["dns"] = jObjectJson["dns"];
- }
- //读取"routing"
- using (StreamReader readerJson = File.OpenText(routingConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["routing"] = jObjectJson["routing"];
- }
- //读取"policy"
- using (StreamReader readerJson = File.OpenText(policyConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["policy"] = jObjectJson["policy"];
- }
- //读取"inbounds"
- using (StreamReader readerJson = File.OpenText(inboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["inbounds"] = jObjectJson["inbounds"];
- }
- //读取"outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["outbounds"] = jObjectJson["outbounds"];
- }
- //读取"transport"
- using (StreamReader readerJson = File.OpenText(transportConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["transport"] = jObjectJson["transport"];
- }
- //读取"stats"
- using (StreamReader readerJson = File.OpenText(statsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["stats"] = jObjectJson["stats"];
- }
- //读取"reverse"
- using (StreamReader readerJson = File.OpenText(reverseConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
- clientJson["reverse"] = jObjectJson["reverse"];
- }
-
- //根据不同的安装方案,选择相应的客户端模板
- if (String.Equals(ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- //根据选择的不同模式,选择相应的配置文件
- if (String.Equals(ReceiveConfigurationParameters[0], "TCP") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_http_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcp_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\tcpTLSselfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_ws_tls_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_http2_tls_server_config.json";
- }
-
- else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\webSocket_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocket_TLS_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLS_selfSigned_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\http2_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\Http2Web_client_config.json";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\Http2selfSigned_client_config.json";
- }
- //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (mKCPvlessIsSet == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_mkcp_client_config.json";
- }
- else
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\mkcp_client_config.json";
- }
-
- }
- // else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
- else if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- outboundsConfigJson = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\quic_client_config.json";
- }
-
-
- //读取"相应模板的outbounds"
- using (StreamReader readerJson = File.OpenText(outboundsConfigJson))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
-
- //设置WebSocket模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2模式下的path
- if (String.Equals(ReceiveConfigurationParameters[0], "Http2") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "http2selfSigned") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[6];
- }
-
- //设置http2+TLS+Web/VLESS+http2+TLS+Web模式下的host
- if (String.Equals(ReceiveConfigurationParameters[0], "http2Web") == true
- || String.Equals(ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["httpSettings"]["host"][0] = ReceiveConfigurationParameters[4];
- }
-
- //设置VLESS+TCP+XTLS+Web模式下的serverName
- //if (String.Equals(ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- //{
- // jObjectJson["outbounds"][0]["streamSettings"]["xtlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
- //}
-
- //设置mkcp
- if (ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[6]) == false)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["kcpSettings"]["seed"] = ReceiveConfigurationParameters[6];
- }
- }
-
- //设置QUIC
- if (ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["security"] = ReceiveConfigurationParameters[3];
- if (String.Equals(ReceiveConfigurationParameters[3], "none") == true)
- {
- ReceiveConfigurationParameters[6] = "";
- }
- jObjectJson["outbounds"][0]["streamSettings"]["quicSettings"]["key"] = ReceiveConfigurationParameters[6];
- }
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
-
- }
-
- using (StreamWriter sw = new StreamWriter(@"xray_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
-
- #endregion
-
- }
- else
- {
- //复合方案所需要的配置文件
- //VLESS over TCP with XTLS模式
- string outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_xtls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_tcp_xtls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_tcp_xtls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_tcp_xtls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_tcp_tls_caddy_cilent_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VLESS over WS with TLS 模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vless_ws_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vless_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vless_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vless_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\vmess_tcp_tls_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tcpSettings"]["header"]["request"]["path"][0] = ReceiveConfigurationParameters[9];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vmess_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vmess_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vmess_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //VMess over WS with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\WebSocketTLSWeb_client_config.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["vnext"][0]["users"][0]["id"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[6];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\vmess_ws_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\vmess_ws_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\vmess_ws_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //Trojan over TCP with TLS模式
- outboundsConfigJsons = $"{pwdir}" + @"TemplateConfg\xray\client\06_outbounds\trojan_tcp_tls.json";
- using (StreamReader readerJson = File.OpenText(outboundsConfigJsons))
- {
- JObject jObjectJson = (JObject)JToken.ReadFrom(new JsonTextReader(readerJson));
-
- //设置客户端的地址/端口/id
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["address"] = ReceiveConfigurationParameters[4];
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["port"] = int.Parse(ReceiveConfigurationParameters[1]);
- jObjectJson["outbounds"][0]["settings"]["servers"][0]["password"] = ReceiveConfigurationParameters[2];
- jObjectJson["outbounds"][0]["streamSettings"]["tlsSettings"]["serverName"] = ReceiveConfigurationParameters[4];
-
- clientJson["outbounds"] = jObjectJson["outbounds"];
- if (!Directory.Exists(@"xray_config\trojan_tcp_tls_client_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(@"xray_config\trojan_tcp_tls_client_config");//创建该文件夹
- }
- using (StreamWriter sw = new StreamWriter(@"xray_config\trojan_tcp_tls_client_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- }
- }
- SetUpProgressBarProcessing(98);
- return true;
- }
-
-
- #endregion
-
- //检测升级远程主机端的Xray版本
- private void ButtonUpdateXray_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateXray(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Xray主程序
- private void UpdateXray(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Xray......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- //Thread.Sleep(1000);
- //检测是否安装Xray
- //sshShellCommand = @"find / -name xray";
- //sshShellCommand = @"if [[ -f /usr/local/bin/xray ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/xray") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Xray"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
-
- client.Disconnect();
- return;
-
- }
-
- //sshcmd = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string xrayCurrentVersion = currentShellCommandResult;//不含字母v
-
- //sshcmd = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -s ""https://api.github.com/repos/v2fly/xray-core/releases/latest"" --connect-timeout 10| grep 'tag_name' | cut -d\"" -f4";
- sshShellCommand = @"curl -H ""Accept: application/json"" -H ""User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"" -sS ""https://api.github.com/repos/XTLS/Xray-core/releases/latest"" --connect-timeout 10 | grep 'tag_name' | cut -d\"" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string xrayNewVersion = currentShellCommandResult;//包含字母v
-
- if (xrayNewVersion.Contains(xrayCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{xrayCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{xrayNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.RunCommand(@"bash <(curl -L -s https://raw.githubusercontent.com/v2fly/fhs-install-xray/master/install-release.sh)");
- sshShellCommand = $"bash <(curl -L -s https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh)";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- //sshcmd = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"/usr/local/bin/xray -version | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- xrayCurrentVersion = currentShellCommandResult;//不含字母v
- if (xrayNewVersion.Contains(xrayCurrentVersion) == true)
- {
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- }
- }
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{xrayNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #endregion
-
- #region Trojan-go相关
-
- //打开设置TrojanGo参数窗口
- private void ButtonTrojanGoTemplate_Click(object sender, RoutedEventArgs e)
- {
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- TrojanGoTemplateWindow windowTrojanGoTemplateConfiguration = new TrojanGoTemplateWindow();
- windowTrojanGoTemplateConfiguration.Closed += windowTrojanGoTemplateConfigurationClosed;
- windowTrojanGoTemplateConfiguration.ShowDialog();
- }
- //TrojanGo模板设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTrojanGoTemplateConfigurationClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlan.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- TextBlockTrojanGoShowPort.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- return;
- }
- TextBlockTrojanGoCurrentlySelectedPlan.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockTrojanGoCurrentlySelectedPlanPort.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Text = ReceiveConfigurationParameters[2]; //UUID
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Text = ReceiveConfigurationParameters[4]; //域名
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoTLS2Web"))
- {
- TextBlockTrojanGoShowPort.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Hidden;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- TextBlockTrojanGoShowPort.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPort.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPassword.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPassword.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowPath.Text = "WebSocket Path:";
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Text = ReceiveConfigurationParameters[6]; //mKCP Seed\Quic Key\Path
-
-
- TextBlockTrojanGoShowPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanPathSeedKey.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
- TextBlockTrojanGoCurrentlySelectedPlanDomain.Visibility = Visibility.Visible;
-
- TextBlockTrojanGoShowCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- }
-
- }
-
- //传递TrojanGo参数
- private void ButtonTrojanGoSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- //****** "域名不能为空,请检查相关参数设置!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpTrojanGo(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署Trojan-Go程序
- private void StartSetUpTrojanGo(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载脚本安装Trojan-go 37--40
- functionResult = ProxySoftInstall(client, @"Trojan-go", @"https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //functionResult = TrojanGoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //生成Trojan-go服务端配置 44--46
- functionResult = GenerateServerConfigurationTrojanGo(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //上传配置文件
- string upLoadPath = "/usr/local/etc/trojan-go/config.json";
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
- File.Delete(@"config.json");
-
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "安装证书到Trojan-go......" ******
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/trojan-go/trojan-go.crt --keypath /usr/local/etc/trojan-go/trojan-go.key --capath /usr/local/etc/trojan-go/trojan-go.crt --reloadcmd \"systemctl restart trojan-go\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/trojan-go/trojan-go.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Trojan-go!" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Trojan-go失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Trojan-go" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- client.Disconnect();
- return;
- }
-
- //设置证书权限
- sshShellCommand = @"chmod 644 /usr/local/etc/trojan-go/trojan-go.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装与检测安装是否成功 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go.caddyfile";
-
- upLoadPath = "/etc/caddy/Caddyfile";
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测Trojan-go
- functionResult = SoftStartDetect(client, "trojan-go", @"/usr/local/bin/trojan-go");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("trojan-go_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("trojan-go_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go_all_config.json"; //生成的客户端配置文件
-
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- clientJson["run_type"] = "client";
- clientJson["local_addr"] = "127.0.0.1";
- clientJson["local_port"] = 1080;
- clientJson["remote_addr"] = ReceiveConfigurationParameters[4];
- clientJson["remote_port"] = 443;
- //设置密码
- clientJson["password"][0] = ReceiveConfigurationParameters[2];
- clientJson["ssl"]["sni"] = ReceiveConfigurationParameters[4];
- //如果是WebSocket协议则设置路径
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- clientJson["websocket"]["enabled"] = true;
- clientJson["websocket"]["path"] = ReceiveConfigurationParameters[6];
- clientJson["websocket"]["host"] = ReceiveConfigurationParameters[4];
- }
- //如果开启了mux,设置客户端配置文件参数
- if (String.Equals(ReceiveConfigurationParameters[9], "true") == true)
- {
- clientJson["mux"]["enabled"] = true;
- clientJson["mux"]["concurrency"] = int.Parse(ReceiveConfigurationParameters[3]);
- clientJson["mux"]["idle_timeout"] = int.Parse(ReceiveConfigurationParameters[5]);
- //if(int.TryParse(ReceiveConfigurationParameters[3],out int value) == true)
- //{
- // clientJson["mux"]["concurrency"] = value;
- //}
- //if (int.TryParse(ReceiveConfigurationParameters[5], out int value2) == true)
- //{
- // clientJson["mux"]["idle_timeout"] = value2;
- //}
- //clientJson["mux"]["idle_timeout"] = int.TryParse(ReceiveConfigurationParameters[5], out int value2);
- //clientJson["mux"]["idle_timeout"] = value2;
- }
-
- using (StreamWriter sw = new StreamWriter(@"trojan-go_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //****** "Trojan-go安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "TrojanGo";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //下载脚本安装Trojan-go 37--40
- //functionResult = TrojanGoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //private bool TrojanGoInstall(SshClient client)
- //{
- // //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- // SetUpProgressBarProcessing(37);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- // MainWindowsShowInfo(currentStatus);
-
- // //****** "正在安装Trojan-go......" ******
- // SetUpProgressBarProcessing(38);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......";
- // MainWindowsShowInfo(currentStatus);
-
- // sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // functionResult = FileCheckExists(client, @"/tmp/trojan-go.sh");
- // if (functionResult == true)
- // {
- // sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // sshShellCommand = @"rm -f /tmp/trojan-go.sh";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- // }
- // else
- // {
- // //***安装脚本下载失败!***
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- // MainWindowsShowInfo(currentStatus);
- // return false;
- // }
-
-
- // SetUpProgressBarProcessing(40);
- // return true;
- //}
-
- //生成Trojan-go服务端配置 44--46
- //functionResult = GenerateServerConfigurationTrojanGo(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool GenerateServerConfigurationTrojanGo(SshClient client)
- {
- //备份原配置文件
- sshShellCommand = @"mv /etc/trojan-go/config.json /etc/trojan-go/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\trojan-go\trojan-go_all_config.json"; //服务端配置文件
- //string upLoadPath = @"/usr/local/etc/trojan-go/config.json"; //服务端文件位置
-
- //生成服务端配置
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- //设置Caddy随机监听的端口,用于Trojan-go,Trojan,V2Ray vless TLS
- //Random random = new Random();
- randomCaddyListenPort = GetRandomPort();
-
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- serverJson["run_type"] = "server";
- serverJson["local_addr"] = "0.0.0.0";
- serverJson["local_port"] = 443;
- serverJson["remote_addr"] = "127.0.0.1";
- serverJson["remote_port"] = randomCaddyListenPort;
- //设置密码
- serverJson["password"][0] = ReceiveConfigurationParameters[2];
- //设置证书
- serverJson["ssl"]["cert"] = "/usr/local/etc/trojan-go/trojan-go.crt";
- serverJson["ssl"]["key"] = "/usr/local/etc/trojan-go/trojan-go.key";
- serverJson["ssl"]["sni"] = ReceiveConfigurationParameters[4];
-
- if (String.Equals(ReceiveConfigurationParameters[0], "TrojanGoWebSocketTLS2Web"))
- {
- serverJson["websocket"]["enabled"] = true;
- serverJson["websocket"]["path"] = ReceiveConfigurationParameters[6];
- serverJson["websocket"]["host"] = ReceiveConfigurationParameters[4];
- }
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
-
-
- SetUpProgressBarProcessing(46);
- return true;
- }
-
-
- //检测升级Trojan-Go版本传递参数
- private void ButtonUpdateTrojanGo_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- Thread thread = new Thread(() => UpdateTojanGo(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Trojan-go主程序
- private void UpdateTojanGo(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Trojan-go......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- //string cmdTestTrojanInstalled = @"find / -name trojan-go";
-
- //sshShellCommand = @"find / -name trojan-go";
- //sshShellCommand = @"if [[ -f /usr/local/bin/trojan-go ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Trojan-go"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
- SetUpProgressBarProcessing(40);
- //获取当前安装的版本
- //string sshcmd = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string trojanCurrentVersion = currentShellCommandResult;//含字母v
-
- //获取最新版本
- //sshcmd = @"curl -s https://api.github.com/repos/p4gefau1t/trojan-go/tags | grep 'name' | cut -d\"" -f4 | head -1";
- sshShellCommand = @"curl -s https://api.github.com/repos/p4gefau1t/trojan-go/tags | grep 'name' | cut -d\"" -f4 | head -1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string trojanNewVersion = currentShellCommandResult;//含字母v
-
- if (trojanNewVersion.Equals(trojanCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{trojanCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //备份配置文件
- //sshcmd = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- //client.RunCommand(sshcmd);
- //升级Trojan-Go主程序
- //client.RunCommand("curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh");
- //client.RunCommand("yes | bash /tmp/trojan-go.sh -f");
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
-
- //获取升级后的版本
- //sshcmd = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan-go -version)"" | head -n 1 | cut -d "" "" -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- trojanCurrentVersion = currentShellCommandResult;//含字母v
- if (trojanNewVersion.Equals(trojanCurrentVersion) == true)
- {
- //恢复原来的配置文件备份
- //sshcmd = @"rm -f /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- //sshcmd = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
-
- //****** "升级成功!当前已是最新版本!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
-
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
- #endregion
-
- #region Trojan相关
-
- //Trojan参数传递
- private void ButtonTrojanSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxTrojanSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxTrojanHostDomain.Text);
- //if (string.IsNullOrEmpty(PreTrim(TextBoxTrojanHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //传递模板类型
- ReceiveConfigurationParameters[0] = "TrojanTLS2Web";
-
- //传递域名
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxTrojanHostDomain.Text);
- //传递伪装网站
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxTrojanSites.Text));
-
- //传递服务端口
- ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- ReceiveConfigurationParameters[2] = TextBoxTrojanPassword.Text.ToString();
-
- //启动布署进程
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpTrojan(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署Trojan程序
- private void StartSetUpTrojan(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //检测是否为64位系统
- sshShellCommand = @"uname -m";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmd = currentShellCommandResult;
- if (resultCmd.Contains("x86_64") == false)
- {
- //******"请在x86_64系统中安装Trojan" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_PleaseInstallSoftAtX64").ToString() + "NaiveProxy......");
- //****** "系统环境不满足要求,安装失败!!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_MissingSystemComponents").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载安装脚本安装 37-40
- functionResult = ProxySoftInstall(client, @"Trojan", @"https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "正在安装Trojan......" ******
- //SetUpProgressBarProcessing(37);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan_server_config.json"; //服务端配置文件
- string upLoadPath = @"/usr/local/etc/trojan/config.json"; //服务端文件位置
-
- //生成服务端配置
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- //设置密码
- serverJson["password"][0] = ReceiveConfigurationParameters[2];
-
- //设置Caddy随机监听的端口,用于Trojan-go,Trojan,V2Ray vless TLS
- //Random random = new Random();
- randomCaddyListenPort = GetRandomPort();
-
- //设置转发到Caddy的随机监听端口
- serverJson["remote_port"] = randomCaddyListenPort;
-
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- File.Delete(@"config.json");
-
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "安装证书到Trojan......" ******
- SetUpProgressBarProcessing(58);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = $"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /usr/local/etc/trojan/trojan_ssl.crt --keypath /usr/local/etc/trojan/trojan_ssl.key --capath /usr/local/etc/trojan/trojan_ssl.crt --reloadcmd \"systemctl restart trojan\"";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [ ! -f ""/usr/local/etc/trojan/trojan_ssl.key"" ]; then echo ""0""; else echo ""1""; fi | head -n 1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //****** "证书成功安装到Trojan!" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftOK").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书安装到Trojan失败,原因未知,可以向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IntallCertToSoftFail").ToString() +
- "Trojan" +
- Application.Current.FindResource("DisplayInstallInfo_InstallCertFailAsk").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //设置证书权限
- sshShellCommand = @"chmod 644 /usr/local/etc/trojan/trojan_ssl.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan.caddyfile";
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测Trojan
- functionResult = SoftStartDetect(client, "trojan", @"/usr/local/bin/trojan");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
- if (!Directory.Exists("trojan_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("trojan_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\trojan\trojan_client_config.json"; //生成的客户端配置文件
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- clientJson["remote_addr"] = ReceiveConfigurationParameters[4];
- clientJson["remote_port"] = int.Parse(ReceiveConfigurationParameters[1]);
- clientJson["password"][0] = ReceiveConfigurationParameters[2];
-
- using (StreamWriter sw = new StreamWriter(@"trojan_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
- //****** "Trojan安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "Trojan";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //检测升级远程主机Trojan版本传递参数
- private void ButtonUpdateTrojan_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => UpdateTojan(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //升级Trojan主程序
- private void UpdateTojan(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //******"检测系统是否已经安装Trojan......"******
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
-
- //string cmdTestTrojanInstalled = @"find / -name trojan";
- //string resultCmdTestTrojanInstalled = client.RunCommand(cmdTestTrojanInstalled).Result;
- //sshShellCommand = @"find / -name trojan";
- //sshShellCommand = @"if [[ -f /usr/local/bin/trojan ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == false)
- //if (currentShellCommandResult.Trim().Equals("0") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == false)
- {
- //******"退出!原因:远程主机未安装Trojan"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
-
- }
-
- SetUpProgressBarProcessing(40);
-
- //获取当前安装的版本
- //string sshcmd = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- //string trojanCurrentVersion = client.RunCommand(sshcmd).Result;//不含字母v
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string trojanCurrentVersion = currentShellCommandResult;//不含字母v
-
-
- //sshcmd = @"curl -fsSL https://api.github.com/repos/trojan-gfw/trojan/releases/latest | grep tag_name | sed -E 's/.*""v(.*)"".*/\1/'";
- //获取最新版本
-
- sshShellCommand = @"curl -fsSL https://api.github.com/repos/trojan-gfw/trojan/releases/latest | grep tag_name | sed -E 's/.*""v(.*)"".*/\1/'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string trojanNewVersion = currentShellCommandResult;//不含字母v
-
- if (trojanNewVersion.Equals(trojanCurrentVersion) == false)
- {
- MessageBoxResult messageBoxResult = MessageBox.Show(
- //****** "远程主机当前版本为:v" ******
- Application.Current.FindResource("DisplayInstallInfo_CurrentVersion").ToString() +
- $"{trojanCurrentVersion}\n" +
- //****** "最新版本为:" ******
- Application.Current.FindResource("DisplayInstallInfo_NewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "是否升级为最新版本?" ******
- Application.Current.FindResource("DisplayInstallInfo_IsOrNoUpgradeNewVersion").ToString(), "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- //****** "正在升级到最新版本......" ******
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartUpgradeNewVersion").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "备份Trojan配置文件......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BackTrojanConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //string sshcmd = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json /usr/local/etc/trojan/config.json.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //升级Trojan主程序
- //client.RunCommand("curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
- //client.RunCommand("yes | bash /tmp/trojan-quickstart.sh");
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshcmd = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- sshShellCommand = @"echo ""$(/usr/local/bin/trojan -v 2>&1)"" | head -n 1 | cut -d "" "" -f4";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- trojanCurrentVersion = currentShellCommandResult;//不含字母v
- //trojanCurrentVersion = client.RunCommand(sshcmd).Result;//不含字母v
- if (trojanNewVersion.Equals(trojanCurrentVersion) == true)
- {
- //****** "恢复Trojan配置文件......" ******
- SetUpProgressBarProcessing(90);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_RestoreTrojanConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //sshcmd = @"rm -f /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"rm -f /usr/local/etc/trojan/config.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshcmd = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- //client.RunCommand(sshcmd);
- sshShellCommand = @"mv /usr/local/etc/trojan/config.json.bak /usr/local/etc/trojan/config.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "升级成功!当前已是最新版本!" ******
- SetUpProgressBarProcessing(100);
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString());
- //****** "升级成功!当前已是最新版本!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "升级失败,原因未知,请向开发者提问!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString());
- //****** "升级失败,原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNewVersionFail").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
-
- else
- {
- //****** "升级取消,退出!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeVersionCancel").ToString();
- MainWindowsShowInfo(currentStatus);
-
- client.Disconnect();
- return;
- }
- }
- else
- {
- //****** "远程主机当前已是最新版本:" ******
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_IsNewVersion").ToString() +
- $"{trojanNewVersion}\n" +
- //****** "无需升级!退出!" ******
- Application.Current.FindResource("DisplayInstallInfo_NotUpgradeVersion").ToString();
- MessageBox.Show(currentStatus);
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新Trojan的密码
- private void ButtonTrojanPassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxTrojanPassword.Text = RandomUUID();
- }
- #endregion
-
- #region NaiveProxy相关
-
- //NaiveProxy一键安装开始传递参数
- private void ButtonNavieSetUp_Click(object sender, RoutedEventArgs e)
- {
- //if (string.IsNullOrEmpty(PreTrim(TextBoxNaiveHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
-
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
-
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxNaiveSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxNaiveHostDomain.Text);
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //传递参数
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxNaiveHostDomain.Text);//传递域名
- ReceiveConfigurationParameters[1] = "443";//传递端口
- ReceiveConfigurationParameters[3] = TextBoxNaiveUser.Text;//传递用户名
- ReceiveConfigurationParameters[2] = TextBoxNaivePassword.Text;//传递密码
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxNaiveSites.Text));//传递伪装网站
-
- //启动布署进程
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpNaive(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署NaiveProxy程序
- private void StartSetUpNaive(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //安装代理程序 37--40
- functionResult = ProxySoftInstall(client, @"NaiveProxy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- //SetUpProgressBarProcessing(60);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- ////Caddy安装与检测安装是否成功 61--66
- //functionResult = CaddyInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- ////使用带插件的Caddy替换
- ////****** "正在为NaiveProxy升级服务端!" ******
- ////SetUpProgressBarProcessing(76);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNaiveProxy").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/caddy.zip https://raw.githubusercontent.com/proxysu/Resources/master/Caddy2/caddy2.zip";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //functionResult = FileCheckExists(client, @"/tmp/caddy.zip");
- //if (functionResult == false)
- //{
- // //***文件下载失败!***
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- // MainWindowsShowInfo(currentStatus);
- // return;
- //}
- //sshShellCommand = @"yes | unzip -o /tmp/caddy.zip";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"chmod +x ./caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"systemctl stop caddy;rm -f /usr/bin/caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"cp caddy /usr/bin/";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/caddy.zip caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- ////****** "升级完毕,OK!" ******
- ////SetUpProgressBarProcessing(79);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_UpgradeNaiveProxyOK").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //生成服务端配置
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_server.caddyfile";
- string upLoadPath = @"/etc/caddy/Caddyfile";
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
- //$"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"
- //$"sed -i 's/##basicauth##/basicauth {ReceiveConfigurationParameters[3]} {ReceiveConfigurationParameters[2]}/' {upLoadPath}"
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, upLoadPath);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- sshShellCommand = $"sed -i 's/##basicauth##/basic_auth {ReceiveConfigurationParameters[3]} {ReceiveConfigurationParameters[2]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/file_server/#file_server/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string caddyConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_server_config.json";
- //using (StreamReader reader = File.OpenText(caddyConfig))
- //{
- // JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][0]["handle"][0]["auth_user"] = ReceiveConfigurationParameters[3];//----用户名
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][0]["handle"][0]["auth_pass"] = ReceiveConfigurationParameters[2]; //----密码
-
- // serverJson["apps"]["http"]["servers"]["srv0"]["routes"][1]["match"][0]["host"][0] = ReceiveConfigurationParameters[4]; //----域名
-
- // serverJson["apps"]["http"]["servers"]["srv0"]["tls_connection_policies"][0]["match"]["sni"][0] = ReceiveConfigurationParameters[4]; //----域名
-
- // serverJson["apps"]["tls"]["automation"]["policies"][0]["subjects"][0] = ReceiveConfigurationParameters[4]; //-----域名
- // serverJson["apps"]["tls"]["automation"]["policies"][0]["issuer"]["email"] = $"user@{ReceiveConfigurationParameters[4]}"; //-----邮箱
- // //保存配置文件
- // using (StreamWriter sw = new StreamWriter(@"config.json"))
- // {
- // sw.Write(serverJson.ToString());
- // }
- //}
- //string upLoadPath = @"/etc/caddy/config.json";
- //UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- //File.Delete(@"config.json");
-
- //****** Caddy配置文件上传成功,OK! ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"sed -i 's/Caddyfile/config.json/' /lib/systemd/system/caddy.service";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"systemctl daemon-reload";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////设置伪装网站
- //if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false)
- //{
- // sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
- // //MessageBox.Show(sshCmd);
- // client.RunCommand(sshCmd);
- //}
- //Thread.Sleep(2000);
-
- //****** "正在优化网络参数......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OptimizeNetwork").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //优化网络参数
- sshShellCommand = @"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "优化网络参数,OK!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OptimizeNetworkOK").ToString(); ;
- MainWindowsShowInfo(currentStatus);
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("naive_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("naive_config");//创建该文件夹
- }
-
- string clientConfig = $"{pwdir}" + @"TemplateConfg\naive\naive_client_config.json"; //生成的客户端配置文件
- using (StreamReader reader = File.OpenText(clientConfig))
- {
- JObject clientJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- clientJson["proxy"] = $"https://{ReceiveConfigurationParameters[3]}:{ReceiveConfigurationParameters[2]}@{ReceiveConfigurationParameters[4]}";
- using (StreamWriter sw = new StreamWriter(@"naive_config\config.json"))
- {
- sw.Write(clientJson.ToString());
- }
- }
-
-
- //****** "NaiveProxy安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "NaiveProxy";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新NaiveProxy的密码
- private void ButtonNaivePassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNaivePassword.Text = RandomUUID();
- }
-
- //生成随机UUID
- private string RandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- //TextBoxNaivePassword.Text = uuid.ToString();
- return uuid.ToString();
- }
-
- //NaiveProxy产生随机用户名
- private string RandomUserName()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- Guid uuid = Guid.NewGuid();
- string[] pathArray = uuid.ToString().Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- // TextBoxPath.Text = $"/{path}";
- //MessageBox.Show(path);
- }
-
- //NaiveProxy更改用户名,随机方式
- private void ButtonNaiveUser_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNaiveUser.Text = RandomUserName();
- }
-
- #endregion
-
- #region SSR+TLS+Caddy相关
-
- //SSR参数传递
- private void ButtonSSRSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
-
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxSSRHostDomain.Text);
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxSSRSites.Text);
- if (domainNotEmpty == false || preDomainMask == false)
- {
- return;
- }
- //if (string.IsNullOrEmpty(PreTrim(TextBoxSSRHostDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
-
- //传递域名
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxSSRHostDomain.Text);
- //传递伪装网站
- ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxSSRSites.Text));
-
- //传递服务端口
- ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- ReceiveConfigurationParameters[2] = TextBoxSSRPassword.Text.ToString();
-
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpSSR(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //登录远程主机布署SSR+TLS+Caddy程序
- private void StartSetUpSSR(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "server.py", @"/usr/local/shadowsocks/server.py");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //下载脚本安装SSR 37--40
- functionResult = ProxySoftInstall(client, @"SSR", @"https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- ////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- //SetUpProgressBarProcessing(37);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- //MainWindowsShowInfo(currentStatus);
-
- ////下载安装脚本安装
- ////****** "正在安装SSR......" ******
- //SetUpProgressBarProcessing(38);
- //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......";
- //MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yes | bash /tmp/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"rm -f /tmp/ssr.sh";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "server.py", @"/usr/local/shadowsocks/server.py");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //****** "安装完毕,上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //生成服务端配置
- string upLoadPath = @"/etc/shadowsocks.json";
-
- //设置指向Caddy监听的随机端口
- randomCaddyListenPort = GetRandomPort();
- string randomSSRListenPortStr = randomCaddyListenPort.ToString();
-
- sshShellCommand = $"sed -i 's/8800/{randomSSRListenPortStr}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置密码
- sshShellCommand = $"sed -i 's/##password##/{ReceiveConfigurationParameters[2]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //Caddy安装与检测安装是否成功 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string caddyConfig = $"{pwdir}" + @"TemplateConfg\ssr\ssr_tls.caddyfile";
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, caddyConfig, upLoadPath);
-
- functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序启动检测SSR
- functionResult = SoftStartDetect(client, "ssr", @"/usr/bin/ssr");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (!Directory.Exists("ssr_config"))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory("ssr_config");//创建该文件夹
- }
-
-
- //****** "SSR+TLS+Caddy安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "SSR+TLS+Caddy" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "SSR";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //更新SSR的密码
- private void ButtonSSRPassword_Click(object sender, RoutedEventArgs e)
- {
- TextBoxSSRPassword.Text = RandomUUID();
- }
-
-
- #endregion
-
- #region SS相关
-
- //打开SS Plugin设置窗口
- private void ButtonTemplateConfigurationSS_Click(object sender, RoutedEventArgs e)
- {
- //清空初始化模板参数
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- SSpluginWindow windowTemplateConfigurationSS = new SSpluginWindow();
- windowTemplateConfigurationSS.Closed += windowTemplateConfigurationSSClosed;
- windowTemplateConfigurationSS.ShowDialog();
- }
- //SS Plugin设置窗口关闭后,触发事件,将所选的方案与其参数显示在UI上
- private void windowTemplateConfigurationSSClosed(object sender, System.EventArgs e)
- {
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //显示"未选择方案!"
- TextBlockCurrentlySelectedPlanSS.Text = Application.Current.FindResource("TextBlockCurrentlySelectedPlanNo").ToString();
-
- TextBlockShowPortSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Hidden;
-
- TextBlockShowUUIDSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Hidden;
-
- TextBlockShowMethodSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Hidden;
-
- TextBlockShowDomainSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Hidden;
-
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
-
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsite.Visibility = Visibility.Hidden;
- return;
- }
- TextBlockCurrentlySelectedPlanSS.Text = ReceiveConfigurationParameters[8]; //所选方案名称
- TextBlockCurrentlySelectedPlanPortSS.Text = ReceiveConfigurationParameters[1]; //服务器端口
- TextBlockCurrentlySelectedPlanUUIDSS.Text = ReceiveConfigurationParameters[2]; //密码
- TextBlockCurrentlySelectedPlanMethodSS.Text = ReceiveConfigurationParameters[3]; //加密方法
- TextBlockCurrentlySelectedPlanDomainSS.Text = ReceiveConfigurationParameters[4]; //域名
- TextBlockCurrentlySelectedPlanPathSS.Text = ReceiveConfigurationParameters[6]; //WebSocket Path
- TextBlockCurrentlySelectedPlanFakeWebsite.Text = ReceiveConfigurationParameters[7]; //伪装网站
-
- if (String.Equals(ReceiveConfigurationParameters[0], "NonePluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS")
- || String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS")
- )
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //隐藏域名
- TextBlockShowDomainSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Hidden;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
- //隐藏伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Hidden;
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "QuicSS")
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS")
- )
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //显示域名
- TextBlockShowDomainSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Visible;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Hidden;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Hidden;
- //显示伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Visible;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS"))
- {
- //显示端口
- TextBlockShowPortSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPortSS.Visibility = Visibility.Visible;
- //显示密码
- TextBlockShowUUIDSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanUUIDSS.Visibility = Visibility.Visible;
- //显示加密方式
- TextBlockShowMethodSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanMethodSS.Visibility = Visibility.Visible;
- //显示域名
- TextBlockShowDomainSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanDomainSS.Visibility = Visibility.Visible;
- //隐藏WebSocket路径
- TextBlockShowPathSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanPathSS.Visibility = Visibility.Visible;
- //显示伪装网站
- TextBlockShowFakeWebsiteSS.Visibility = Visibility.Visible;
- TextBlockCurrentlySelectedPlanFakeWebsiteSS.Visibility = Visibility.Visible;
- }
-
- }
-
- //传送SS参数,启动SS安装进程
- private void Button_LoginSS_Click(object sender, RoutedEventArgs e)
-
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- //读取模板配置
-
- //生成客户端配置时,连接的服务主机的IP或者域名
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true)
- {
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);
- testDomain = false;
- }
- //选择模板
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
- {
- //******"请先选择配置模板!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ChooseTemplate").ToString());
- return;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "NonePluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS")
- || String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS")
- )
- {
- testDomain = false;
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS")
- || String.Equals(ReceiveConfigurationParameters[0], "QuicSS")
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS")
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS")
- )
- {
- testDomain = true;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpSS(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
-
- }
-
- //登录远程主机布署SS程序
- private void StartSetUpSS(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //如果使用是TLS模式,需要检测域名解析是否正确
- if (testDomain == true)
- {
- //检测域名是否解析到当前IP上 34---36
- functionResult = DomainResolutionCurrentIPDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //下载安装脚本安装
- //****** "正在安装SS,使用编译方式,时间稍长,请耐心等待............" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SS," + Application.Current.FindResource("DisplayInstallInfo_ExplainBuildSS").ToString();
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令
-
- //****** "编译中,请耐心等待............" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_CompilingSS").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread threadWaitSScompile = new Thread(() => MonitorCompileSSprocess());
- threadWaitSScompile.SetApartmentState(ApartmentState.STA);
- threadWaitSScompile.Start();
-
- //开始编译。。。
- currentShellCommandResult = client.RunCommand(sshShellCommand).Result;
- compileSSend = true; //中止显示"**"的线程
- threadWaitSScompile.Abort();
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传配置文件......" ******
- SetUpProgressBarProcessing(44);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadSoftConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/shadowsocks-libev/config.json /etc/shadowsocks-libev/config.json.1";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string getIpv4 = client.RunCommand(@"curl -4 ip.sb").Result;
- //string getIpv6 = client.RunCommand(@"wget -qO- -t1 -T2 ipv6.icanhazip.com").Result;
-
- //生成服务端配置
-
- string serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_server_config.json";
- string ssPluginType = "";
- using (StreamReader reader = File.OpenText(serverConfig))
- {
- JObject serverJson = (JObject)JToken.ReadFrom(new JsonTextReader(reader));
-
- //设置服务器监听地址
- //if (String.IsNullOrEmpty(getIpv6) == true)
- //{
- serverJson["server"] = "0.0.0.0";
- //}
- //else
- //{
- // JArray serverIp = JArray.Parse(@"[""[::0]"", ""0.0.0.0""]");
- // serverJson["server"] = serverIp;
- //}
-
- //设置密码
- serverJson["password"] = ReceiveConfigurationParameters[2];
- //设置监听端口
- serverJson["server_port"] = int.Parse(ReceiveConfigurationParameters[1]);
- //设置加密方式
- serverJson["method"] = ReceiveConfigurationParameters[3];
- //产生伪装Web的监听端口
- randomCaddyListenPort = GetRandomPort();
-
- string failoverPort = randomCaddyListenPort.ToString();
- //obfs http模式
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true)
- {
- serverJson["plugin"] = @"obfs-server";
- serverJson["plugin_opts"] = $"obfs=http;failover=127.0.0.1:{failoverPort}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"obfs-local";
- ReceiveConfigurationParameters[9] = "obfs=http;obfs-host=www.bing.com";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true)
- {
- serverJson["plugin"] = @"obfs-server";
- serverJson["plugin_opts"] = $"obfs=tls;failover=127.0.0.1:{failoverPort}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"obfs-local";
- ReceiveConfigurationParameters[9] = $"obfs=tls;obfs-host={ReceiveConfigurationParameters[4]}";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketSS") == true)
- {
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server";
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = "";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true)
- {
- serverJson["server_port"] = 10000;
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server;host={ReceiveConfigurationParameters[4]};path={ReceiveConfigurationParameters[6]}";
-
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = $"tls;host={ReceiveConfigurationParameters[4]};path={ReceiveConfigurationParameters[6]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "QuicSS") == true)
- {
- serverJson["mode"] = "tcp";
- serverJson["plugin"] = @"v2ray-plugin";
- serverJson["plugin_opts"] = $"server;mode=quic;host={ReceiveConfigurationParameters[4]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"v2ray-plugin";
- ReceiveConfigurationParameters[9] = $"mode=quic;host={ReceiveConfigurationParameters[4]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "KcptunPluginSS") == true)
- {
- serverJson["mode"] = "tcp";
- serverJson["plugin"] = @"kcptun-plugin-server";
- serverJson["plugin_opts"] = $"key={ReceiveConfigurationParameters[2]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"kcptun";
- ReceiveConfigurationParameters[9] = $"key={ReceiveConfigurationParameters[2]}";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true)
- {
- serverJson["plugin"] = @"goquiet-plugin-server";
- serverJson["plugin_opts"] = $"WebServerAddr=127.0.0.1:{failoverPort};Key={ReceiveConfigurationParameters[2]}";
- //客户端项
- ReceiveConfigurationParameters[5] = @"goquiet";
- ReceiveConfigurationParameters[9] = $"ServerName={ReceiveConfigurationParameters[4]};Key={ReceiveConfigurationParameters[2]};Browser=chrome";
-
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true)
- {
- //****** "正在安装 Cloak-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Cloak-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/cloak-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "cloak-plugin-server", @"/usr/local/bin/cloak-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- string bypassUID = client.RunCommand(@"/usr/local/bin/cloak-plugin-server -u").Result.TrimEnd('\r', '\n');
- string generateKey = client.RunCommand(@"/usr/local/bin/cloak-plugin-server -k").Result.TrimEnd('\r', '\n');
- string[] keyCloak = generateKey.Split(new char[] { ',' });
- string publicKey = keyCloak[0];
- string privateKey = keyCloak[1];
-
- serverJson["plugin"] = @"cloak-plugin-server";
- serverJson["plugin_opts"] = $"BypassUID={bypassUID};PrivateKey={privateKey};RedirAddr=127.0.0.1:{failoverPort};DatabasePath=/etc/shadowsocks-libev/userinfo.db;StreamTimeout=300";
- //客户端项
- ReceiveConfigurationParameters[5] = @"cloak";
- ReceiveConfigurationParameters[9] = $"UID={bypassUID};PublicKey={publicKey};Transport=direct;ServerName={ReceiveConfigurationParameters[4]};BrowserSig=chrome;NumConn=4;EncryptionMethod=plain;StreamTimeout=300";
-
- }
- ssPluginType = (string)serverJson["plugin"];
- using (StreamWriter sw = new StreamWriter(@"config.json"))
- {
- sw.Write(serverJson.ToString());
- }
- }
-
- string upLoadPath = @"/etc/shadowsocks-libev/config.json";
- UploadConfig(connectionInfo, @"config.json", upLoadPath);
-
- File.Delete(@"config.json");
-
- //安装所使用的插件
- if (String.Equals(ssPluginType, "obfs-server"))
- {
- //****** "正在安装 Simple-obfs Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Simple-obfs Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/obfs-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "obfs-server", @"/usr/local/bin/obfs-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- }
- else if (String.Equals(ssPluginType, "v2ray-plugin"))
- {
- //****** "正在安装 V2Ray-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " V2Ray-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/v2ray-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "v2ray-plugin", @"/usr/local/bin/v2ray-plugin");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "kcptun-plugin-server"))
- {
- //****** "正在安装 Kcptun-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " Kcptun-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/kcptun-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "kcptun-plugin-server", @"/usr/local/bin/kcptun-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "goquiet-plugin-server"))
- {
- //****** "正在安装 GoQuiet-Plugin......" ******
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + " GoQuiet-Plugin......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/goquiet-plugin-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "goquiet-plugin-server", @"/usr/local/bin/goquiet-plugin-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
- else if (String.Equals(ssPluginType, "cloak-plugin-server"))
- {
-
- }
-
-
- //如果使用v2ray-plugin Quic模式,先要安装acme.sh,申请证书
- if (String.Equals(ReceiveConfigurationParameters[0], "QuicSS") == true)
- {
- //acme.sh安装与申请证书 51--57
- functionResult = AcmeShInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
- //如果使用Web伪装网站模式,需要安装Caddy
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true
- )
- {
- //Caddy安装 61--66
- functionResult = CaddyInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "上传Caddy配置文件......" ******
- SetUpProgressBarProcessing(67);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpWebSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_obfs_http_web_config.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "ObfsPluginHttpsWebSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "GoQuietPluginSS") == true
- || String.Equals(ReceiveConfigurationParameters[0], "CloakPluginSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\ss_tls_caddy_config.caddyfile";
- }
- else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLSWebFrontSS") == true)
- {
- serverConfig = $"{pwdir}" + @"TemplateConfg\ss\WebSocketTLSWeb.caddyfile";
- }
-
- upLoadPath = @"/etc/caddy/Caddyfile";
-
- UploadConfig(connectionInfo, serverConfig, upLoadPath);
-
- //设置Caddy配置文件
- functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "Caddy配置文件上传成功,OK!" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_UploadCaddyConfigOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //程序启动检测Caddy
- functionResult = SoftStartDetect(client, "caddy", @"/usr/bin/caddy");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- }
-
- //程序启动检测SS
- functionResult = SoftStartDetect(client, "ss-server", @"/usr/local/bin/ss-server");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- client.Disconnect();//断开服务器ssh连接
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(96);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "SS安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "SS" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "SS";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
- }
-
- //编译SS时,中间监视窗口显示"****"不断增长进度,直到编译结束
- private static bool compileSSend = false;
- private void MonitorCompileSSprocess()
- {
- currentShellCommandResult = "**";
- while (compileSSend == false)
- {
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorActionNoWrap, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果
- Thread.Sleep(1000);
- }
- }
-
- #endregion
-
- #region MTProto相关
- //传递参数启动安装进程
- private void ButtonMtgSetUp_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
- //清空参数空间
- for (int i = 0; i != ReceiveConfigurationParameters.Length; i++)
-
- {
- ReceiveConfigurationParameters[i] = "";
- }
- //传递服务器地址
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text); ;
- //传递服务端口
- ReceiveConfigurationParameters[1] = PreTrim(TextBoxMtgHostPort.Text);
- //传递伪装域名
- if (String.IsNullOrEmpty(PreTrim(TextBoxMtgSites.Text)) == true)
- {
- ReceiveConfigurationParameters[7] = "azure.microsoft.com";
- }
- else
- {
- ReceiveConfigurationParameters[7] = PreTrim(TextBoxMtgSites.Text);
- }
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartSetUpMtg(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //Mtg安装进程
- private void StartSetUpMtg(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否已安装代理 8--10
- functionResult = SoftInstalledIsNoYes(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口
- functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //检测是否为64位系统
- sshShellCommand = @"uname -m";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmd = currentShellCommandResult;
- if (resultCmd.Contains("x86_64") == false)
- {
- //******"请在x86_64系统中安装MTProto" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_PleaseInstallSoftAtX64").ToString() + "MTProto......");
- //****** "系统环境不满足要求,安装失败!!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_MissingSystemComponents").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- //下载安装脚本安装MTProto 37--40
-
- functionResult = MTProtoInstall(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //程序是否安装成功检测并设置开机启动 41--43
- functionResult = SoftInstalledSuccessOrFail(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "正在启动MTProto......" ******
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoft").ToString() + "MTProto......";
- MainWindowsShowInfo(currentStatus);
-
- //启动MTProto服务
- functionResult = SoftStartDetect(client, "mtg", @"/usr/local/bin/mtg");
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- //****** "生成客户端配置......" ******
- SetUpProgressBarProcessing(80);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateClientConfig").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"cat /usr/local/etc/mtg.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = currentShellCommandResult;
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- Thread.Sleep(3000);
- sshShellCommand = @"cat /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ReceiveConfigurationParameters[9] = currentShellCommandResult;
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[9]) == true)
- {
- Thread.Sleep(3000);
- sshShellCommand = @"cat /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ReceiveConfigurationParameters[9] = currentShellCommandResult;
- }
- sshShellCommand = @"pkill mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"systemctl restart mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[9]) == true)
- {
- //***客户端配置获取失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GetClientConfigFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- FunctionResultErr();
- client.Disconnect();
- return;
- }
-
- //检测BBR,满足条件并启动 90--95
- functionResult = DetectBBRandEnable(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- client.Disconnect();//断开服务器ssh连接
-
- //Thread.Sleep(1000);
- //if (!Directory.Exists("mtproto_config"))//如果不存在就创建file文件夹
- //{
- // Directory.CreateDirectory("mtproto_config");//创建该文件夹
- //}
- //using (StreamWriter sw = new StreamWriter(@"mtproto_config\mtproto_info.json"))
- //{
- // sw.Write(currentShellCommandResult.ToString());
- //}
-
- //****** "MTProto+TLS安装成功,祝你玩的愉快!!" ******
- SetUpProgressBarProcessing(100);
- currentStatus = "MTProto+TLS" + Application.Current.FindResource("DisplayInstallInfo_ProxyInstalledOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示服务端连接参数
- proxyType = "MTProto";
-
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //下载安装脚本安装MTProto 37--40
- //functionResult = MTProtoInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool MTProtoInstall(SshClient client)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //下载安装脚本安装
- //****** "正在安装MTProto......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "MTProto......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/MTProto/mtg_install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- sshShellCommand = $"yes | bash {saveShellScriptFileName} {ReceiveConfigurationParameters[1]} {ReceiveConfigurationParameters[7]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
- #endregion
-
- #region 其他功能函数及系统工具相关
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //产生随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //产生随机字符串
- private string GenerateRandomStr(int length)
- {
- var rand = System.Security.Cryptography.RandomNumberGenerator.Create();
- byte[] bytes = new byte[length * 2];
- rand.GetBytes(bytes);
- string randStr = Convert.ToBase64String(bytes);
- randStr = randStr.Replace("+", "").Replace("/", "").Replace("=", "").Substring(0, length);
- //MessageBox.Show(randStr);
- return randStr;
- }
- //生成保存的shell脚本名称
- private string GenerateRandomScriptFileName(string filename)
- {
- return "/tmp/tmp." + filename + ".sh";
- }
- //判断目录是否存在,不存在则创建
- private static bool CheckDir(string folder)
- {
- try
- {
- if (!Directory.Exists(folder))//如果不存在就创建file文件夹
- Directory.CreateDirectory(folder);//创建该文件夹
- return true;
- }
- catch (Exception)
- {
- return false;
- }
- }
-
- //目录已存在则生成序号递增,并返回所创建的目录路径。
- private string CreateConfigSaveDir(string upperDir, string configDir)
- {
- try
- {
- //string saveFileFolderFirst = configDir;
- int num = 1;
- //string saveFileFolder;
- //saveFileFolder = EncodeURIComponent(configDir);
- string saveFileFolder = configDir.Replace(":", "_");
- CheckDir(upperDir);
- while (Directory.Exists(upperDir + @"\" + saveFileFolder) == true)
- {
- saveFileFolder = configDir + "_copy_" + num.ToString();
- num++;
- }
- CheckDir(upperDir + @"\" + saveFileFolder);
- return upperDir + @"\" + saveFileFolder;
- }
- catch (Exception)
- {
- //string saveFileFolder = "";
- //return upperDir + @"\" + saveFileFolder;
- return upperDir;
- }
-
- }
-
-
- //上传配置文件
- private void UploadConfig(ConnectionInfo connectionInfo, string uploadConfig, string upLoadPath)
- {
- try
- {
- using (var sftpClient = new SftpClient(connectionInfo))
- {
- sftpClient.Connect();
- FileStream openUploadConfigFile = File.OpenRead(uploadConfig);
- sftpClient.UploadFile(openUploadConfigFile, upLoadPath, true);
- openUploadConfigFile.Close();
- sftpClient.Disconnect();
- }
-
- }
- catch (Exception ex2)
- {
- MessageBox.Show("sftp" + ex2.ToString());
- //MessageBox.Show("sftp出现未知错误,上传文件失败,请重试!");
- return;
- }
- }
-
- //下载配置文件
- private void DownloadConfig(ConnectionInfo connectionInfo, string localConfigSavePathAndFileName, string remoteConfigPathAndFileName)
- {
- try
- {
- using (var sftpClient = new SftpClient(connectionInfo))
- {
- sftpClient.Connect();
- FileStream createDownloadConfig = File.Open(localConfigSavePathAndFileName, FileMode.Create);
- sftpClient.DownloadFile(remoteConfigPathAndFileName, createDownloadConfig);
- createDownloadConfig.Close();
-
- sftpClient.Disconnect();
- }
-
- }
- catch (Exception ex2)
- {
- MessageBox.Show("sftp" + ex2.ToString());
- //MessageBox.Show("sftp出现未知错误,下载文件失败,请重试!");
- return;
- }
- }
-
- //伪装网站处理
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // //MessageBox.Show(testDomain);
- // string[] tmpUrl = fakeUrl.Split('/');
- // //MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
-
- #region 检测系统内核是否符合安装要求
- //private static bool DetectKernelVersion(string kernelVer)
- //{
- // string[] linuxKernelCompared = kernelVer.Split('.');
- // if (int.Parse(linuxKernelCompared[0]) > 2)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
- // else if (int.Parse(linuxKernelCompared[0]) < 2)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else if (int.Parse(linuxKernelCompared[0]) == 2)
- // {
- // if (int.Parse(linuxKernelCompared[1]) > 6)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
- // else if (int.Parse(linuxKernelCompared[1]) < 6)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else if (int.Parse(linuxKernelCompared[1]) == 6)
- // {
- // if (int.Parse(linuxKernelCompared[2]) < 23)
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},V2ray要求内核为2.6.23及以上。请升级内核再安装!");
- // return false;
- // }
- // else
- // {
- // //MessageBox.Show($"当前系统内核版本为{result.Result},符合安装要求!");
- // return true;
- // }
-
- // }
- // }
- // return false;
-
- //}
- #endregion
-
- //打开系统工具中的校对时间窗口
- private void ButtonProofreadTime_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ProofreadTimeWindow proofreadTimeWindow = new ProofreadTimeWindow();
- ProofreadTimeWindow.ProfreadTimeReceiveConnectionInfo = connectionInfo;
-
- proofreadTimeWindow.ShowDialog();
-
- }
- //释放80/443端口
- private void ButtonClearOccupiedPorts_Click(object sender, RoutedEventArgs e)
- {
- //****** "80/443端口之一,或全部被占用,将强制停止占用80/443端口的程序?" ******
- MessageBoxResult dialogResult = MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorPortUsed").ToString(), "Stop application", MessageBoxButton.YesNo);
- if (dialogResult == MessageBoxResult.No)
- {
- return;
- }
-
- ConnectionInfo testconnect = GenerateConnectionInfo();
- try
- {
- using (var client = new SshClient(testconnect))
- {
- client.Connect();
-
- //检测是否运行在root权限下
- string testRootAuthority = client.RunCommand(@"id -u").Result;
- if (testRootAuthority.Equals("0\n") == false)
- {
- //******"请使用具有root权限的账户登录主机!!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorRootPermission").ToString());
- client.Disconnect();
- return;
- }
- string cmdTestPort;
- string cmdResult;
- cmdTestPort = @"lsof -n -P -i :443 | grep LISTEN";
- cmdResult = client.RunCommand(cmdTestPort).Result;
-
- if (String.IsNullOrEmpty(cmdResult) == false)
- {
-
- string[] cmdResultArry443 = cmdResult.Split(' ');
- client.RunCommand($"systemctl stop {cmdResultArry443[0]}");
- client.RunCommand($"systemctl disable {cmdResultArry443[0]}");
- client.RunCommand($"kill -9 {cmdResultArry443[3]}");
- }
-
- cmdTestPort = @"lsof -n -P -i :80 | grep LISTEN";
- cmdResult = client.RunCommand(cmdTestPort).Result;
- if (String.IsNullOrEmpty(cmdResult) == false)
- {
- string[] cmdResultArry80 = cmdResult.Split(' ');
- client.RunCommand($"systemctl stop {cmdResultArry80[0]}");
- client.RunCommand($"systemctl disable {cmdResultArry80[0]}");
- client.RunCommand($"kill -9 {cmdResultArry80[3]}");
- }
- //****** "80/443端口释放完毕!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ReleasePortOK").ToString());
- client.Disconnect();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- //启用BBR
- private void ButtonTestAndEnableBBR_Click(object sender, RoutedEventArgs e)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartTestAndEnableBBR(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- //启用BBR的主要进程
- private void StartTestAndEnableBBR(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- onlyIpv6 = false;
- getApt = false;
- getDnf = false;
- getYum = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- SetUpProgressBarProcessing(30);
- //****** "BBR测试......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"uname -r";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string[] linuxKernelVerStrBBR = currentShellCommandResult.Split('-');
-
- bool detectResultBBR = DetectKernelVersionBBR(linuxKernelVerStrBBR[0]);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- string resultCmdTestBBR = currentShellCommandResult;
- //如果内核满足大于等于4.9,且还未启用BBR,则启用BBR
- if (detectResultBBR == true && resultCmdTestBBR.Contains("bbr") == false)
- {
- SetUpProgressBarProcessing(60);
- //****** "正在启用BBR......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else if (resultCmdTestBBR.Contains("bbr") == true)
- {
- SetUpProgressBarProcessing(100);
- //****** "BBR已经启用了!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRisEnabled").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- client.Disconnect();//断开服务器ssh连接
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- //检测要启用BBR主要的内核版本
- private static bool DetectKernelVersionBBR(string kernelVer)
- {
- string[] linuxKernelCompared = kernelVer.Split('.');
- if (int.Parse(linuxKernelCompared[0]) > 4)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[0]) < 4)
- {
- return false;
- }
- else if (int.Parse(linuxKernelCompared[0]) == 4)
- {
- if (int.Parse(linuxKernelCompared[1]) >= 9)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[1]) < 9)
- {
- return false;
- }
-
- }
- return false;
-
- }
-
- //启动卸载代理
- private void ButtonRemoveAllSoft_Click(object sender, RoutedEventArgs e)
- {
- //******"仅支持卸载由ProxySU安装的代理软件及相关配置,请确保重要配置已备份。不支持卸载使用其他方法或脚本安装的代理。确定要卸载远程主机上的代理软件吗?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_RemoveAllSoft").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
-
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => StartRemoveProxySoft(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
-
- }
- //卸载代理进程
- private void StartRemoveProxySoft(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- //Thread.Sleep(3000);
- }
-
-
- //检测root权限 5--7
- functionResult = RootAuthorityDetect(client);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
- functionResult = FileCheckExists(client, @"/etc/resolv.conf.proxysu");
- if (functionResult == true)
- {
- sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf ";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- sshShellCommand = @"command -v apt-get";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getApt = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v dnf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getDnf = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v yum";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getYum = !String.IsNullOrEmpty(currentShellCommandResult);
-
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- sshCmdUpdate = @"apt-get update";
- //sshCmdInstall = @"apt-get -y install ";
- }
- else if (getDnf == true)
- {
- sshCmdUpdate = @"dnf clean all;dnf makecache";
- //sshCmdInstall = @"dnf -y install ";
- }
- else if (getYum == true)
- {
- sshCmdUpdate = @"yum clean all; yum makecache";
- //sshCmdInstall = @"yum -y install ";
- }
-
- //检测主机是否为纯ipv6的主机
- onlyIpv6 = OnlyIpv6HostDetect(client);
-
- //如果未检测到有效的ip,连接就会被断开
- if (client.IsConnected == false)
- {
- return;
- }
- if (onlyIpv6 == true)
- {
- functionResult = SetUpNat64(client, true);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- //SetUpNat64(client, true);
- //sshShellCommand = $"{sshCmdUpdate}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- //******"开始卸载......"******
- SetUpProgressBarProcessing(10);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString() + "......";
- MainWindowsShowInfo(currentStatus);
-
- #region 卸载V2Ray
-
- //******"检测系统是否已经安装V2ray......"******03
- SetUpProgressBarProcessing(11);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == true)
- {
- //******"检测到已安装V2Ray!开始卸载V2Ray......"******
- SetUpProgressBarProcessing(12);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "V2Ray!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "V2Ray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/v2ray /var/log/v2ray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
- if (functionResult == true)
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
- {
- //******"V2Ray卸载失败!请向开发者问询!"******
- currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"V2Ray卸载成功!"******
- SetUpProgressBarProcessing(16);
- currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装V2Ray!"******04
- SetUpProgressBarProcessing(16);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "V2Ray!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载Trojan-go
-
- //******"检测系统是否已经安装Trojan-go......"******03
- SetUpProgressBarProcessing(17);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name trojan-go";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == true)
- {
- //******"检测到已安装Trojan-go,开始卸载Trojan-go......"******
- SetUpProgressBarProcessing(18);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Trojan-go!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Trojan-go......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/trojan-go /var/log/trojan-go";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name trojan-go";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
- if (functionResult == true)
- {
- //******"Trojan-go卸载失败!请向开发者问询!"******
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Trojan-go卸载成功!"******
- SetUpProgressBarProcessing(22);
- currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Trojan-go!"******04
- SetUpProgressBarProcessing(22);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Trojan-go!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载Trojan
-
- //******"检测系统是否已经安装Trojan......"******03
- SetUpProgressBarProcessing(23);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name trojan";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == true)
- {
- //******"检测到已安装Trojan,开始卸载Trojan......"******
- SetUpProgressBarProcessing(24);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Trojan!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Trojan......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/bin/trojan /etc/systemd/system/trojan.service /usr/local/etc/trojan";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name trojan";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
- if (functionResult == true)
- {
- //******"Trojan卸载失败!请向开发者问询!"******
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Trojan卸载成功!"******
- SetUpProgressBarProcessing(30);
- currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Trojan!"******04
- SetUpProgressBarProcessing(30);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Trojan!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载SSR
-
- //******"检测系统是否已经安装SSR......"******03
- SetUpProgressBarProcessing(31);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SSR......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("1") == true)
- functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
- if (functionResult == true)
- {
- //******"检测到已安装SSR,开始卸载SSR......"******
- SetUpProgressBarProcessing(32);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "SSR!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "SSR......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop ssr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable ssr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("1") == true)
- functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
- if (functionResult == true)
- {
- //******"SSR卸载失败!请向开发者问询!"******
- currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"SSR卸载成功!"******
- SetUpProgressBarProcessing(36);
- currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装SSR!"******04
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "SSR!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载SS (Shadowsoks-libev)
-
- //******"检测系统是否已经安装SS (Shadowsoks-libev)......"******03
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SS (Shadowsoks-libev)......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name ss-server";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
- if (functionResult == true)
- {
- //******"检测到SS(Shadowsoks-libev),开始卸载SS(Shadowsoks-libev)......"******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "SS (Shadowsoks-libev)!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "SS (Shadowsoks-libev)......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop ss-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable ss-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //卸载插件
- sshShellCommand = @"rm -f /usr/local/bin/obfs-server /usr/local/bin/obfs-local /usr/local/bin/v2ray-plugin /usr/local/bin/kcptun-plugin-server /usr/local/bin/goquiet-plugin-server /usr/local/bin/cloak-plugin-server";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name ss-server";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
- if (functionResult == true)
- {
- //******"SS(Shadowsoks-libev)卸载失败!请向开发者问询!"******
- currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"SS (Shadowsoks-libev)卸载成功!"******
- SetUpProgressBarProcessing(40);
- currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装SS(Shadowsoks-libev)!"******04
- SetUpProgressBarProcessing(40);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "SS (Shadowsoks-libev)!";
- MainWindowsShowInfo(currentStatus);
- }
-
-
- #endregion
-
- #region 卸载acme.sh
-
- //******"检测系统是否已经安装acme.sh......"******03
- SetUpProgressBarProcessing(41);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "acme.sh......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //******"检测到acme.sh,开始卸载acme.sh......"******
- SetUpProgressBarProcessing(42);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "acme.sh!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "acme.sh......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"/root/.acme.sh/acme.sh --uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -r ~/.acme.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("1") == true)
- {
- //******"acme.sh卸载失败!请向开发者问询!"******
- currentStatus = "acme.sh" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- sshShellCommand = @"sed -i 's/. ""/root/.acme.sh/acme.sh.env""//g' /root/.bashrc";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"acme.sh卸载成功!"******
- SetUpProgressBarProcessing(46);
- currentStatus = "acme.sh" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装acme.sh!"******04
- SetUpProgressBarProcessing(46);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "acme.sh!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
-
- #region 卸载NaiveProxy
-
- //******"检测系统是否已经安装NaiveProxy......"******03
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "NaiveProxy......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/etc/caddy/naive");
- if (functionResult == true)
- {
- //******"检测到NaiveProxy,开始卸载NaiveProxy......"******
- SetUpProgressBarProcessing(49);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "NaiveProxy!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "NaiveProxy......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} uninstall";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
-
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/naive");
- if (functionResult == true)
- {
- //******"Caddy/NaiveProxy卸载失败!请向开发者问询!"******
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Caddy/NaiveProxy卸载成功!"******
- SetUpProgressBarProcessing(60);
- currentStatus = "NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装NaiveProxy!"******04
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "NaiveProxy!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
-
- #region 卸载Caddy
-
- //******"检测系统是否已经安装Caddy......"******03
- SetUpProgressBarProcessing(48);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Caddy......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //******"检测到Caddy,开始卸载Caddy......"******
- SetUpProgressBarProcessing(49);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Caddy!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Caddy......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //检测系统是否支持yum 或 apt-get或zypper
- //如果不存在组件,则命令结果为空,string.IsNullOrEmpty值为真,
-
- sshShellCommand = @"command -v apt-get";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getApt = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v dnf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getDnf = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v yum";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getYum = !String.IsNullOrEmpty(currentShellCommandResult);
-
- SetUpProgressBarProcessing(55);
-
- sshShellCommand = @"command -v zypper";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getZypper = String.IsNullOrEmpty(currentShellCommandResult);
-
-
- string sshCmdRemove = "";
- //string sshCmdRemove2;
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- //sshCmdUpdate = @"apt-get update";
- sshCmdRemove = @"apt-get -y autoremove --purge ";
- }
- else if (getDnf == true)
- {
- //sshCmdUpdate = @"dnf -q makecache";
- sshCmdRemove = @"dnf -y remove ";
- }
- else if (getYum == true)
- {
- //sshCmdUpdate = @"yum -q makecache";
- sshCmdRemove = @"yum -y remove ";
- }
- else if (getZypper == true)
- {
- //sshCmdUpdate = @"zypper ref";
- sshCmdRemove = @"zypper -y remove ";
- }
-
- sshShellCommand = $"{sshCmdRemove}caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name caddy";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //******"Caddy卸载失败!请向开发者问询!"******
- currentStatus = "Caddy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"Caddy卸载成功!"******
- SetUpProgressBarProcessing(60);
- currentStatus = "Caddy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Caddy!"******04
- SetUpProgressBarProcessing(60);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Caddy!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- #region 卸载MtProto
- //******"检测系统是否已经安装MtProto......"******03
- SetUpProgressBarProcessing(61);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "MtProto......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name mtg";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
- if (functionResult == true)
- {
- //******"检测到MtProto,开始卸载MtProto......"******
- SetUpProgressBarProcessing(63);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "MtProto!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "MtProto......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /etc/systemd/system/mtg.service";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/bin/mtg";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/mtg_info.json";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"find / -name mtg";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
- functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
- if (functionResult == true)
- {
- //******"MtProto卸载失败!请向开发者问询!"******
- currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"MtProto卸载成功!"******
- SetUpProgressBarProcessing(65);
- currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装MtProto!"******04
- SetUpProgressBarProcessing(65);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "MtProto!";
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- #region 卸载Xay
-
- //******"检测系统是否已经安装Xray......"******03
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- //sshShellCommand = @"find / -name v2ray";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == true)
- {
- //******"检测到已安装V2Ray!开始卸载Xray......"******
- SetUpProgressBarProcessing(68);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString()
- + "Xray!"
- + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString()
- + "Xray......";
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"systemctl stop xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return;
- }
-
- sshShellCommand = $"bash {saveShellScriptFileName} --remove";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl disable xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"rm -rf /usr/local/etc/xray /var/log/xray";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, @"/usr/local/bin/xray");
- if (functionResult == true)
- //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
- {
- //******"V2Ray卸载失败!请向开发者问询!"******
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //******"V2Ray卸载成功!"******
- SetUpProgressBarProcessing(70);
- currentStatus = "Xray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
- else
- {
- //******"检测结果:未安装Xray!"******04
- SetUpProgressBarProcessing(70);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + "Xray!";
- MainWindowsShowInfo(currentStatus);
- }
-
- #endregion
-
- //如果是纯ipv6主机,则需要删除前面设置的Nat64网关
- if (onlyIpv6 == true)
- {
- SetUpNat64(client, false);
- //sshShellCommand = $"{sshCmdUpdate}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- //******"卸载成功!"******04
- SetUpProgressBarProcessing(100);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- client.Disconnect();
-
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString());
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #region 启用Root密码登录
- private void ButtonEnableRootPassWord_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要当前登录的账户具有sudo权限,是否为远程主机启用root账户并设置密码?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_EnableRootPassword").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text); ;//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;//传递当前账户密码
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => EnableRootPassWord(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
- //启用Root密码登录进程
- private void EnableRootPassWord(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- //******"当前账户已经具有root权限,无需再设置!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_AlreadyRoot").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- sshShellCommand = cmdPre + @"echo 'PasswordAuthentication yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(60);
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"生成20位随机密码!"******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_GenerateRandomPassword").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- string setPassword = currentShellCommandResult.TrimEnd('\r', '\n') + '\n';
-
- sshShellCommand = cmdPre + $"echo -e \"{setPassword}{setPassword}\" | sudo passwd root";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- client.Disconnect();
-
- //***保存密码信息***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootPasswordSavePasswordInfo").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string filePath = ReceiveConfigurationParameters[4].Replace(':', '_');
- CheckDir(filePath);
- using (StreamWriter sw = new StreamWriter($"{filePath}\\host_password_info.txt"))
- {
- sw.WriteLine(ReceiveConfigurationParameters[4]);
- sw.WriteLine("root");
- sw.WriteLine(setPassword);
- }
-
- SetUpProgressBarProcessing(100);
- //***远程主机Root账户密码登录已启用,密码保存在随后打开的文件夹中!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootPasswordSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- System.Diagnostics.Process.Start("explorer.exe", filePath);
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
- #endregion
-
- #region 启用Root证书密钥登录
- private void ButtonEnableRootCert_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要当前登录的账户具有root或者sudo权限,是否为远程主机启用root证书密钥登录?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_ButtonEnableRootCert").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => EnableRootCert(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
-
- //启用Root证书密钥登录进程
- private void EnableRootCert(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- string filePath = String.Empty;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- SetUpProgressBarProcessing(20);
-
- //***正在生成密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertGenerateCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ssh-keygen -b 2048 -t rsa -f /tmp/rootuser.key -q -N ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ssh-keygen -p -P '' -N '' -m PEM -f /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"mkdir -p /root/.ssh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"cat /tmp/rootuser.key.pub | tee -a /root/.ssh/authorized_keys";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"chmod 777 /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- //***正在下载密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertDownloadCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- filePath = CreateConfigSaveDir(@"root_cert", ReceiveConfigurationParameters[4].Replace(':', '_'));
- string localConfigSavePathAndFileName = $"{filePath}\\rootuser.key";
- string remoteConfigPathAndFileName = @"/tmp/rootuser.key";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- localConfigSavePathAndFileName = $"{filePath}\\rootuser.key.pub";
- remoteConfigPathAndFileName = @"/tmp/rootuser.key.pub";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- sshShellCommand = @"rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(50);
- //***远程主机启用密钥登录......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertSetCertEnable").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/StrictModes /#StrictModes /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(70);
- sshShellCommand = @"sed -i 's/PubkeyAuthentication /#PubkeyAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/#AuthorizedKeysFile /AuthorizedKeysFile /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- sshShellCommand = @"sed -i 's/#RSAAuthentication /RSAAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PermitRootLogin yes' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(90);
- sshShellCommand = @"echo 'StrictModes no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PubkeyAuthentication yes' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else
- {
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //MessageBox.Show(currentShellCommandResult);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- //***正在生成密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertGenerateCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = cmdPre + @"sudo rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"yes | sudo ssh-keygen -b 2048 -t rsa -f /tmp/rootuser.key -q -N ''";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"yes | sudo ssh-keygen -p -P '' -N '' -m PEM -f /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo mkdir -p /root/.ssh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"cat /tmp/rootuser.key.pub | sudo tee -a /root/.ssh/authorized_keys";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo chmod 777 /tmp/rootuser.key";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(30);
- //***正在下载密钥......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertDownloadCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- filePath = CreateConfigSaveDir(@"root_cert", ReceiveConfigurationParameters[4].Replace(':', '_'));
- string localConfigSavePathAndFileName = $"{filePath}\\rootuser.key";
- string remoteConfigPathAndFileName = @"/tmp/rootuser.key";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- localConfigSavePathAndFileName = $"{filePath}\\rootuser.key.pub";
- remoteConfigPathAndFileName = @"/tmp/rootuser.key.pub";
- DownloadConfig(connectionInfo, localConfigSavePathAndFileName, remoteConfigPathAndFileName);
-
- sshShellCommand = cmdPre + @"sudo rm -rf /tmp/rootuser.key /tmp/rootuser.key.pub";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(50);
- //***远程主机启用密钥登录......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableRootCertSetCertEnable").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/StrictModes /#StrictModes /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(70);
- sshShellCommand = cmdPre + @"sudo sed -i 's/PubkeyAuthentication /#PubkeyAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/#AuthorizedKeysFile /AuthorizedKeysFile /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(80);
- sshShellCommand = cmdPre + @"sudo sed -i 's/#RSAAuthentication /RSAAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(90);
- sshShellCommand = cmdPre + @"echo 'StrictModes no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PubkeyAuthentication yes' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- client.Disconnect();
-
- SetUpProgressBarProcessing(100);
- //******"远程主机root账户证书密钥登录已启用,密钥文件rootuser.key保存在随后打开的文件夹中!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ButtonEnableRootCertSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- System.Diagnostics.Process.Start("explorer.exe", filePath);
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
-
- }
-
-
- #endregion
-
- #region 禁止root账户密码登录
- //root禁止密码登录
- private void ButtonRootProhibitsPasswordLogin_Click(object sender, RoutedEventArgs e)
- {
- //******"本功能需要远程主机已经开启了其他登录方式,如密钥方式等,否则将可能造成远程主机无法连接,是否禁止远程主机的root账户密码登录方式?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_ButtonRootProhibitsPasswordLogin").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.Yes)
- {
- ConnectionInfo connectionInfo = GenerateConnectionInfo();
- if (connectionInfo == null)
- {
- //****** "远程主机连接信息有误,请检查!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- return;
- }
-
- ReceiveConfigurationParameters[4] = PreTrim(TextBoxHost.Text);//传递主机地址
- ReceiveConfigurationParameters[2] = PasswordBoxHostPassword.Password;//传递主机密码
-
- installationDegree = 0;
- TextBoxMonitorCommandResults.Text = "";
- Thread thread = new Thread(() => RootProhibitsPasswordLogin(connectionInfo));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
-
- //禁止root密码登录进程
- private void RootProhibitsPasswordLogin(ConnectionInfo connectionInfo)
- {
- functionResult = true;
- getApt = false;
- getDnf = false;
- getYum = false;
- onlyIpv6 = false;
-
- string filePath = String.Empty;
-
- //******"正在登录远程主机......"******
- SetUpProgressBarProcessing(1);
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_Login").ToString();
- MainWindowsShowInfo(currentStatus);
-
- try
- {
- #region 主机指纹,暂未启用
- //byte[] expectedFingerPrint = new byte[] {
- // 0x66, 0x31, 0xaf, 0x00, 0x54, 0xb9, 0x87, 0x31,
- // 0xff, 0x58, 0x1c, 0x31, 0xb1, 0xa2, 0x4c, 0x6b
- // };
- #endregion
- using (var client = new SshClient(connectionInfo))
-
- {
- #region ssh登录验证主机指纹代码块,暂未启用
- // client.HostKeyReceived += (sender, e) =>
- // {
- // if (expectedFingerPrint.Length == e.FingerPrint.Length)
- // {
- // for (var i = 0; i < expectedFingerPrint.Length; i++)
- // {
- // if (expectedFingerPrint[i] != e.FingerPrint[i])
- // {
- // e.CanTrust = false;
- // break;
- // }
- // }
- // }
- // else
- // {
- // e.CanTrust = false;
- // }
- // };
- #endregion
-
- client.Connect();
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测root权限 5--7
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == true)
- {
- SetUpProgressBarProcessing(20);
-
- //***正在关闭root账户密码登录方式......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetRootProhibitsPasswordLogin").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PasswordAuthentication no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"echo 'PermitEmptyPasswords no' | tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- SetUpProgressBarProcessing(10);
- string hostPassword = "'" + ReceiveConfigurationParameters[2] + "'";
- //MessageBox.Show(hostPassword);
- sshShellCommand = $"echo {hostPassword} | sudo -S id -u";
- //MessageBox.Show(sshShellCommand);
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //MessageBox.Show(currentShellCommandResult);
- if (currentShellCommandResult.TrimEnd('\r', '\n').Equals("0") == false)
- {
- //******"当前账户无法获取sudo权限,设置失败!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_NoSudoToAccount").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- client.Disconnect();
- return;
- }
-
- SetUpProgressBarProcessing(20);
- string cmdPre = $"echo {hostPassword} | sudo -S id -u" + ';';
-
- //***正在关闭root账户密码登录方式......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetRootProhibitsPasswordLogin").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PasswordAuthentication no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = cmdPre + @"sudo systemctl restart sshd";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- client.Disconnect();
-
- SetUpProgressBarProcessing(100);
- //******"远程主机root账户密码登录方式已关闭!"******
- currentStatus = Application.Current.FindResource("MessageBoxShow_RootProhibitsPasswordLoginOK").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
-
- return;
- }
- }
- catch (Exception ex1)//例外处理
- #region 例外处理
- {
- ProcessException(ex1.Message);
-
- //****** "主机登录失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- #endregion
- }
- #endregion
-
- //安装日志另存为...
- private void ButtonSaveInstalledLog_Click(object sender, RoutedEventArgs e)
- {
- string logSaveName = ChooseSaveFile("Log Save as...", $"{pwdir}");
- if (String.IsNullOrEmpty(logSaveName) == false)
- {
- using (StreamWriter sw = new StreamWriter($"{logSaveName}"))
- {
- sw.WriteLine($"{TextBoxMonitorCommandResults.Text}");
- }
- }
- }
- private string ChooseSaveFile(string title, string initFolder)
- {
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Title = title;
- string localTime = DateTime.Now.ToLocalTime().ToString().Replace(' ', '-').Replace(':', '-').Replace('/', '-').Replace('\\', '-');
- dlg.FileName = $"{PreTrim(TextBoxHost.Text).Replace(':', '_')}_{localTime}.txt"; // Default file name
- dlg.DefaultExt = ".txt"; // Default file extension
- dlg.Filter = "Text documents|*.txt"; // Filter files by extension
- dlg.InitialDirectory = initFolder;
-
- // Process save file dialog box results
- if (dlg.ShowDialog() == true)
- {
- return dlg.FileName;
- }
- else
- {
- return null;
- }
- }
-
- #endregion
-
- #region 标签页控制
-
- private void ButtonWebBrowserHomePage_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.Source = new Uri("https://github.com/proxysu/windows/wiki/ResourcesAndTools");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void ButtonWebBrowserBack_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForward_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndTools.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
-
-
- #region 免翻网址资源标签
- private void ButtonWebBrowserHomePageFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.Source = new Uri("https://github.com/proxysu/windows/wiki/FreeWallURL");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserBackFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForwardFreeWallURL_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserResourcesAndToolsFreeWallURL.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- #endregion
-
- #region 常见问题标签
- private void ButtonWebBrowserHomePageCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.Source = new Uri("https://github.com/proxysu/windows/wiki/CommonError");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserBackCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.GoBack();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
- private void ButtonWebBrowserForwardCommonError_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- WebBrowserCommonError.GoForward();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
-
-
- #endregion
- #endregion
-
- #region 测试用代码
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- //string host = ClassModel.DisguiseURLprocessing("www.google.com/accout/");
- //MessageBox.Show(host);
- //saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
- //saveShellScriptFileName = "tmp." + saveShellScriptFileName + ".sh";
- //MessageBox.Show(saveShellScriptFileName);
- //var rand = System.Security.Cryptography.RandomNumberGenerator.Create();
- //byte[] bytes = new byte[8];
- //rand.GetBytes(bytes);
- //string randStr = Convert.ToBase64String(bytes);
- //randStr = randStr.Replace("+","").Replace("/", "").Replace("=","");
- //MessageBox.Show(randStr);
- proxyType = "V2Ray";
- ResultClientInformation resultClientInformation = new ResultClientInformation();
- resultClientInformation.ShowDialog();
- //return;
- //string pwdir = AppDomain.CurrentDomain.BaseDirectory;
- //MessageBox.Show(pwdir);
- //ConnectionInfo connectionInfo = GenerateConnectionInfo();
- //if (connectionInfo == null)
- //{
- // //****** "远程主机连接信息有误,请检查!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
- // return;
- //}
- //using (var client = new SshClient(connectionInfo))
- //{
- // client.Connect();
- // if (client.IsConnected == true)
- // {
- // //******"主机登录成功"******
- // SetUpProgressBarProcessing(3);
- // currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- // MainWindowsShowInfo(currentStatus);
-
- // }
- // string fileProxy = @"/usr/local/bin/v2ray";
- // sshShellCommand = $"if [[ -f {fileProxy} ]];then echo '1';else echo '0'; fi";
- // //sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- // if (currentShellCommandResult.Trim().Equals("0") == true)
- // {
- // MessageBox.Show("0");
- // }
- // else
- // {
- // MessageBox.Show("1");
- // }
- // // SetUpNat64(client, true);
- // //FilterFastestIP(client);
- // //string cmdErr = client.RunCommand(@"aaa ee").Error;
- // //MessageBox.Show(cmdErr);
- // //SshCommand cmdResult = client.RunCommand(@"pwd");
- // //string result = cmdResult.Result;
- // //MessageBox.Show("result:" + result);
- // //string error = cmdResult.Error;
- // //MessageBox.Show("err:" + error);
-
- // //int cmdExitStatus = cmdResult.ExitStatus;
- // //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
-
- // //SshCommand cmdResultCat = client.RunCommand(@"cat tt.t");
- // //string resultCat = cmdResultCat.Result;
- // //MessageBox.Show("resultCat:" + resultCat);
- // //string errorCat = cmdResultCat.Error;
- // //MessageBox.Show("errCat:" + errorCat);
-
- // //cmdExitStatus = cmdResultCat.ExitStatus;
- // //MessageBox.Show("cmdExitStatus:" + cmdExitStatus.ToString());
-
- // //SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
- // //CaddyInstall(client);
- // //if (client.IsConnected == true)
- // //{
- // // MessageBox.Show("Connected");
- // //}
- // //if (client.IsConnected == false)
- // //{
- // // MessageBox.Show("disConnected");
- // //}
- //}
- }
-
- private string CaddyInstallTest(SshClient client)
- {
-
- if (client.IsConnected == true)
- {
- //******"主机登录成功"******
- SetUpProgressBarProcessing(3);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- client.Disconnect();
- }
- return "";
- }
- #endregion
-
- #region 布署代理所用到的步骤函数
-
- //检测主机是否为纯ipv6的主机
- private bool OnlyIpv6HostDetect(SshClient client)
- {
- //****** "正在检测是否为纯ipv6主机......." ******11
- //SetUpProgressBarProcessing(34);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OnlyIpv6HostDetect").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //再次初始化相关变量
- ipv4 = String.Empty;
- ipv6 = String.Empty;
-
- //sshShellCommand = @"curl -4 ip.sb";
- sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- if (String.IsNullOrEmpty(ipv4) == false)
- {
- return false;
- }
- else
- {
- if (String.IsNullOrEmpty(ipv6) == false)
- {
-
- return true;
- }
- else
- {
- //FunctionResultErr();
- client.Disconnect();
- //****未检测到有效的IP地址......***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoIpDetect").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- return false;
- }
- }
-
- }
-
- //设置Nat64与删除设置Nat64
- private bool SetUpNat64(SshClient client, bool set)
- {
- if (set == true)
- {
- //****** "正在查找最快的Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
- //string[] dns64 = new string[2];
- var dns64 = FilterFastestIP(client);
-
- if (functionResult == false)
- {
- //****** "未能找到有效的Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64Failed").ToString();
- MainWindowsShowInfo(currentStatus);
- MessageBox.Show(currentStatus);
- //FunctionResultErr();
- client.Disconnect();
- return false;
- }
-
- //****** "正在设置Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
-
- functionResult = FileCheckExists(client, @"/etc/resolv.conf.proxysu");
- if (functionResult == false)
- {
- sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- foreach (string gateip in dns64)
- {
- sshShellCommand = $"echo \"nameserver {gateip}\" > /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"curl -fsSL https://api.github.com/repos/proxysu/windows/releases/latest";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- SshCommand currentShellCommand = client.RunCommand(sshShellCommand);
- int cmdExitStatus = currentShellCommand.ExitStatus;
- if (cmdExitStatus == 0)
- {
- return true;
- }
-
- }
-
- }
- else
- {
- //****** "正在删除Nat64网关......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DeleteSetUpNat64").ToString();
- MainWindowsShowInfo(currentStatus);
- sshShellCommand = @"rm /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- return true;
- }
-
- //筛选最优的NAT64地址
- private string[] FilterFastestIP(SshClient client)
- {
- string[] gateNat64 = {
- "2a01:4f9:c010:3f02::1",
- "2001:67c:2b0::4",
- "2001:67c:2b0::6",
- "2a09:11c0:f1:bbf0::70",
- "2a01:4f8:c2c:123f::1",
- "2001:67c:27e4:15::6411",
- "2001:67c:27e4::64",
- "2001:67c:27e4:15::64",
- "2001:67c:27e4::60",
- "2a00:1098:2b::1",
- "2a03:7900:2:0:31:3:104:161",
- "2a00:1098:2c::1",
- "2a09:11c0:100::53",
- };
-
- List NatDns64s = new List();
- foreach (string gateip in gateNat64)
- {
- sshShellCommand = $"ping6 -c4 {gateip} | grep avg | awk '{{print $4}}'|cut -d/ -f2";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (String.IsNullOrEmpty(currentShellCommandResult) != true)
- {
- if (float.TryParse(currentShellCommandResult, out float delay) == true)
- {
-
- int delayInt = (int)(delay * 1000);
- NatDns64 ipaddr = new NatDns64($"{gateip}", delayInt);
- NatDns64s.Add(ipaddr);
- }
- }
-
- }
- NatDns64s = NatDns64s.OrderBy(o => o.Avg).ToList();
- int listCount = NatDns64s.Count;
- currentStatus = listCount.ToString() + " NAT64 gateways are valid";
- MainWindowsShowInfo(currentStatus);
- if (listCount < 1)
- {
- functionResult = false;
- }
- else
- {
- functionResult = true;
- }
- string[] returnstr = new string[listCount];
- for (int i = 0; i < listCount; i++)
- {
- returnstr[i] = NatDns64s[i].IpAddr;
- }
- //returnstr[0] = NatDns64s[0].IpAddr;
- //returnstr[1] = NatDns64s[1].IpAddr;
- return returnstr;
- }
-
- //纯ipv6主机安装脚本处理
- //private void Ipv6ScriptEdit(SshClient client,string scriptFile)
- //{
- // sshShellCommand = $"sed -i 's/api.github.com/{apiGithubCom}/g' {scriptFile}";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // sshShellCommand = $"sed -i 's/raw.githubusercontent.com/raw.githubusercontent.com/g' {scriptFile}";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- // sshShellCommand = $"sed -i 's/https:\\/\\/github.com/https:\\/\\/{githubCom}/g' {scriptFile}";
- // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //}
-
-
- #region 安装过程提示信息
-
- //安装过程提示信息
- // MainWindowsShowInfo(currentStatus);
- // currentShellCommandResult = MainWindowsShowCmd(client,sshShellCommand);
- private string MainWindowsShowInfo(string currentStatus)
- {
- TextBlockSetUpProcessing.Dispatcher.BeginInvoke(updateAction, TextBlockSetUpProcessing, ProgressBarSetUpProcessing, currentStatus);
- string currentShellCommandResult = currentStatus;
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果在监视窗口
-
- return currentShellCommandResult;
- }
-
- //安装过程所运行的命令与相应结果
- private string MainWindowsShowCmd(SshClient client, string sshShellCommand, bool stopIfError = true)
- {
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令
- SshCommand cmdResult = client.RunCommand(sshShellCommand);
- string currentShellCommandResult = cmdResult.Result; //命令执行成功的结果
- string currentShellCommandError = cmdResult.Error; //命令执行出错的提示
- int cmdExitStatus = cmdResult.ExitStatus;
- //if (String.IsNullOrEmpty(currentShellCommandResult) == true)
- if (cmdExitStatus == 1)
- {
- if (stopIfError) { }
- //currentShellCommandResult = currentShellCommandError;
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandError);//显示命令执行错误的提示
- }
- TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果
-
- return currentShellCommandResult;
- }
-
- //调用的函数返回false后的提示
- private string FunctionResultErr()
- {
- //*****"发生错误,安装中断......"*****
- string currentStatus = Application.Current.FindResource("DisplayInstallInfo_FunctionResultErr").ToString();
- MainWindowsShowInfo(currentStatus);
- return "";
- }
-
- //判断某个文件是否存在
- //functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
- private bool FileCheckExists(SshClient client, string pathFile)
- {
- sshShellCommand = $"if [[ -f {pathFile} ]];then echo '1';else echo '0'; fi";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- if (currentShellCommandResult.Trim().Equals("1") == true)
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
- #endregion
-
- //检测root权限 5--7
- //functionResult = RootAuthorityDetect(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool RootAuthorityDetect(SshClient client)
- {
- sshShellCommand = @"uname -a";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //禁止一些可能产生的干扰信息
- sshShellCommand = @"sed -i 's/echo/#echo/g' ~/.bashrc";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/echo/#echo/g' ~/.profile";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"检测是否运行在root权限下..."******01
- SetUpProgressBarProcessing(5);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootPermission").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"id -u";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string testRootAuthority = currentShellCommandResult;
- if (currentShellCommandResult.Equals("0\n") == false)
- {
- //******"请使用具有root权限的账户登录主机!!"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorRootPermission").ToString());
- //client.Disconnect();
- return false;
- }
- else
- {
- //******"检测结果:OK!"******02
- SetUpProgressBarProcessing(7);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DetectionRootOK").ToString();
- MainWindowsShowInfo(currentStatus);
- //return true;
- }
- return true;
- }
-
- //检测是否已安装代理 8--10
- //soft--要检测的程序
- //condition---已安装的条件
- //functionResult = SoftInstalledIsNoYes(client, "v2ray", @"/usr/local/bin/v2ray");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SoftInstalledIsNoYes(SshClient client, string soft, string condition)
- {
- //******"检测系统是否已经安装......"******03
- SetUpProgressBarProcessing(8);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + $"{soft}......";
- MainWindowsShowInfo(currentStatus);
-
-
- //sshShellCommand = $"find / -name {soft}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //string resultCmdTestV2rayInstalled = currentShellCommandResult;
- //if (currentShellCommandResult.Contains($"{condition}") == true)
- functionResult = FileCheckExists(client, condition);
- if (functionResult == true)
- {
- //******"远程主机已安装V2ray,是否强制重新安装?"******
- string messageShow = Application.Current.FindResource("MessageBoxShow_ExistedSoft").ToString() +
- $"{soft}" +
- Application.Current.FindResource("MessageBoxShow_ForceInstallSoft").ToString();
- MessageBoxResult messageBoxResult = MessageBox.Show(messageShow, "", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (messageBoxResult == MessageBoxResult.No)
- {
- //******"安装取消,退出"******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_InstallationCanceledExit").ToString();
- MainWindowsShowInfo(currentStatus);
- //client.Disconnect();
- return false;
- }
- else
- {
- //******"已选择强制安装!"******04
- SetUpProgressBarProcessing(10);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ForceInstallSoft").ToString() + $"{soft}";
- MainWindowsShowInfo(currentStatus);
-
- }
- }
- else
- {
- //******"检测结果:未安装"******04
- SetUpProgressBarProcessing(10);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoInstalledSoft").ToString() + $"{soft}";
- MainWindowsShowInfo(currentStatus);
- }
- return true;
- }
-
- //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30
- //安装依赖软件,检测端口,防火墙开启端口,检测是否为纯ipv6主机,若是则设置Nat64网关
- //functionResult = ShutDownSelinuxAndSysComponentsDetect(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool ShutDownSelinuxAndSysComponentsDetect(SshClient client)
- {
-
- //检测系统是否支持yum 或 apt-get或zypper,且支持Systemd
- //如果不存在组件,则命令结果为空,String.IsNullOrEmpty值为真
- //取反则getApt,getDnf,getYum,getSystem,getGetenforce为假
- //不存在组件,则为假
-
- //******"检测系统是否符合安装要求......"******
- SetUpProgressBarProcessing(11);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_CheckSystemRequirements").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"command -v apt-get";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getApt = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v dnf";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getDnf = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v yum";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- getYum = !String.IsNullOrEmpty(currentShellCommandResult);
-
- SetUpProgressBarProcessing(13);
-
- //sshShellCommand = @"command -v zypper";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //bool getZypper = ! String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v systemctl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getSystemd = !String.IsNullOrEmpty(currentShellCommandResult);
-
- sshShellCommand = @"command -v getenforce";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- bool getGetenforce = !String.IsNullOrEmpty(currentShellCommandResult);
-
-
- //没有安装apt-get,也没有安装dnf\yum,也没有安装zypper,或者没有安装systemd的,不满足安装条件
- //也就是apt-get ,dnf\yum, zypper必须安装其中之一,且必须安装Systemd的系统才能安装。
- if ((getApt == false && getDnf == false && getYum == false) || getSystemd == false)
- {
- //******"系统缺乏必要的安装组件如:apt-get||dnf||yum||zypper||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_MissingSystemComponents").ToString());
-
- //******"系统环境不满足要求,安装失败!!"******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_MissingSystemComponents").ToString();
- MainWindowsShowInfo(currentStatus);
-
- return false;
- }
- else
- {
- //******"检测结果:OK!"******06
- SetUpProgressBarProcessing(16);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SystemRequirementsOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- //检测是否安装dig
- if (string.IsNullOrEmpty(client.RunCommand("command -v dig").Result) == true)
- {
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- sshCmdUpdate = @"apt-get update";
- sshCmdInstall = @"apt-get -y install dnsutils";
- }
- else if (getDnf == true)
- {
- sshCmdUpdate = @"dnf makecache";
- sshCmdInstall = @"dnf -y install bind-utils";
- }
- else if (getYum == true)
- {
- sshCmdUpdate = @"yum makecache";
- sshCmdInstall = @"yum -y install bind-utils";
- }
- sshShellCommand = sshCmdUpdate;
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = sshCmdInstall;
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
-
- //设置安装软件所用的命令格式
- if (getApt == true)
- {
- sshCmdUpdate = @"apt-get update";
- sshCmdInstall = @"apt-get -y install ";
- }
- else if (getDnf == true)
- {
- sshCmdUpdate = @"dnf clean all;dnf makecache";
- sshCmdInstall = @"dnf -y install ";
- }
- else if (getYum == true)
- {
- sshCmdUpdate = @"yum clean all; yum makecache";
- sshCmdInstall = @"yum -y install ";
- }
- //else if (getZypper == true)
- //{
- // sshCmdUpdate = @"zypper ref";
- // sshCmdInstall = @"zypper -y install ";
- //}
-
- //判断是否启用了SELinux,如果启用了,并且工作在Enforcing模式下,则改为Permissive模式
- if (getGetenforce == true)
- {
- sshShellCommand = @"getenforce";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //string testSELinux = currentShellCommandResult;
-
- if (currentShellCommandResult.Contains("Enforcing") == true)
- {
- //******"检测到系统启用SELinux,且工作在严格模式下,需改为宽松模式!修改中......"******07
- SetUpProgressBarProcessing(18);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableSELinux").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"setenforce 0";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //******"修改完毕!"******08
- SetUpProgressBarProcessing(20);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_SELinuxModifyOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
-
- }
-
- sshShellCommand = $"{sshCmdUpdate}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //在相应系统内安装curl(如果没有安装curl)--此为依赖软件
- if (string.IsNullOrEmpty(client.RunCommand("command -v curl").Result) == true)
- {
- sshShellCommand = $"{sshCmdInstall}curl";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- // 在相应系统内安装wget(如果没有安装wget)--此为依赖软件
- if (string.IsNullOrEmpty(client.RunCommand("command -v wget").Result) == true)
- {
- sshShellCommand = $"{sshCmdInstall}wget";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- // 在相应系统内安装unzip(如果没有安装unzip)--此为依赖软件
- if (string.IsNullOrEmpty(client.RunCommand("command -v unzip").Result) == true)
- {
- sshShellCommand = $"{sshCmdInstall}unzip";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- //处理极其少见的xz-utils未安装的情况
-
- if (getApt == true)
- {
- sshShellCommand = $"{sshCmdInstall}xz-utils";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else if (getDnf == true || getYum == true)
- {
- sshShellCommand = $"{sshCmdInstall}xz-devel";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- //检测是否安装lsof
- if (string.IsNullOrEmpty(client.RunCommand("command -v lsof").Result) == true)
- {
- sshShellCommand = $"{sshCmdInstall}lsof";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
-
- //检测主机是否为纯ipv6的主机
- onlyIpv6 = OnlyIpv6HostDetect(client);
-
- //如果未检测到有效的ip,连接就会被断开
- if (client.IsConnected == false)
- {
- return false;
- }
- if (onlyIpv6 == true)
- {
- functionResult = SetUpNat64(client, true);
- if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return false; }
- //sshShellCommand = $"{sshCmdUpdate}";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- //****** "检测端口占用情况......" ******
- SetUpProgressBarProcessing(22);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestPortUsed").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (String.Equals(ReceiveConfigurationParameters[1], "80") == true || String.Equals(ReceiveConfigurationParameters[1], "443") == true)
- {
- string testPort80 = string.Empty;
- string testPort443 = string.Empty;
-
- sshShellCommand = @"lsof -n -P -i :80 | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort80 = currentShellCommandResult;
-
- sshShellCommand = @"lsof -n -P -i :443 | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort443 = currentShellCommandResult;
-
-
- if (String.IsNullOrEmpty(testPort80) == false || String.IsNullOrEmpty(testPort443) == false)
- {
- //****** "80/443端口之一,或全部被占用,将强制停止占用80/443端口的程序?" ******
- MessageBoxResult dialogResult = MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorPortUsed").ToString(), "Stop application", MessageBoxButton.YesNo);
- if (dialogResult == MessageBoxResult.No)
- {
- //****** "端口被占用,安装失败......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString();
- MainWindowsShowInfo(currentStatus);
- //client.Disconnect();
- return false;
- }
-
- //****** "正在释放80/443端口......" ******
- SetUpProgressBarProcessing(24);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePort").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (String.IsNullOrEmpty(testPort443) == false)
- {
- string[] cmdResultArry443 = testPort443.Split(' ');
-
- sshShellCommand = $"systemctl stop {cmdResultArry443[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl disable {cmdResultArry443[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"pkill {cmdResultArry443[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- if (String.IsNullOrEmpty(testPort80) == false)
- {
- string[] cmdResultArry80 = testPort80.Split(' ');
-
- sshShellCommand = $"systemctl stop {cmdResultArry80[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl disable {cmdResultArry80[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"pkill {cmdResultArry80[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- testPort80 = string.Empty;
- testPort443 = string.Empty;
-
- sshShellCommand = @"lsof -n -P -i :80 | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort80 = currentShellCommandResult;
-
- sshShellCommand = @"lsof -n -P -i :443 | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort443 = currentShellCommandResult;
-
-
- if (String.IsNullOrEmpty(testPort80) == false || String.IsNullOrEmpty(testPort443) == false)
- {
- //****** "端口被占用,安装失败......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString();
- MainWindowsShowInfo(currentStatus);
- //client.Disconnect();
- return false;
- }
- //****** "80/443端口释放完毕!" ******
- SetUpProgressBarProcessing(26);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePortOK").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "检测结果:未被占用!" ******
- SetUpProgressBarProcessing(26);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_PortNotUsed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
- else
- {
- string testPort = string.Empty;
-
- sshShellCommand = $"lsof -n -P -i :{ReceiveConfigurationParameters[1]} | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort = currentShellCommandResult;
-
- if (String.IsNullOrEmpty(testPort) == false)
- {
- //****** "端口被占用,将强制停止占用此端口的程序?" ******
- MessageBoxResult dialogResult = MessageBox.Show(ReceiveConfigurationParameters[1] + Application.Current.FindResource("MessageBoxShow_ErrorPortUsedOther").ToString(), "Stop application", MessageBoxButton.YesNo);
- if (dialogResult == MessageBoxResult.No)
- {
- //****** "端口被占用,安装失败......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString();
- MainWindowsShowInfo(currentStatus);
- //client.Disconnect();
- return false;
- }
-
- //****** "正在释放端口......" ******
- SetUpProgressBarProcessing(24);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePortOther").ToString();
- MainWindowsShowInfo(currentStatus);
-
- string[] cmdResultArry = testPort.Split(' ');
-
- sshShellCommand = $"systemctl stop {cmdResultArry[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"systemctl disable {cmdResultArry[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"pkill {cmdResultArry[0]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- testPort = string.Empty;
-
- sshShellCommand = $"lsof -n -P -i :{ReceiveConfigurationParameters[1]} | grep LISTEN";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- testPort = currentShellCommandResult;
-
- if (String.IsNullOrEmpty(testPort) == false)
- {
- //****** "端口被占用,安装失败......" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString();
- MainWindowsShowInfo(currentStatus);
- //client.Disconnect();
- return false;
- }
-
- //****** "端口释放完毕!" ******
- SetUpProgressBarProcessing(26);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePortOKOther").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "检测结果:未被占用!" ******
- SetUpProgressBarProcessing(26);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_PortNotUsed").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- }
- //****** "开启防火墙相应端口......" ******
- SetUpProgressBarProcessing(27);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_OpenFireWallPort").ToString();
- MainWindowsShowInfo(currentStatus);
- string openFireWallPort = ReceiveConfigurationParameters[1];
- if (String.IsNullOrEmpty(client.RunCommand("command -v firewall-cmd").Result) == false)
- {
- //有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
- //用于保证acme.sh申请证书成功
- sshShellCommand = @"firewall-cmd --state";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (String.Equals(currentShellCommandResult.Trim(), "running") == false)
- {
- sshShellCommand = @"systemctl restart firewalld";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
-
- if (String.Equals(openFireWallPort, "443"))
- {
- sshShellCommand = @"firewall-cmd --zone=public --add-port=80/tcp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"firewall-cmd --zone=public --add-port=80/udp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"firewall-cmd --zone=public --add-port=443/tcp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"firewall-cmd --zone=public --add-port=443/udp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | firewall-cmd --reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- sshShellCommand = $"firewall-cmd --zone=public --add-port={openFireWallPort}/tcp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"firewall-cmd --zone=public --add-port={openFireWallPort}/udp --permanent";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | firewall-cmd --reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- }
- else if (String.IsNullOrEmpty(client.RunCommand("command -v ufw").Result) == false)
- {
- if (String.Equals(openFireWallPort, "443"))
- {
- sshShellCommand = @"ufw allow 80/tcp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"ufw allow 80/udp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"ufw allow 443/tcp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"ufw allow 443/udp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ufw reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- sshShellCommand = $"ufw allow {openFireWallPort}/tcp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"ufw allow {openFireWallPort}/udp";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yes | ufw reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- }
-
- SetUpProgressBarProcessing(30);
- return true;
- }
-
- //检测校对时间 31--33
- //functionResult = CheckProofreadingTime(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CheckProofreadingTime(SshClient client)
- {
- //******"校对时间......"******09
- SetUpProgressBarProcessing(31);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ProofreadingTime").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //获取远程主机的时间戳
- long timeStampVPS = Convert.ToInt64(client.RunCommand("date +%s").Result.ToString());
-
- //获取本地时间戳
- TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
- if (Math.Abs(timeStampLocal - timeStampVPS) >= 90)
- {
- //******"本地时间与远程主机时间相差超过限制(90秒),请先用 '系统工具-->时间校对' 校对时间后再设置"******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_TimeError").ToString());
- //"时间较对失败......"
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TimeError").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
- //******"时间差符合要求,OK!"******10
- SetUpProgressBarProcessing(33);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TimeOK").ToString();
- MainWindowsShowInfo(currentStatus);
- return true;
- }
-
-
- //检测域名是否解析到当前IP上 34---36
- //functionResult = DomainResolutionCurrentIPDetect(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool DomainResolutionCurrentIPDetect(SshClient client)
- {
- //****** "正在检测域名是否解析到当前VPS的IP上......" ******11
- SetUpProgressBarProcessing(34);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestDomainResolve").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //再次初始化相关变量
- //ipv4 = String.Empty;
- //ipv6 = String.Empty;
- //onlyIpv6 = false;
-
- //sshShellCommand = @"curl -4 ip.sb";
- //sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- //sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- //ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
-
- if (onlyIpv6 == false)
- {
- string nativeIp = ipv4;
-
- //string cmdFilter = "";
- string cmdFilter = @"| grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1";
- sshShellCommand = $"dig @resolver1.opendns.com A {ReceiveConfigurationParameters[4]} +short -4 {cmdFilter}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
- if (String.Equals(nativeIp, resultTestDomainCmd) == true)
- {
- //****** "解析正确!OK!" ******12
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
- MainWindowsShowInfo(currentStatus);
- //onlyIpv6 = false;
- return true;
- }
-
- }
- else
- {
- string nativeIp = ipv6;
-
- //string cmdFilter = "";
- string cmdFilter = @"| grep -oE '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))' | head -n 1";
- sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6 {cmdFilter}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
- if (String.Equals(nativeIp, resultTestDomainCmd) == true)
- {
- //****** "解析正确!OK!" ******12
- SetUpProgressBarProcessing(36);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
- MainWindowsShowInfo(currentStatus);
- //onlyIpv6 = true;
-
- return true;
- }
-
- }
- //****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "域名未能正确解析到当前VPS的IP上,请检查!若解析设置正确,请等待生效后再重试安装。如果域名使用了CDN,请先关闭!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
- //client.Disconnect();
- return false;
-
- }
-
-
- //安装代理程序 37--40
- //functionResult = ProxySoftInstall(client,@"",@"");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool ProxySoftInstall(SshClient client, string proxyName, string downloadUrl)
- {
- //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
- SetUpProgressBarProcessing(37);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "正在安装{proxyName}......" ******
- SetUpProgressBarProcessing(38);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
- MainWindowsShowInfo(currentStatus);
-
- saveShellScriptFileName = GenerateRandomScriptFileName(GenerateRandomStr(10));
-
- sshShellCommand = $"curl -o {saveShellScriptFileName} {downloadUrl}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- functionResult = FileCheckExists(client, $"{saveShellScriptFileName}");
- if (functionResult == false)
- {
- //***文件下载失败!***
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
-
- }
- sshShellCommand = $"yes | bash {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"rm -f {saveShellScriptFileName}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- SetUpProgressBarProcessing(40);
- return true;
- }
-
- //程序是否安装成功检测并设置开机启动 41--43
- //soft--要检测的程序
- //condition---成功安装的条件
- //functionResult = SoftInstalledSuccessOrFail(client,"v2ray",@"/usr/local/bin/v2ray");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SoftInstalledSuccessOrFail(SshClient client, string soft, string condition)
- {
- SetUpProgressBarProcessing(41);
- //sshShellCommand = $"find / -name {soft}";
- //sshShellCommand = $"if [[ -f {condition} ]];then echo '1';else echo '0'; fi";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- bool functionResult = FileCheckExists(client, condition);
-
- //if (!currentShellCommandResult.Contains($"{condition}"))
- if (functionResult == false)
- {
- //****** "安装失败,官方脚本运行出错!" ******
- MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString());
- //****** "安装失败,官方脚本运行出错!" ******
- currentStatus = Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
- else
- {
- //****** "安装成功!" ******20
- SetUpProgressBarProcessing(43);
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_SoftInstallSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //开机启动
- sshShellCommand = $"systemctl enable {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- return true;
- }
-
-
- //生成服务端配置 44--46
- //functionResult = GenerateServerConfiguration(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
-
-
- //上传服务配置 47--50
- private bool GenerateServerConfigurations(SshClient client) { return true; }
-
- //acme.sh安装与申请证书 51--57
- //functionResult = AcmeShInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool AcmeShInstall(SshClient client)
- {
- //****** "正在安装acme.sh......" ******22
- SetUpProgressBarProcessing(51);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallAcmeSh").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //安装所依赖的软件
- sshShellCommand = $"{sshCmdUpdate}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"{sshCmdInstall}socat";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //解决搬瓦工CentOS缺少问题
- sshShellCommand = $"{sshCmdInstall}automake autoconf libtool";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh";
- sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m {acmeEmail}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("Install success") == true)
- {
- //****** "acme.sh安装成功!" ******23
- SetUpProgressBarProcessing(54);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_AcmeShInstallSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "acme.sh安装失败!原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorAcmeShInstallFail").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
-
- sshShellCommand = @"cd ~/.acme.sh/";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"alias acme.sh=~/.acme.sh/acme.sh";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "申请域名证书......" ******24
- SetUpProgressBarProcessing(55);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartApplyCert").ToString();
- MainWindowsShowInfo(currentStatus);
-
- if (onlyIpv6 == true)
- {
- sshShellCommand = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {ReceiveConfigurationParameters[4]} --listen-v6";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
- else
- {
- sshShellCommand = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {ReceiveConfigurationParameters[4]}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- if (currentShellCommandResult.Contains("Cert success") == true)
- {
- //****** "证书申请成功!" ******25
- SetUpProgressBarProcessing(57);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ApplyCertSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "证书申请失败!原因未知,请向开发者提问!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ApplyCertFail").ToString();
- MainWindowsShowInfo(currentStatus);
- return false;
- }
- return true;
-
- }
-
-
-
- //安装证书到代理程序 58--60
- private bool CertInstallProxy(SshClient client)
- {
- return true;
- }
-
-
- //Caddy安装与检测安装是否成功 61--66
- //functionResult = CaddyInstall(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool CaddyInstall(SshClient client)
- {
- //****** "安装Caddy......" ******28
- SetUpProgressBarProcessing(61);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallCaddy").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //为真则表示系统有相应的组件。
- if (getApt == true)
- {
-
- sshShellCommand = @"echo ""deb [trusted=yes] https://apt.fury.io/caddy/ /"" | tee -a /etc/apt/sources.list.d/caddy-fury.list";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get install -y apt-transport-https";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get update";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"apt-get -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else if (getDnf == true)
- {
-
- sshShellCommand = @"dnf install 'dnf-command(copr)' -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"dnf copr enable @caddy/caddy -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"dnf makecache";
- //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"dnf -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- else if (getYum == true)
- {
-
- sshShellCommand = @"yum install yum-plugin-copr -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"yum copr enable @caddy/caddy -y";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //sshShellCommand = @"yum makecache";
- //currentShellCommandResult = MainWindowsShowCmd(client,sshShellCommand);
-
- sshShellCommand = @"yum -y install caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
-
- string caddyService = @"/lib/systemd/system/caddy.service";
- functionResult = FileCheckExists(client, $"{caddyService}");
- if (functionResult == false)
- {
- caddyService = @"/usr/lib/systemd/system/caddy.service";
- }
- sshShellCommand = $"sed -i 's/AmbientCapabilities/#AmbientCapabilities/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/=caddy/=root/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/LimitNPROC/#LimitNPROC/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/LimitNOFILE/#LimitNOFILE/g' {caddyService}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"systemctl daemon-reload";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
-
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //****** "Caddy安装成功!" ******29
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_InstalledCaddyOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
-
- sshShellCommand = @"systemctl enable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- return true;
-
- }
- functionResult = ProxySoftInstall(client, @"Caddy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return false; }
-
- functionResult = FileCheckExists(client, @"/usr/bin/caddy");
- if (functionResult == true)
- {
- //****** "Caddy安装成功!" ******29
- SetUpProgressBarProcessing(66);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_InstalledCaddyOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
-
- sshShellCommand = @"systemctl enable caddy";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- return true;
- }
-
- //****** "安装Caddy失败!" ******
- MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString());
- //****** "安装Caddy失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //client.Disconnect();
- return false;
- }
-
-
- //上传Caddy配置文件67--70
- private bool UpConfigCaddy(SshClient client)
- {
- return true;
- }
-
- //设置Caddy配置文件
- //functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SetCaddyfile(SshClient client, string upLoadPath)
- {
-
- //设置Caddyfile文件中的tls 邮箱,在caddy2中已经不需要设置。
-
- //设置Caddy监听的随机端口
- string randomCaddyListenPortStr = randomCaddyListenPort.ToString();
-
- sshShellCommand = $"sed -i 's/8800/{randomCaddyListenPortStr}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置域名
- ReceiveConfigurationParameters[4] = ReceiveConfigurationParameters[4].TrimEnd(' ');
- sshShellCommand = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/g' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置Path
- sshShellCommand = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[6]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //设置伪装网站/纯ipv6主机暂不设置
- // && onlyIpv6 == false
- if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false)
- {
- sshShellCommand = $"sed -i 's/##reverse_Proxy1##/reverse_proxy http:\\/\\/{ReceiveConfigurationParameters[7]} {{/ ' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/##reverse_Proxy2##/header_up Host {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = $"sed -i 's/##reverse_Proxy3##/}}/' {upLoadPath}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- }
- return true;
- }
-
- //程序启动检测
- //soft--要检测的程序
- //condition---成功启动的条件
- //functionResult = SoftStartDetect(client, "v2ray", @"/usr/local/bin/v2ray");
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool SoftStartDetect(SshClient client, string soft, string condition)
- {
- //****** "正在启动......" ******33
- //SetUpProgressBarProcessing(87);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoft").ToString() + $"{soft}......";
- MainWindowsShowInfo(currentStatus);
-
- //启动服务
- sshShellCommand = $"systemctl restart {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- Thread.Sleep(3000);
-
- sshShellCommand = $"ps aux | grep {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains($"{condition}") == true)
- {
- //****** "启动成功!" ******34
- //SetUpProgressBarProcessing(88);
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "启动失败!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(1000);
-
- //****** "正在启动(第二次尝试)!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartSoftSecond").ToString() + $"{soft}";
- MainWindowsShowInfo(currentStatus);
-
- Thread.Sleep(3000);
- sshShellCommand = $"systemctl restart {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- Thread.Sleep(3000);
-
- sshShellCommand = $"ps aux | grep {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains($"{condition}") == true)
- {
- //****** "启动成功!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftOK").ToString();
- MainWindowsShowInfo(currentStatus);
-
- }
- else
- {
- //****** "启动失败(第二次)!退出安装!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftSecondFail").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //显示启动失败原因
- sshShellCommand = $"journalctl -n50 --no-pager --boot -u {soft}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- //****** "启动失败,原因如上!请排查原因!" ******
- currentStatus = $"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFailedExit").ToString();
- MainWindowsShowInfo(currentStatus);
-
- //****** "启动失败,原因如上!请排查原因!" ******
- MessageBox.Show($"{soft}" + Application.Current.FindResource("DisplayInstallInfo_StartSoftFailedExit").ToString());
- return false;
- }
- }
- return true;
- }
-
- //检测BBR,满足条件并启动 90--95
- //functionResult = DetectBBRandEnable(client);
- //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
- private bool DetectBBRandEnable(SshClient client)
- {
- //测试BBR条件,若满足提示是否启用
- //****** "BBR测试......" ******37
- SetUpProgressBarProcessing(90);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"uname -r";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string[] linuxKernelVerStrBBR = currentShellCommandResult.Split('-');
-
- bool detectResultBBR = DetectKernelVersionBBR(linuxKernelVerStrBBR[0]);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- string resultCmdTestBBR = currentShellCommandResult;
- //如果内核满足大于等于4.9,且还未启用BBR,则启用BBR
- if (detectResultBBR == true && resultCmdTestBBR.Contains("bbr") == false)
- {
- //****** "正在启用BBR......" ******38
- SetUpProgressBarProcessing(93);
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_EnableBBR").ToString();
- MainWindowsShowInfo(currentStatus);
-
- sshShellCommand = @"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl -p";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- sshShellCommand = @"sysctl net.ipv4.tcp_congestion_control | grep bbr";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
-
- if (currentShellCommandResult.Contains("bbr") == true)
- {
- //****** "BBR启用成功!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBREnabledSuccess").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- //return false;
- }
- }
- else if (resultCmdTestBBR.Contains("bbr") == true)
- {
- //****** "BBR已经启用了!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRisEnabled").ToString();
- MainWindowsShowInfo(currentStatus);
- }
- else
- {
- //****** "系统不满足启用BBR的条件,启用失败!" ******
- currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRFailed").ToString();
- MainWindowsShowInfo(currentStatus);
- //return false;
- }
-
- //如果是纯ipv6主机,则需要删除前面设置的Nat64网关
- if (onlyIpv6 == true)
- {
- SetUpNat64(client, false);
- sshShellCommand = $"{sshCmdUpdate}";
- currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
- }
-
- SetUpProgressBarProcessing(95);
- return true;
- }
-
-
-
-
-
- //生成客户端配置 96--98
-
-
- #endregion
-
-
- }
-
-}
diff --git a/ProxySU/ProofreadTimeWindow.xaml b/ProxySU/ProofreadTimeWindow.xaml
deleted file mode 100644
index 01d9842..0000000
--- a/ProxySU/ProofreadTimeWindow.xaml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/ProofreadTimeWindow.xaml.cs b/ProxySU/ProofreadTimeWindow.xaml.cs
deleted file mode 100644
index 0499216..0000000
--- a/ProxySU/ProofreadTimeWindow.xaml.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Net;
-using System.Net.Sockets;
-using System.Net.NetworkInformation;
-using System.Runtime.InteropServices;
-using System.Runtime;
-using System.Globalization;
-
-namespace ProxySU
-{
- ///
- /// ProofreadTimeWindow.xaml 的交互逻辑
- ///
- public partial class ProofreadTimeWindow : Window
- {
- public static ConnectionInfo ProfreadTimeReceiveConnectionInfo { get; set; }
- //ProfreadTimeReceiveParameters
-
- public ProofreadTimeWindow()
- {
- InitializeComponent();
-
- }
-
- private void ButtonTestTime_Click(object sender, RoutedEventArgs e)
- {
- using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
- {
- client.Connect();
- client.RunCommand("rm -f /etc/localtime");
- client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
- //获取远程主机的时间戳
- long timeStampVPS = Convert.ToInt64(client.RunCommand("date +%s").Result.ToString());
-
- //获取本地时间戳
- TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
- client.Disconnect();
- if (Math.Abs(timeStampLocal - timeStampVPS) >= 90)
- {
-
- MessageBox.Show("本地时间与远程主机时间相差超过限制(90秒),V2ray无法建立连接");
-
- return;
- }
- else
- {
- MessageBox.Show("误差为:" + Math.Abs(timeStampLocal - timeStampVPS).ToString()+" 可以连接");
- }
- }
- }
-
- private void ButtonProofreading_Click(object sender, RoutedEventArgs e)
- {
- if (RadioButtonUpDateLocalTime.IsChecked == true)
- {
- //将本机电脑与网络时间同步
- DateTime netUTCtime = NetTime.GetUTCTime();
- if (!DateTime.Equals(netUTCtime, new DateTime(1970, 1, 1, 0, 0, 0, 0)))
- {
- DateTime localTime = netUTCtime.ToLocalTime();
- bool setD = UpdateTime.SetDate(localTime);
- if (setD == true)
- {
- MessageBox.Show("本机时间已经更新为网络时间(国家授时中心获取)");
- }
- else
- {
- MessageBox.Show("更新失败,请重试。");
- }
- }
- return;
- }
- using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
- {
- client.Connect();
- //设置vps为UTC时区
- client.RunCommand("rm -f /etc/localtime");
- client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
-
- if (RadioButtonLocalTime.IsChecked == true)
- {
- //以本地时间为准,校正远程主机时间
- //获取本地时间戳
- TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
-
- string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampLocal.ToString()})\"";
-
- client.RunCommand(sshCmd);
- MessageBox.Show("同步本地时间校时完毕");
-
-
- }
- else
- {
- //以网络时间为准,校正远程主机时间
- TimeSpan utcTS = NetTime.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
- if (timeStampVPS!=0)
- {
-
- string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"";
-
- client.RunCommand(sshCmd);
- MessageBox.Show("同步网络时间校时完毕");
- }
-
- }
- client.Disconnect();
- }
-
- }
-
- private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonNetworkTime.IsChecked = true;
- }
-
- private void TextBlock_MouseDown_1(object sender, MouseButtonEventArgs e)
- {
- RadioButtonLocalTime.IsChecked = true;
- }
-
- private void TextBlock_MouseDown_2(object sender, MouseButtonEventArgs e)
- {
- RadioButtonUpDateLocalTime.IsChecked = true;
- }
-
- //private void ButtonTEST_Click(object sender, RoutedEventArgs e)
- //{
- // //NetTime netTime = new NetTime();
- // string netDatetime = NetTime.GetUTCTime().ToString();
- // MessageBox.Show(netDatetime);
- // //NetTime netTime = new NetTime();
- // //UpdateTime updateTime = new UpdateTime();
- // //DateTime netDateTime = netTime.GetBeijingTime();
- // //MessageBox.Show(netDateTime.ToString());
- //}
-
- }
-
- ///
- /// 网络时间 代码从网上复制,原网址:https://www.codeleading.com/article/23791981303/
- ///
- public class NetTime
- {
- ///
- /// 从国家授时中心获取标准GMT时间,读取https://www.tsa.cn
- /// GMT时间与UTC时间没有差别,可以UTC=GMT
- ///
- /// 返回网络时间
- public static DateTime GetUTCTime()
- {
- DateTime time;
- ////Thread.Sleep(5000);
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
- request.Method = "HEAD";
- request.AllowAutoRedirect = false;
- HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
- string cc = reponse.GetResponseHeader("date");
- reponse.Close();
-
- bool s = GMTStrParse(cc, out time);
- return time;
- }
- catch (Exception ex1)
- {
- if (ex1.ToString().Contains("403"))
- {
- MessageBox.Show("校时操作太频繁,请稍等片刻再操作!");
- }
- else
- {
- MessageBox.Show(ex1.Message);
- }
- return time = new DateTime(1970, 1, 1, 0, 0, 0, 0);
- }
-
- //return time.AddHours(8); //GMT要加8个小时才是北京时间
- }
- public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串,这里转成datetime
- {
- CultureInfo enUS = new CultureInfo("en-US");
- bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
- return s;
- }
-
- }
-
- ///
- /// 更新系统时间,代码从网上复制,原网址:https://www.open-open.com/code/view/1430552965599
- ///
- public class UpdateTime
- {
- //设置系统时间的API函数
- [DllImport("kernel32.dll")]
- private static extern bool SetLocalTime(ref SYSTEMTIME time);
-
- [StructLayout(LayoutKind.Sequential)]
- private struct SYSTEMTIME
- {
- public short year;
- public short month;
- public short dayOfWeek;
- public short day;
- public short hour;
- public short minute;
- public short second;
- public short milliseconds;
- }
-
- ///
- /// 设置系统时间
- ///
- /// 需要设置的时间
- /// 返回系统时间设置状态,true为成功,false为失败
- public static bool SetDate(DateTime dt)
- {
- SYSTEMTIME st;
-
- st.year = (short)dt.Year;
- st.month = (short)dt.Month;
- st.dayOfWeek = (short)dt.DayOfWeek;
- st.day = (short)dt.Day;
- st.hour = (short)dt.Hour;
- st.minute = (short)dt.Minute;
- st.second = (short)dt.Second;
- st.milliseconds = (short)dt.Millisecond;
- bool rt = SetLocalTime(ref st);
- return rt;
- }
- }
-
-}
diff --git a/ProxySU/Properties/AssemblyInfo.cs b/ProxySU/Properties/AssemblyInfo.cs
deleted file mode 100644
index 75b945d..0000000
--- a/ProxySU/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 有关程序集的一般信息由以下
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("ProxySU")]
-[assembly: AssemblyDescription("V2ray,Trojan,NaiveProxy,Trojan-Go等一键安装工具")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ProxySU")]
-[assembly: AssemblyProduct("ProxySU")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 会使此程序集中的类型
-//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
-//请将此类型的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-//若要开始生成可本地化的应用程序,请设置
-//.csproj 文件中的 CultureYouAreCodingWith
-//例如,如果您在源文件中使用的是美国英语,
-//使用的是美国英语,请将 设置为 en-US。 然后取消
-//对以下 NeutralResourceLanguage 特性的注释。 更新
-//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //主题特定资源词典所处位置
- //(未在页面中找到资源时使用,
- //或应用程序资源字典中找到时使用)
- ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
- //(未在页面中找到资源时使用,
- //、应用程序或任何主题专用资源字典中找到时使用)
-)]
-
-
-// 程序集的版本信息由下列四个值组成:
-//
-// 主版本
-// 次版本
-// 生成号
-// 修订号
-//
-// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
-// 方法是按如下所示使用“*”: :
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.5.6.0")]
-[assembly: AssemblyFileVersion("2.5.6.0")]
diff --git a/ProxySU/Properties/Resources.Designer.cs b/ProxySU/Properties/Resources.Designer.cs
deleted file mode 100644
index 50e1154..0000000
--- a/ProxySU/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 此代码由工具生成。
-// 运行时版本: 4.0.30319.42000
-//
-// 对此文件的更改可能导致不正确的行为,如果
-// 重新生成代码,则所做更改将丢失。
-//
-//------------------------------------------------------------------------------
-
-namespace ProxySU.Properties
-{
-
-
- ///
- /// 强类型资源类,用于查找本地化字符串等。
- ///
- // 此类是由 StronglyTypedResourceBuilder
- // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
- // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
- // (以 /str 作为命令选项),或重新生成 VS 项目。
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- 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()
- {
- }
-
- ///
- /// 返回此类使用的缓存 ResourceManager 实例。
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxySU.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
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/ProxySU/Properties/Resources.resx b/ProxySU/Properties/Resources.resx
deleted file mode 100644
index af7dbeb..0000000
--- a/ProxySU/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/ProxySU/Properties/Settings.Designer.cs b/ProxySU/Properties/Settings.Designer.cs
deleted file mode 100644
index 654607b..0000000
--- a/ProxySU/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace ProxySU.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
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/ProxySU/Properties/Settings.settings b/ProxySU/Properties/Settings.settings
deleted file mode 100644
index 033d7a5..0000000
--- a/ProxySU/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/ProxySU.csproj b/ProxySU/ProxySU.csproj
deleted file mode 100644
index 9ae9d06..0000000
--- a/ProxySU/ProxySU.csproj
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {DD5505BC-E7F1-4D03-ABC7-B636E893FC09}
- WinExe
- ProxySU
- ProxySU
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- false
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 1
- 1.0.0.%2a
- false
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- ProxySU.ico
-
-
- 01AFC64B121E781F77B42A6E9F1B587DDBAD475A
-
-
- ProxySU_TemporaryKey.pfx
-
-
- true
-
-
- true
-
-
-
- ..\json.net\net40\Newtonsoft.Json.dll
-
-
- ..\qrcoder\net40\QRCoder.dll
-
-
- ..\packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
- ProofreadTimeWindow.xaml
-
-
- ResultClientInformation.xaml
-
-
- SSpluginWindow.xaml
-
-
- XayTemplateWindow.xaml
-
-
- V2RayTemplateWindow.xaml
-
-
- TrojanGoTemplateWindow.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- .editorconfig
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/ProxySU.csproj.user b/ProxySU/ProxySU.csproj.user
deleted file mode 100644
index 0871ddf..0000000
--- a/ProxySU/ProxySU.csproj.user
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- publish\
-
-
-
-
-
- zh-CN
- false
- ProjectFiles
-
-
- false
-
-
\ No newline at end of file
diff --git a/ProxySU/ProxySU.ico b/ProxySU/ProxySU.ico
deleted file mode 100644
index 9d7a128..0000000
Binary files a/ProxySU/ProxySU.ico and /dev/null differ
diff --git a/ProxySU/ResultClientInformation.xaml b/ProxySU/ResultClientInformation.xaml
deleted file mode 100644
index eede1c4..0000000
--- a/ProxySU/ResultClientInformation.xaml
+++ /dev/null
@@ -1,570 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/ResultClientInformation.xaml.cs b/ProxySU/ResultClientInformation.xaml.cs
deleted file mode 100644
index 719ece9..0000000
--- a/ProxySU/ResultClientInformation.xaml.cs
+++ /dev/null
@@ -1,4942 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Web;
-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;
-using System.IO;
-using Renci.SshNet;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Newtonsoft.Json.Serialization;
-using System.Drawing;
-using QRCoder;
-using System.Runtime.InteropServices;
-
-
-namespace ProxySU
-{
- ///
- /// ResultClientInformation.xaml 的交互逻辑
- ///
- public partial class ResultClientInformation : Window
- {
- private static string saveFileFolder = "";
- private static string configDomainSavePath = "";
- private static string server = MainWindow.ReceiveConfigurationParameters[4];
-
- private static string TextBoxURLDefault;
- private static string TextBoxURLVlessTcp;
- private static string TextBoxURLVlessWs;
- private static string TextBoxURLVmessTcp;
- private static string TextBoxURLVmessWs;
- private static string TextBoxURLTrojanTcp;
-
- private static BitmapSource ImageShareQRcodeDefault;
- private static BitmapSource ImageShareQRcodeVlessTcp;
- private static BitmapSource ImageShareQRcodeVlessWs;
- private static BitmapSource ImageShareQRcodeVmessTcp;
- private static BitmapSource ImageShareQRcodeVmessWs;
- private static BitmapSource ImageShareQRcodeTrojanTcp;
-
-
- [DllImport("user32.dll")]
- private static extern int MessageBoxTimeoutA(IntPtr hWnd, string msg, string Caps, int type, int Id, int time); //引用DLL
-
- public ResultClientInformation()
- {
- InitializeComponent();
-
- if (String.Equals(MainWindow.proxyType, "V2Ray"))
- {
- //显示V2Ray参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Visible;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- //主机地址
- TextBoxHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
- //用户ID(uuid)/Trojan密码
- TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
- //额外ID
- TextBoxUUIDextra.Text = "0";
- //加密方式,一般都为auto
- TextBoxEncryption.Text = "auto";
-
- //传输协议
- TextBoxTransmission.Text = "";
- //伪装类型
- TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
-
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = "";
-
- //QUIC密钥/mKCP Seed/路径Path
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];
-
- //TLS设置
- TextBoxTLS.Text = "none";
-
- //初始化时,隐藏多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWs.Visibility = Visibility.Collapsed;
- //显示非Trojan的所有参数
- GridNotTrojanParameters.Visibility = Visibility.Visible;
-
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "http";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "xtls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryption.Text = "none";
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];//获取Host
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- TextBoxTransmission.Text = "h2";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowHostName();
- ShowPathV2ray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if(MainWindow.mKCPvlessIsSet == true)
- {
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBoxEncryption.Text = "none";
- HideAlterId();
- HideGroupBoxClientQRandURL();
- }
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true)
- {
- TextBoxCamouflageType.Text = "none";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") == true)
- {
- TextBoxCamouflageType.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") == true)
- {
- TextBoxCamouflageType.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") == true)
- {
- TextBoxCamouflageType.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") == true)
- {
- TextBoxCamouflageType.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard") == true)
- {
- TextBoxCamouflageType.Text = "wireguard";
- }
-
- TextBoxTransmission.Text = "kcp";
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];//获取mkcp Seed
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowMkcpSeed();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicNone") == true)
- {
- TextBoxCamouflageType.Text = "none";
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicSRTP") == true)
- {
- TextBoxCamouflageType.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Quic2uTP") == true)
- {
- TextBoxCamouflageType.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWechatVideo") == true)
- {
- TextBoxCamouflageType.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicDTLS") == true)
- {
- TextBoxCamouflageType.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWireGuard") == true)
- {
- TextBoxCamouflageType.Text = "wireguard";
- }
-
- TextBoxTransmission.Text = "quic";
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[3];//获取Quic加密方式
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];//获取Quic加密密钥
- TextBoxTLS.Text = "none";
- ShowQuicEncryption();
- ShowQuicKey();
- }
-
- else
- {
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- TextBoxTLS.Text = "none";
- ShowHostName();
- ShowPathV2ray();
- }
- CheckDir("v2ray_config");
-
- GenerateV2rayShareQRcodeAndBase64Url();
- #endregion
- }
- else
- {
- //显示多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWs.Visibility = Visibility.Visible;
-
- string proxyfolder = CheckDir("v2ray_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddress.Text);
-
- V2raySetVlessTcpXtls();
- //GenerateV2rayVlessTcpXtlsShareQRcodeAndBase64Url();
-
- V2raySetVlessTcpTls();
- GenerateV2rayVlessTcpTlsShareQRcodeAndBase64Url();
-
- V2raySetVlessWsTls();
- GenerateV2rayVlessWsTlsShareQRcodeAndBase64Url();
-
- V2raySetVmessTcpTls();
- GenerateV2rayVmessTcpTlsShareQRcodeAndBase64Url();
-
- V2raySetVmessWsTls();
- GenerateV2rayVmessWsTlsShareQRcodeAndBase64Url();
-
- GenerateV2rayTrojanShareQRcodeAndBase64Url();
- RadioButtonVlessTcpTls.IsChecked = true;
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "Xray"))
- {
- //显示Xray参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Visible;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- //主机地址
- TextBoxHostAddressXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPortXray.Text = MainWindow.ReceiveConfigurationParameters[1];
- //用户ID(uuid)/Trojan密码
- TextBoxUUIDXray.Text = MainWindow.ReceiveConfigurationParameters[2];
- //额外ID
- TextBoxUUIDextraXray.Text = "0";
- //加密方式,一般都为auto
- TextBoxEncryptionXray.Text = "auto";
-
- //传输协议
- TextBoxTransmissionXray.Text = "";
- //伪装类型
- TextBoxCamouflageTypeXray.Text = MainWindow.ReceiveConfigurationParameters[5];
-
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = "";
-
- //QUIC密钥/mKCP Seed/路径Path
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];
-
- //TLS设置
- TextBoxTLSXray.Text = "none";
-
- //初始化时,隐藏多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWsXray.Visibility = Visibility.Collapsed;
- //显示非Trojan的所有参数
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
-
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessVmessXtlsTcpWebSocketWeb") == false)
- {
- #region 单模式方案
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "http";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLS") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "tcpTLSselfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "xtls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
-
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxEncryptionXray.Text = "none";
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- HideGroupBoxClientQRandURL();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "webSocket") == true)
- {
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLSselfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2Web") == true)
- {
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];//获取Host
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "http2selfSigned") == true)
- {
- TextBoxTransmissionXray.Text = "h2";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowHostNameXray();
- ShowPathXray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- if (MainWindow.mKCPvlessIsSet == true)
- {
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBoxEncryptionXray.Text = "none";
- HideAlterIdXray();
- HideGroupBoxClientQRandURL();
- }
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPNone") == true)
- {
- TextBoxCamouflageTypeXray.Text = "none";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") == true)
- {
- TextBoxCamouflageTypeXray.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wireguard";
- }
-
- TextBoxTransmissionXray.Text = "kcp";
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];//获取mkcp Seed
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowMkcpSeedXray();
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicNone") == true)
- {
- TextBoxCamouflageTypeXray.Text = "none";
-
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicSRTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "srtp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Quic2uTP") == true)
- {
- TextBoxCamouflageTypeXray.Text = "utp";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWechatVideo") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wechat-video";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicDTLS") == true)
- {
- TextBoxCamouflageTypeXray.Text = "dtls";
- }
- else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWireGuard") == true)
- {
- TextBoxCamouflageTypeXray.Text = "wireguard";
- }
-
- TextBoxTransmissionXray.Text = "quic";
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[3];//获取Quic加密方式
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];//获取Quic加密密钥
- TextBoxTLSXray.Text = "none";
- ShowQuicEncryptionXray();
- ShowQuicKeyXray();
- }
-
- else
- {
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- TextBoxTLSXray.Text = "none";
- ShowHostNameXray();
- ShowPathXray();
- }
- CheckDir("xray_config");
-
- GenerateXrayShareQRcodeAndBase64Url();
- #endregion
- }
- else
- {
- //显示多方案客户端选择面板
- GroupBoxSelectVlessVmessXtlsTcpWsXray.Visibility = Visibility.Visible;
-
- string proxyfolder = CheckDir("xray_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressXray.Text);
-
- XraySetVlessTcpXtls();
- GenerateXrayVlessTcpXtlsShareQRcodeAndBase64Url();
-
- XraySetVlessTcpTls();
- GenerateXrayVlessTcpTlsShareQRcodeAndBase64Url();
-
- XraySetVlessWsTls();
- GenerateXrayVlessWsTlsShareQRcodeAndBase64Url();
-
- XraySetVmessTcpTls();
- GenerateXrayVmessTcpTlsShareQRcodeAndBase64Url();
-
- XraySetVmessWsTls();
- GenerateXrayVmessWsTlsShareQRcodeAndBase64Url();
-
- GenerateXrayTrojanShareQRcodeAndBase64Url();
- RadioButtonVlessTcpXtlsXray.IsChecked = true;
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "TrojanGo"))
- {
- //GroupBoxTrojanClient.Header = "Trojan-go 客户端配置参数";
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Visible;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockTrojanGoHost.Visibility = Visibility.Hidden;
- TextBoxTrojanGoHost.Visibility = Visibility.Hidden;
- TextBoxTrojanGoWSPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Hidden;
- TextBlockTrojanGoCaption.Visibility = Visibility.Hidden;
-
- TextBlockMuxSelect.Visibility = Visibility.Hidden;
- GridMuxSelect.Visibility = Visibility.Hidden;
- TextBlockExplainCheckBoxMuxSelectResult.Visibility = Visibility.Hidden;
-
- //******"可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。" ******
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainTrojan-go").ToString();
-
- //主机地址
- TextBoxTrojanGoServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxTrojanGoServerPort.Text = "443";
- //密钥(uuid)
- TextBoxTrojanGoServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
- //SNI
- TextBoxTrojanGoSNI.Text = MainWindow.ReceiveConfigurationParameters[4];
- //TrojanGo 使用类型
- TextBoxTrojanGoType.Text = "original";
-
- //WebSocket设置
- if (MainWindow.ReceiveConfigurationParameters[0].Equals("TrojanGoWebSocketTLS2Web"))
- {
- TextBoxTrojanGoType.Text = "ws";
- //Host
- TextBoxTrojanGoHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBlockTrojanGoHost.Visibility = Visibility.Visible;
- TextBoxTrojanGoHost.Visibility = Visibility.Visible;
- //Path
- TextBoxTrojanGoWSPath.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBoxTrojanGoWSPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoWebSocketPath.Visibility = Visibility.Visible;
- TextBlockTrojanGoCaption.Visibility = Visibility.Visible;
-
- }
- if(String.Equals(MainWindow.ReceiveConfigurationParameters[9],"true") == true)
- {
- TextBoxConcurrency.Text = MainWindow.ReceiveConfigurationParameters[3];
- TextBoxIdle_timeout.Text = MainWindow.ReceiveConfigurationParameters[5];
- TextBlockMuxSelect.Visibility = Visibility.Visible;
- GridMuxSelect.Visibility = Visibility.Visible;
- TextBlockExplainCheckBoxMuxSelectResult.Visibility = Visibility.Visible;
- }
- CheckDir("trojan-go_config");
- GenerateTrojanGoShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "Trojan"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Visible;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainTrojan").ToString();
-
- //主机地址
- TextBoxTrojanServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxTrojanServerPort.Text = "443";
- //密钥(uuid)
- TextBoxTrojanServerPassword.Text = MainWindow.ReceiveConfigurationParameters[2];
-
- CheckDir("trojan_config");
- GenerateTrojanShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "NaiveProxy"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Visible;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainNaiveProxy").ToString();
-
- TextBoxNaiveServerHost.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxNaiveUser.Text = MainWindow.ReceiveConfigurationParameters[3];
- TextBoxNaivePassword.Text = MainWindow.ReceiveConfigurationParameters[2];
- GenerateNaivePrxoyShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "SSR"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Visible;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSSR").ToString();
-
- //主机地址
- TextBoxSSRHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxSSRPort.Text = "443";
- //密码(uuid)
- TextBoxSSRUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
- //加密方式
- TextBoxSSREncryption.Text = "none";
- //传输协议
- TextBoxSSRTransmission.Text = "auth_chain_a";
- //混淆
- TextBoxSSRCamouflageType.Text = "tls1.2_ticket_auth";
-
- //CheckDir("ssr_config");
- GenerateSSRShareQRcodeAndBase64Url();
- }
- else if (String.Equals(MainWindow.proxyType, "SS"))
- {
- GroupBoxClientMTProto.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Visible;
-
- //主机地址
- TextBoxHostAddressSS.Text = MainWindow.ReceiveConfigurationParameters[4];
- //主机端口
- TextBoxPortSS.Text = MainWindow.ReceiveConfigurationParameters[1];
- //密码(uuid)
- TextBoxPasswordSS.Text = MainWindow.ReceiveConfigurationParameters[2];
- //加密方式
- TextBoxEncryptionSS.Text = MainWindow.ReceiveConfigurationParameters[3];
- //插件程序
- TextBoxPluginNameExplainSS.Text = MainWindow.ReceiveConfigurationParameters[5];
- //插件选项
- TextBoxPluginOptionExplainSS.Text = MainWindow.ReceiveConfigurationParameters[9];
- //创建ss配置文件总文件夹
- CheckDir("ss_config");
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- TextBlockPluginNameExplainSS.Visibility = Visibility.Collapsed;
- TextBoxPluginNameExplainSS.Visibility = Visibility.Collapsed;
-
- //TextBoxPluginNameExplainSSpc.Visibility = Visibility.Collapsed;
- TextBlockPluginOptionExplainSS.Visibility = Visibility.Collapsed;
- TextBoxPluginOptionExplainSS.Visibility = Visibility.Collapsed;
-
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- RadioButtonPC.Visibility = Visibility.Collapsed;
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSS").ToString();
- }
- else
- {
- //显示插件程序与插件选项
- TextBlockPluginNameExplainSS.Visibility = Visibility.Visible;
- TextBoxPluginNameExplainSS.Visibility = Visibility.Visible;
-
- TextBlockPluginOptionExplainSS.Visibility = Visibility.Visible;
- TextBoxPluginOptionExplainSS.Visibility = Visibility.Visible;
-
- TextBlockClientPromptSS.Visibility = Visibility.Visible;
- RadioButtonMobile.Visibility = Visibility.Visible;
- RadioButtonPC.Visibility = Visibility.Visible;
-
- TextBlockQrURLexplain.Text = Application.Current.FindResource("TextBlockQrURLexplainSSmobile").ToString();
- TextBlockQrURLexplainSSpc.Text = Application.Current.FindResource("TextBlockQrURLexplainSSpc").ToString();
-
- //转换成PC版plugin格式
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "obfs-local"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\obfs-local.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "v2ray-plugin"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\v2ray-plugin.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "kcptun"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\kcptun-client.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\goquiet-client.exe";
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "cloak"))
- {
- TextBoxPluginNameExplainSSpc.Text = @"plugins\cloak-client.exe";
- }
- }
-
- GenerateShareQRcodeAndBase64UrlSS();
- //选择手机端做为默认显示
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- RadioButtonMobile.IsChecked = true;
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet"))
- {
- RadioButtonPC.IsChecked = true;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- //File.Delete($"ss_config\\{saveFileFolder}\\QR.bmp");
- //File.Delete($"ss_config\\{saveFileFolder}\\url.txt");
- }
- else if (String.Equals(TextBoxPluginNameExplainSS.Text, "cloak"))
- {
- RadioButtonPC.IsChecked = true;
- RadioButtonMobile.Visibility = Visibility.Collapsed;
- TextBlockClientPromptSS.Visibility = Visibility.Collapsed;
- //File.Delete($"ss_config\\{saveFileFolder}\\QR.bmp");
- //File.Delete($"ss_config\\{saveFileFolder}\\url.txt");
- }
-
- }
-
- }
- else if (String.Equals(MainWindow.proxyType, "MTProto"))
- {
- //显示MTProto参数,隐藏其他
- GroupBoxClientMTProto.Visibility = Visibility.Visible;
- GroupBoxClientQRandURL.Visibility = Visibility.Collapsed;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
- GroupBoxV2rayClient.Visibility = Visibility.Collapsed;
- GroupBoxXrayClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanGoClient.Visibility = Visibility.Collapsed;
- GroupBoxTrojanClient.Visibility = Visibility.Collapsed;
- GroupBoxNaiveProxyClient.Visibility = Visibility.Collapsed;
- GroupBoxSSRClient.Visibility = Visibility.Collapsed;
- GroupBoxClientSS.Visibility = Visibility.Collapsed;
-
- string proxyfolder = CheckDir("mtproto_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, MainWindow.ReceiveConfigurationParameters[4]);
- string configSavePath = configDomainSavePath;
-
- RadioButtonMtgIpv4.IsChecked = true;
-
- JObject jObjectJson = JObject.Parse(MainWindow.ReceiveConfigurationParameters[9]);
-
- if (jObjectJson["ipv6"]["tg_url"].ToString().Contains("nil") == false)
- {
- RadioButtonMtgIpv6.Visibility = Visibility.Visible;
- TextBoxURLMtgTgIpv6.Text = jObjectJson["ipv6"]["tg_url"].ToString();
- ImageShareQRcodeMtgTgIpv6.Source = CreateQRCode(TextBoxURLMtgTgIpv6.Text, $"{configSavePath}\\QRIpv6Tg.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv6Tg.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTgIpv6.Text);
- }
-
- TextBoxURLMtgTmeIpv6.Text = jObjectJson["ipv6"]["tme_url"].ToString();
- ImageShareQRcodeMtgTmeIpv6.Source = CreateQRCode(TextBoxURLMtgTmeIpv6.Text, $"{configSavePath}\\QRIpv6Tme.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv6Tme.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTmeIpv6.Text);
- }
- RadioButtonMtgIpv6.IsChecked = true;
- }
- else
- {
- RadioButtonMtgIpv6.Visibility = Visibility.Collapsed;
- }
-
- if (jObjectJson["ipv4"]["tg_url"].ToString().Contains("nil") == false)
- {
- RadioButtonMtgIpv4.Visibility = Visibility.Visible;
- TextBoxURLMtgTgIpv4.Text = jObjectJson["ipv4"]["tg_url"].ToString();
- ImageShareQRcodeMtgTgIpv4.Source = CreateQRCode(TextBoxURLMtgTgIpv4.Text, $"{configSavePath}\\QRIpv4Tg.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv4Tg.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTgIpv4.Text);
- }
-
- TextBoxURLMtgTmeIpv4.Text = jObjectJson["ipv4"]["tme_url"].ToString();
- ImageShareQRcodeMtgTmeIpv4.Source = CreateQRCode(TextBoxURLMtgTmeIpv4.Text, $"{configSavePath}\\QRIpv4Tme.bmp");
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\urlIpv4Tme.txt"))
- {
- sw.WriteLine(TextBoxURLMtgTmeIpv4.Text);
- }
- RadioButtonMtgIpv4.IsChecked = true;
- }
- else
- {
- RadioButtonMtgIpv4.Visibility = Visibility.Collapsed;
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\mtproto_info.json"))
- {
- sw.Write(MainWindow.ReceiveConfigurationParameters[9].ToString());
- }
-
- }
- }
-
- #region V2Ray 相关
-
- #region V2ray参数设置函数
-
- //设置VLESS over TCP with XTLS
- private void V2raySetVlessTcpXtls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //ImageShareQRcode.Source = ImageShareQRcodeDefault;
- //TextBoxURL.Text = TextBoxURLDefault;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "xtls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = "";
-
-
- }
-
- //设置VLESS over TCP with TLS
- private void V2raySetVlessTcpTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = "";
- }
-
- //设置VLESS over WS with TLS
- private void V2raySetVlessWsTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBlockVmessOrVless.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVless.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- HideAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[3];
-
- }
-
- //设置VMess over TCP with TLS
- private void V2raySetVmessTcpTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "tcp";
- TextBoxCamouflageType.Text = "http";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[9];
- TextBlockVmessOrVless.Visibility = Visibility.Collapsed;
- //显示下面的二维码显示。
- //HideGroupBoxClientQRandURL();
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessTcp;
- ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
- }
-
- //设置VMess over WS with TLS
- private void V2raySetVmessWsTls()
- {
- GridNotTrojanParameters.Visibility = Visibility.Visible;
- TextBoxEncryption.Text = "none";
- TextBoxTransmission.Text = "ws";
- TextBoxCamouflageType.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLS.Text = "tls";
- ShowAlterId();
- ShowHostName();
- ShowPathV2ray();
- TextBoxQuicKeyMkcpSeedPath.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBlockVmessOrVless.Visibility = Visibility.Collapsed;
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessWs;
- ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
- }
-
- //设置Trojan over TCP with TLS
- private void V2raySetTrojanTcpTls()
- {
- //隐藏所有不是Trojan的参数
- GridNotTrojanParameters.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLTrojanTcp;
- ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- }
- #endregion
-
- #region 界面控制相关
-
- //显示Quic 加密方式
- private void ShowQuicEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- TextBlockHost.Visibility = Visibility.Collapsed;
- }
-
- //显示Host隐藏Quic加密方式
- private void ShowHostName()
- {
- TextBlockHost.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- }
-
- //显示路径Path,隐藏mKCP/Quic Key/复制按钮
- private void ShowPathV2ray()
- {
- TextBlockPath.Visibility = Visibility.Visible;
- TextBlockMkcpSeed.Visibility = Visibility.Collapsed;
- TextBlockQuicKey.Visibility = Visibility.Collapsed;
- }
-
- //显示mKCP Seed/复制按钮,隐藏Path/Quic Key
- private void ShowMkcpSeed()
- {
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeed.Visibility = Visibility.Visible;
- TextBlockQuicKey.Visibility = Visibility.Collapsed;
- }
-
- //显示Quic Key/复制按钮 隐藏Path/mKcp Seed
- private void ShowQuicKey()
- {
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeed.Visibility = Visibility.Collapsed;
- TextBlockQuicKey.Visibility = Visibility.Visible;
- }
-
- //显示额外ID
- private void ShowAlterId()
- {
- TextBlockUUIDextra.Visibility = Visibility.Visible;
- TextBoxUUIDextra.Visibility = Visibility.Visible;
- TextBlockUUIDextraExplanation.Visibility = Visibility.Visible;
-
- }
-
- //隐藏额外ID
- private void HideAlterId()
- {
- TextBlockUUIDextra.Visibility = Visibility.Collapsed;
- TextBoxUUIDextra.Visibility = Visibility.Collapsed;
- TextBlockUUIDextraExplanation.Visibility = Visibility.Collapsed;
-
- }
-
- //显示加密方式
- private void ShowEncryption()
- {
- TextBlockEncryption.Visibility = Visibility.Visible;
- TextBoxEncryption.Visibility = Visibility.Visible;
- }
- //隐藏加密方式
- private void HideEncryption()
- {
- TextBlockEncryption.Visibility = Visibility.Collapsed;
- TextBoxEncryption.Visibility = Visibility.Collapsed;
- }
-
- //显示传输协议
- private void ShowTransferProtocol()
- {
- TextBlockTransferProtocol.Visibility = Visibility.Visible;
- TextBoxTransmission.Visibility = Visibility.Visible;
- }
- //隐藏传输协议
- private void HideTransferProtocol()
- {
- TextBlockTransferProtocol.Visibility = Visibility.Collapsed;
- TextBoxTransmission.Visibility = Visibility.Collapsed;
- }
- //显示伪装类型
- private void ShowTextBlockCamouflageType()
- {
- TextBlockCamouflageType.Visibility = Visibility.Visible;
- TextBoxCamouflageType.Visibility = Visibility.Visible;
- }
- //隐藏伪装类型
- private void HideTextBlockCamouflageType()
- {
- TextBlockCamouflageType.Visibility = Visibility.Collapsed;
- TextBoxCamouflageType.Visibility = Visibility.Collapsed;
- }
-
- //显示二维码与链接分享
- private void ShowGroupBoxClientQRandURL()
- {
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
- }
- //隐藏二维码与链接分享
- private void HideGroupBoxClientQRandURL()
- {
- GroupBoxClientQRandURL.Visibility = Visibility.Hidden;
- }
-
- //以下几个为对RadioButton按钮的选中后,界面变化与参数显示
- private void RadioButtonVlessTcpXtls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessTcpXtls();
- }
-
- private void RadioButtonVlessTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessTcpTls();
- }
-
- private void RadioButtonVlessWsTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVlessWsTls();
- }
-
- private void RadioButtonVmessTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVmessTcpTls();
- }
-
- private void RadioButtonVmessWsTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetVmessWsTls();
- }
-
- private void RadioButtonTrojanTcpTls_Checked(object sender, RoutedEventArgs e)
- {
- V2raySetTrojanTcpTls();
- }
- #endregion
-
- #region 复制参数到剪贴板中
-
- //复制内容到剪贴板函数
- private void CopyToClipboard(string content)
- {
- if (content != "")
- {
- Clipboard.SetDataObject(content);
- //MessageBox.Show(Application.Current.FindResource("MessageBoxShow_V2RayUUIDcopyedToClip").ToString());
- string message = Application.Current.FindResource("MessageBoxShow_V2RayUUIDcopyedToClip").ToString();
- MessageBoxTimeoutA((IntPtr)0, message, "", 0, 0, 600); // 直接调用 0.6秒后自动关闭
- }
- else
- {
- //MessageBox.Show(Application.Current.FindResource("MessageBoxShow_V2RayEmptyToClip").ToString());
- string message = Application.Current.FindResource("MessageBoxShow_V2RayEmptyToClip").ToString();
- MessageBoxTimeoutA((IntPtr)0, message, "", 0, 0, 600); // 直接调用 0.6秒后自动关闭
- }
- }
-
- //复制服务器地址到剪贴板
- private void TextBoxHostAddress_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddress.Text);
- }
-
-
- //复制服务器端口到剪贴板
- private void TextBoxPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPort.Text);
- }
-
- //复制UUID到剪贴板
- private void TextBoxUUID_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUID.Text);
- }
-
- //复制额外ID到剪贴板
- private void TextBoxUUIDextra_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDextra.Text);
- }
-
- //复制加密方式到剪贴板
- private void TextBoxEncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryption.Text);
- }
-
- //复制传输协议到剪贴板
- private void TextBoxTransmission_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTransmission.Text);
- }
-
- //复制伪装方式到剪贴板
- private void TextBoxCamouflageType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxCamouflageType.Text);
- }
-
- //复制Host/Quic加密方法到剪贴板
- private void TextBoxHostQuicEncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostQuicEncryption.Text);
- }
-
- //复制Quic Key/mKCP Seed/路径Path 到剪贴板中
- private void TextBoxQuicKeyMkcpSeedPath_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxQuicKeyMkcpSeedPath.Text);
- }
-
- //复制TLS 到剪贴板中
- private void TextBoxTLS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTLS.Text);
- }
-
- //复制URL链接到剪贴板中
- private void TextBoxURL_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURL.Text);
- }
-
- #endregion
-
- #region V2Ray客户端生成
- //生成单方案v2rayN客户端导入文件
- private void GenerateV2rayShareQRcodeAndBase64Url()
- {
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmission.Text.Contains("quic")==true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- //MessageBox.Show(v2rayNjsonObject["v"].ToString());
- //MessageBox.Show("step1");
- string proxyfolder = CheckDir("v2ray_config");
- //MessageBox.Show("step2");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddress.Text);
- //MessageBox.Show("step3");
- string configSavePath = configDomainSavePath;
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = vmessUrl;
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false
- && MainWindow.mKCPvlessIsSet == false)
- {
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(vmessUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (File.Exists(@"v2ray_config\config.json"))
- {
- File.Move(@"v2ray_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
- //sw.WriteLine("config.json");
- ////****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- ////****** "v2ray官方网站:https://www.v2ray.com/" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- ////****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- ////****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- ////****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- ////****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- ////****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- ////****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- ////****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- ////****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- ////****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- ////写入通用配置参数
- //TxtWriteGeneralParameters(sw);
- }
- }
-
- #region VLESS VMESS XTLS WS共存方案生成链接与说明文件
-
- //生成VLESS Vmess Tcp Xtls Ws 配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessVmessTcpXtlsWsShareQRcodeAndBase64Url(string plainSavePath)
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- //string plainSavePath = @"";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = vmessUrl;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
- // if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- // {
- // sw.WriteLine(vmessUrl);
- // }
- //}
- //if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- //{
- // ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //}
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParameters(sw);
- }
- }
-
-
- //生成VLESS over TCP with XTLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessTcpXtlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_xtls_client_config";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLDefault = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLDefault;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLDefault);
-
- //}
-
- // ImageShareQRcodeDefault = CreateQRCode(TextBoxURLDefault, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeDefault;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VLESS over TCP with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessTcp);
-
- //}
-
- // ImageShareQRcodeVlessTcp = CreateQRCode(TextBoxURLVlessTcp, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VLESS over WS with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateV2rayVlessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessWs);
-
- //}
-
- // ImageShareQRcodeVlessWs = CreateQRCode(TextBoxURLVlessWs, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParameters(sw,false);
-
- }
- }
-
- //生成VMess over TCP with TLS的配置保存
- private void GenerateV2rayVmessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmission.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessTcp);
- }
-
- ImageShareQRcodeVmessTcp = CreateQRCode(TextBoxURLVmessTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
-
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
-
- }
- }
-
- //生成VMess over WS with TLS的配置保存
- private void GenerateV2rayVmessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- if (TextBoxTransmission.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- }
- else if (TextBoxTransmission.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = "tls"; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessWs;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
-
- sw.WriteLine(TextBoxURLVmessWs);
-
- }
-
- ImageShareQRcodeVmessWs = CreateQRCode(TextBoxURLVmessWs, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
-
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerate(sw);
-
- }
- }
-
- //生成Trojan over TCP with TLS的配置保存
- private void GenerateV2rayTrojanShareQRcodeAndBase64Url()
- {
- //创建保存目录
- string plainSavePath = @"trojan_tcp_tls_client_config";
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
- TextBoxURLTrojanTcp = $"trojan://{TextBoxUUID.Text}@{TextBoxHostAddress.Text}:{TextBoxPort.Text}#{TextBoxHostAddress.Text}";
-
- //TextBoxURL.Text = TextBoxURLTrojanTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLTrojanTcp);
-
- }
- //ImageShareQRcode.Source = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- ImageShareQRcodeTrojanTcp = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- //移动官方程序配置文件到相应目录
- if (File.Exists($"v2ray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"v2ray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"v2ray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //ReadmeTxtWriteGenerate(sw);
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- //写入VMESS的readme.txt文件
- private void ReadmeTxtWriteGenerate(StreamWriter sw)
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParameters(sw);
- }
- //TXT文件中写入通用配置参数---
- private void TxtWriteGeneralParameters(StreamWriter sw,bool alterId = true)
- {
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (alterId == true)
- {
- strApplicat = "TextBlockV2RayAlterId";
- strParam = TextBoxUUIDextra.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
- }
-
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryption.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxTransmission.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxCamouflageType.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockIsOrNotTLS";
- strParam = TextBoxTLS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicEncryption.Text, strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicKey.Text, strLenth) + strParam);
-
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockMkcpSeed.Text, strLenth) + strParam);
-
- }
- else
- {
- strParam = TextBoxHostQuicEncryption.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPath.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockPath.Text, strLenth) + strParam);
- }
- }
- #endregion
-
- #endregion
-
- #endregion
-
- #region Xray 相关
-
- #region Xray参数设置函数
-
- //设置VLESS over TCP with XTLS
- private void XraySetVlessTcpXtls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "xtls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = "";
-
-
- }
-
- //设置VLESS over TCP with TLS
- private void XraySetVlessTcpTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = "";
- }
-
- //设置VLESS over WS with TLS
- private void XraySetVlessWsTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBlockVmessOrVlessXray.Text = Application.Current.FindResource("TabItemHeaderV2RayVlessProtocol").ToString();
- TextBlockVmessOrVlessXray.Visibility = Visibility.Visible;
- //隐藏下面的二维码显示
- HideGroupBoxClientQRandURL();
-
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- HideAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[3];
-
- }
-
- //设置VMess over TCP with TLS
- private void XraySetVmessTcpTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "tcp";
- TextBoxCamouflageTypeXray.Text = "http";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[9];
- TextBlockVmessOrVlessXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码显示。
- //HideGroupBoxClientQRandURL();
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessTcp;
- ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
- }
-
- //设置VMess over WS with TLS
- private void XraySetVmessWsTls()
- {
- GridNotTrojanParametersXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Text = "none";
- TextBoxTransmissionXray.Text = "ws";
- TextBoxCamouflageTypeXray.Text = "none";
- //TLS的Host /Quic 加密方式
- TextBoxHostQuicEncryptionXray.Text = MainWindow.ReceiveConfigurationParameters[4];
- TextBoxTLSXray.Text = "tls";
- ShowAlterIdXray();
- ShowHostNameXray();
- ShowPathXray();
- TextBoxQuicKeyMkcpSeedPathXray.Text = MainWindow.ReceiveConfigurationParameters[6];
- TextBlockVmessOrVlessXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLVmessWs;
- ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
- }
-
- //设置Trojan over TCP with TLS
- private void XraySetTrojanTcpTls()
- {
- //隐藏所有不是Trojan的参数
- GridNotTrojanParametersXray.Visibility = Visibility.Collapsed;
- //显示下面的二维码与分享链接
- ShowGroupBoxClientQRandURL();
- TextBoxURL.Text = TextBoxURLTrojanTcp;
- ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- }
- #endregion
-
- #region 界面控制相关
-
- //显示Quic 加密方式
- private void ShowQuicEncryptionXray()
- {
- TextBlockQuicEncryptionXray.Visibility = Visibility.Visible;
- TextBlockHostXray.Visibility = Visibility.Collapsed;
- }
-
- //显示Host隐藏Quic加密方式
- private void ShowHostNameXray()
- {
- TextBlockHostXray.Visibility = Visibility.Visible;
- TextBlockQuicEncryptionXray.Visibility = Visibility.Collapsed;
- }
-
- //显示路径Path,隐藏mKCP/Quic Key/复制按钮
- private void ShowPathXray()
- {
- TextBlockPathXray.Visibility = Visibility.Visible;
- TextBlockMkcpSeedXray.Visibility = Visibility.Collapsed;
- TextBlockQuicKeyXray.Visibility = Visibility.Collapsed;
- }
-
- //显示mKCP Seed/复制按钮,隐藏Path/Quic Key
- private void ShowMkcpSeedXray()
- {
- TextBlockPathXray.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeedXray.Visibility = Visibility.Visible;
- TextBlockQuicKeyXray.Visibility = Visibility.Collapsed;
- }
-
- //显示Quic Key/复制按钮 隐藏Path/mKcp Seed
- private void ShowQuicKeyXray()
- {
- TextBlockPathXray.Visibility = Visibility.Collapsed;
- TextBlockMkcpSeedXray.Visibility = Visibility.Collapsed;
- TextBlockQuicKeyXray.Visibility = Visibility.Visible;
- }
-
- //显示额外ID
- private void ShowAlterIdXray()
- {
- TextBlockUUIDextraXray.Visibility = Visibility.Visible;
- TextBoxUUIDextraXray.Visibility = Visibility.Visible;
- TextBlockUUIDextraExplanationXray.Visibility = Visibility.Visible;
-
- }
-
- //隐藏额外ID
- private void HideAlterIdXray()
- {
- TextBlockUUIDextraXray.Visibility = Visibility.Collapsed;
- TextBoxUUIDextraXray.Visibility = Visibility.Collapsed;
- TextBlockUUIDextraExplanationXray.Visibility = Visibility.Collapsed;
-
- }
-
- //显示加密方式
- private void ShowEncryptionXray()
- {
- TextBlockEncryptionXray.Visibility = Visibility.Visible;
- TextBoxEncryptionXray.Visibility = Visibility.Visible;
- }
- //隐藏加密方式
- private void HideEncryptionXray()
- {
- TextBlockEncryptionXray.Visibility = Visibility.Collapsed;
- TextBoxEncryptionXray.Visibility = Visibility.Collapsed;
- }
-
- //显示传输协议
- private void ShowTransferProtocolXray()
- {
- TextBlockTransferProtocolXray.Visibility = Visibility.Visible;
- TextBoxTransmissionXray.Visibility = Visibility.Visible;
- }
- //隐藏传输协议
- private void HideTransferProtocolXray()
- {
- TextBlockTransferProtocolXray.Visibility = Visibility.Collapsed;
- TextBoxTransmissionXray.Visibility = Visibility.Collapsed;
- }
- //显示伪装类型
- private void ShowTextBlockCamouflageTypeXray()
- {
- TextBlockCamouflageTypeXray.Visibility = Visibility.Visible;
- TextBoxCamouflageTypeXray.Visibility = Visibility.Visible;
- }
- //隐藏伪装类型
- private void HideTextBlockCamouflageTypeXray()
- {
- TextBlockCamouflageTypeXray.Visibility = Visibility.Collapsed;
- TextBoxCamouflageTypeXray.Visibility = Visibility.Collapsed;
- }
-
-
- //以下几个为对RadioButton按钮的选中后,界面变化与参数显示
- private void RadioButtonVlessTcpXtlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessTcpXtls();
- }
-
- private void RadioButtonVlessTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessTcpTls();
- }
-
- private void RadioButtonVlessWsTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVlessWsTls();
- }
-
- private void RadioButtonVmessTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVmessTcpTls();
- }
-
- private void RadioButtonVmessWsTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetVmessWsTls();
- }
-
- private void RadioButtonTrojanTcpTlsXray_Checked(object sender, RoutedEventArgs e)
- {
- XraySetTrojanTcpTls();
- }
- #endregion
-
- #region 复制参数到剪贴板中
-
-
-
- //复制服务器地址到剪贴板
- private void TextBoxHostAddressXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddressXray.Text);
- }
-
-
- //复制服务器端口到剪贴板
- private void TextBoxPortXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPortXray.Text);
- }
-
- //复制UUID到剪贴板
- private void TextBoxUUIDXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDXray.Text);
- }
-
- //复制额外ID到剪贴板
- private void TextBoxUUIDextraXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxUUIDextraXray.Text);
- }
-
- //复制加密方式到剪贴板
- private void TextBoxEncryptionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryptionXray.Text);
- }
-
- //复制传输协议到剪贴板
- private void TextBoxTransmissionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTransmissionXray.Text);
- }
-
- //复制伪装方式到剪贴板
- private void TextBoxCamouflageTypeXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxCamouflageTypeXray.Text);
- }
-
- //复制Host/Quic加密方法到剪贴板
- private void TextBoxHostQuicEncryptionXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostQuicEncryptionXray.Text);
- }
-
- //复制Quic Key/mKCP Seed/路径Path 到剪贴板中
- private void TextBoxQuicKeyMkcpSeedPathXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxQuicKeyMkcpSeedPathXray.Text);
- }
-
- //复制TLS 到剪贴板中
- private void TextBoxTLSXray_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTLSXray.Text);
- }
-
- #endregion
-
- #region Xray客户端生成
- //生成单方案v2rayN客户端导入文件
- private void GenerateXrayShareQRcodeAndBase64Url()
- {
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLSXray.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- //MessageBox.Show(v2rayNjsonObject["v"].ToString());
- //MessageBox.Show("step1");
- string proxyfolder = CheckDir("xray_config");
- //MessageBox.Show("step2");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressXray.Text);
- //MessageBox.Show("step3");
- string configSavePath = configDomainSavePath;
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = vmessUrl;
- if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessXtlsTcp") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessWebSocketTlsWeb") == false
- && String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessHttp2Web") == false
- && MainWindow.mKCPvlessIsSet == false)
- {
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(vmessUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (File.Exists(@"xray_config\config.json"))
- {
- File.Move(@"xray_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- #region VLESS VMESS XTLS WS共存方案生成链接与说明文件
-
- //生成VLESS Vmess Tcp Xtls Ws 配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessVmessTcpXtlsWsShareQRcodeAndBase64Url(string plainSavePath)
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- //string plainSavePath = @"";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = vmessUrl;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
- // if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- // {
- // sw.WriteLine(vmessUrl);
- // }
- //}
- //if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "VlessTcpTlsWeb") == false)
- //{
- // ImageShareQRcode.Source = CreateQRCode(vmessUrl, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //}
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为v2ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "v2ray官方网站:https://www.v2ray.com/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray:https://github.com/Qv2ray/Qv2ray/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParametersXray(sw);
- }
- }
-
-
- //生成VLESS over TCP with XTLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessTcpXtlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_xtls_client_config";
-
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLDefault = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLDefault;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLDefault);
-
- //}
-
- // ImageShareQRcodeDefault = CreateQRCode(TextBoxURLDefault, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeDefault;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VLESS over TCP with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessTcp;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessTcp);
-
- //}
-
- // ImageShareQRcodeVlessTcp = CreateQRCode(TextBoxURLVlessTcp, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- // ImageShareQRcode.Source = ImageShareQRcodeVlessTcp;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取v2ray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VLESS over WS with TLS的配置保存(暂未有分享链接与二维码)
- private void GenerateXrayVlessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- // //生成v2rayN的json文件
- // string v2rayNjsonFile = @"
- //{
- // ""v"": """",
- // ""ps"": """",
- // ""add"": """",
- // ""port"": """",
- // ""id"": """",
- // ""aid"": """",
- // ""net"": """",
- // ""type"": """",
- // ""host"": """",
- // ""path"": """",
- // ""tls"": """"
- //}";
- // //MessageBox.Show(v2rayNjsonFile);
- // JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- // v2rayNjsonObject["v"] = "2";
- // v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
- // v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
- // v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
- // v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
- // v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
- // v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
-
- // if (TextBoxTransmission.Text.Contains("kcp") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed
- // }
- // else if (TextBoxTransmission.Text.Contains("quic") == true)
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置quic密钥
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//Quic加密方式
- // }
- // else
- // {
- // v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text; //设置路径
- // v2rayNjsonObject["host"] = TextBoxHostQuicEncryption.Text;//设置TLS的Host
- // }
-
- // v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
- // v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
- // //MessageBox.Show(v2rayNjsonObject["v"].ToString());
-
- //string saveFileFolderFirst = TextBoxHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir(@"v2ray_config");
- //while (Directory.Exists(@"v2ray_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"v2ray_config\" + saveFileFolder);
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vless_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- //TextBoxURLVlessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVlessWs;
- //using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- //{
-
- // sw.WriteLine(TextBoxURLVlessWs);
-
- //}
-
- // ImageShareQRcodeVlessWs = CreateQRCode(TextBoxURLVlessWs, $"v2ray_config\\{saveFileFolder}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVlessWs;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取v2ray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- //sw.WriteLine("-----------------------------------------");
- //sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数--
- TxtWriteGeneralParametersXray(sw, false);
-
- }
- }
-
- //生成VMess over TCP with TLS的配置保存
- private void GenerateXrayVmessTcpTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- v2rayNjsonObject["host"] = "";//设置Host
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = TextBoxTLSXray.Text; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_tcp_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL,跳过VlessTcpTlsWeb暂时未有URL标准
- TextBoxURLVmessTcp = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessTcp);
- }
-
- ImageShareQRcodeVmessTcp = CreateQRCode(TextBoxURLVmessTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessTcp;
-
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- //生成VMess over WS with TLS的配置保存
- private void GenerateXrayVmessWsTlsShareQRcodeAndBase64Url()
- {
- #region 暂时不用内容
- //生成v2rayN的json文件
- string v2rayNjsonFile = @"
-{
- ""v"": """",
- ""ps"": """",
- ""add"": """",
- ""port"": """",
- ""id"": """",
- ""aid"": """",
- ""net"": """",
- ""type"": """",
- ""host"": """",
- ""path"": """",
- ""tls"": """"
-}";
- //MessageBox.Show(v2rayNjsonFile);
- JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
- v2rayNjsonObject["v"] = "2";
- v2rayNjsonObject["add"] = TextBoxHostAddressXray.Text; //设置域名
- v2rayNjsonObject["port"] = TextBoxPortXray.Text; //设置端口
- v2rayNjsonObject["id"] = TextBoxUUIDXray.Text; //设置uuid
- v2rayNjsonObject["aid"] = TextBoxUUIDextraXray.Text; //设置额外ID
- v2rayNjsonObject["net"] = TextBoxTransmissionXray.Text; //设置传输模式
- v2rayNjsonObject["type"] = TextBoxCamouflageTypeXray.Text; //设置伪装类型
-
- if (TextBoxTransmissionXray.Text.Contains("kcp") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置mKCP Seed
- }
- else if (TextBoxTransmissionXray.Text.Contains("quic") == true)
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text;//设置quic密钥
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//Quic加密方式
- }
- else
- {
- v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPathXray.Text; //设置路径
- v2rayNjsonObject["host"] = TextBoxHostQuicEncryptionXray.Text;//设置TLS的Host
- }
-
- v2rayNjsonObject["tls"] = "tls"; //设置是否启用TLS
- v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
-
- #endregion
-
- //创建保存目录
- string plainSavePath = @"vmess_ws_tls_client_config";
- //v2ray_config\${域名IP}
- //string configDomainSavePath = CreateConfigSaveDir(@"v2ray_config", TextBoxHostAddressSS.Text);
- //v2ray_config\${域名IP}\vless_tcp_xtls_client_config
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
-
- //生成二维码与URL
- TextBoxURLVmessWs = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
- //TextBoxURL.Text = TextBoxURLVmessWs;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLVmessWs);
- }
-
- ImageShareQRcodeVmessWs = CreateQRCode(TextBoxURLVmessWs, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeVmessWs;
-
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- ReadmeTxtWriteGenerateXray(sw);
-
- }
- }
-
- //生成Trojan over TCP with TLS的配置保存
- private void GenerateXrayTrojanShareQRcodeAndBase64Url()
- {
- //创建保存目录
- string plainSavePath = @"trojan_tcp_tls_client_config";
- string configSavePath = CheckDir($"{configDomainSavePath}\\{plainSavePath}");
-
- TextBoxURLTrojanTcp = $"trojan://{TextBoxUUIDXray.Text}@{TextBoxHostAddressXray.Text}:{TextBoxPortXray.Text}#{TextBoxHostAddressXray.Text}";
-
- //TextBoxURL.Text = TextBoxURLTrojanTcp;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(TextBoxURLTrojanTcp);
-
- }
- //ImageShareQRcode.Source = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- ImageShareQRcodeTrojanTcp = CreateQRCode(TextBoxURLTrojanTcp, $"{configSavePath}\\QR.bmp");
- //ImageShareQRcode.Source = ImageShareQRcodeTrojanTcp;
- //移动官方程序配置文件到相应目录
- if (File.Exists($"xray_config\\{plainSavePath}\\config.json"))
- {
- File.Move($"xray_config\\{plainSavePath}\\config.json", $"{configSavePath}\\config.json");
- Directory.Delete($"xray_config\\{plainSavePath}");
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //ReadmeTxtWriteGenerate(sw);
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择Xray-windows-64.zip或者Xray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUIDXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- //写入VMESS的readme.txt文件
- private void ReadmeTxtWriteGenerateXray(StreamWriter sw)
- {
- sw.WriteLine("config.json");
- //****** "此文件为Xray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine01").ToString());
-
- //****** "Xray官方网站:https://github.com/XTLS/Xray-core" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine02").ToString());
-
- //****** "Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine03").ToString());
-
- //****** "下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtXrayExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //****** "此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine05").ToString());
-
- //****** "v2rayN下载网址:https://github.com/2dust/v2rayN/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine06").ToString());
-
- //****** "Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine07").ToString());
-
- //****** "v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine08").ToString());
-
- //****** "v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine09").ToString());
-
- //****** "Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine10").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("url.txt");
-
- //****** "此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine11").ToString());
-
- //写入通用配置参数
- TxtWriteGeneralParametersXray(sw);
- }
- //TXT文件中写入通用配置参数---
- private void TxtWriteGeneralParametersXray(StreamWriter sw, bool alterId = true)
- {
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
- //****** "服务器通用连接配置参数:" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtV2RayExplainLine12").ToString());
- sw.WriteLine("");
-
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockUserUUID";
- strParam = TextBoxUUIDXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (alterId == true)
- {
- strApplicat = "TextBlockV2RayAlterId";
- strParam = TextBoxUUIDextraXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
- }
-
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxTransmissionXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxCamouflageTypeXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- strApplicat = "TextBlockIsOrNotTLS";
- strParam = TextBoxTLSXray.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- if (MainWindow.ReceiveConfigurationParameters[0].Contains("Quic") == true)
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicEncryptionXray.Text, strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockQuicKeyXray.Text, strLenth) + strParam);
-
- }
- else if (MainWindow.ReceiveConfigurationParameters[0].Contains("mKCP") == true)
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockMkcpSeedXray.Text, strLenth) + strParam);
-
- }
- else
- {
- strParam = TextBoxHostQuicEncryptionXray.Text;
- sw.WriteLine(AlignmentStrFunc("host:", strLenth) + strParam);
-
- strParam = TextBoxQuicKeyMkcpSeedPathXray.Text;
- sw.WriteLine(AlignmentStrFunc(TextBlockPathXray.Text, strLenth) + strParam);
- }
- }
- #endregion
-
- #endregion
-
- #endregion
-
- #region TrojanGo 相关
- //生成TrojanGo客户端资料
- private void GenerateTrojanGoShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("trojan-go_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxTrojanGoServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- string trojanGoUrl = GetTrojanGoUrl();
-
- TextBoxURL.Text = trojanGoUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(trojanGoUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(trojanGoUrl, $"{configSavePath}\\QR.bmp");
-
- //移动Trojan官方程序配置文件到相应目录
- if (File.Exists(@"trojan-go_config\config.json"))
- {
- File.Move(@"trojan-go_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为Trojan-go官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine01").ToString());
-
- //****** "Trojan-go官方网站:https://github.com/p4gefau1t/trojan-go" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine02").ToString());
-
- //sw.WriteLine("Trojan-go官方程序下载地址:https://github.com/p4gefau1t/trojan-go/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择Trojan-go-x.xx-win.zip,解压后提取trojan-go.exe。与config.json放在同一目录,运行trojan-go.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)扫码导入节点");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine05").ToString());
-
- //sw.WriteLine("Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine06").ToString());
-
- //sw.WriteLine("igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine07").ToString());
-
- //sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
- // sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojan-goExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxTrojanGoServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxTrojanGoServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxTrojanGoServerPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxTrojanGoServerPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanGoServerPassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** Type: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- //strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanGoType.Text;
- sw.WriteLine(AlignmentStrFunc("Type:", strLenth) + strParam);
- //sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** WebSocket路径: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "TextBlockTrojanGoWebSocketPath";
- strParam = TextBoxTrojanGoWSPath.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** Mux多路复用 ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "CheckBoxMuxSelect";
- strParam = ":";
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** concurrency: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "concurrency:";
- strParam = TextBoxConcurrency.Text;
- sw.WriteLine(AlignmentStrFunc(strApplicat, strLenth) + strParam);
-
- //****** idle_timeout: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "idle_timeout:";
- strParam = TextBoxIdle_timeout.Text;
- sw.WriteLine(AlignmentStrFunc(strApplicat, strLenth) + strParam);
-
- }
-
- }
-
- #region TrojanGo内容双击复制到剪贴板
- private void TextBoxTrojanGoServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerHost.Text);
- }
-
- private void TextBoxTrojanGoServerPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerPort.Text);
- }
-
- private void TextBoxTrojanGoServerPassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoServerPassword.Text);
- }
- private void TextBoxTrojanGoSNI_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoSNI.Text);
- }
- private void TextBoxTrojanGoType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoType.Text);
- }
- private void TextBoxTrojanGoHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoHost.Text);
- }
- private void TextBoxTrojanGoWSPath_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanGoWSPath.Text);
- }
- private void TextBoxConcurrency_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxConcurrency.Text);
- }
-
- private void TextBoxIdle_timeout_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxIdle_timeout.Text);
- }
- #endregion
-
- //生成TrojanGo的分享链接
- private string GetTrojanGoUrl()
- {
- string trojanGoPassword = EncodeURIComponent(TextBoxTrojanGoServerPassword.Text);
- string trojanGoHost = TextBoxTrojanGoServerHost.Text;
- string trojanGoPort = TextBoxTrojanGoServerPort.Text;
-
- string trojanGoSni = EncodeURIComponent(TextBoxTrojanGoSNI.Text);
- string trojanGoType= EncodeURIComponent(TextBoxTrojanGoType.Text);
- string trojanGohostName = EncodeURIComponent(TextBoxTrojanGoHost.Text);
-
- string trojanGoPath = EncodeURIComponent(TextBoxTrojanGoWSPath.Text);
- string trojanGoEncryption = EncodeURIComponent("");
- string trojanGoPlugin = EncodeURIComponent("");
-
- string trojanGoRemarks = EncodeURIComponent(trojanGoHost);
-
- //分享链接规范:https://github.com/p4gefau1t/trojan-go/issues/132
- //trojan-go://$(trojan-password)@trojan-host:port/?sni=$(update.microsoft.com)&type=$(original|ws|h2|h2+ws)&host=$(update-01.microsoft.com)&path=$(/update/whatever)&encryption=$(ss;aes-256-gcm:ss-password)&plugin=$(...)#$(descriptive-text)
- //string trojanGoUrl = $"trojan-go://{trojanGoPassword}@{trojanGoHost}:{trojanGoPort}/?sni={trojanGoSni}&type={trojanGoType}&host={trojanGohostName}&path={trojanGoPath}&encryption={trojanGoEncryption}&plugin={trojanGoPlugin}#{trojanGoRemarks}";
-
- //&path={trojanGoPath}
- //&encryption={trojanGoEncryption}
- //&plugin={trojanGoPlugin}
- //#{trojanGoRemarks}
- string trojanGoUrl = $"trojan-go://{trojanGoPassword}@{trojanGoHost}:{trojanGoPort}/?sni={trojanGoSni}&type={trojanGoType}";
-
- if (String.IsNullOrEmpty(trojanGohostName) == false)
- {
- trojanGoUrl += $"&host={trojanGohostName}";
- }
- if (String.IsNullOrEmpty(trojanGoPath) == false)
- {
- trojanGoUrl += $"&path={trojanGoPath}";
- }
- if (String.IsNullOrEmpty(trojanGoEncryption) == false)
- {
- trojanGoUrl += $"&encryption={trojanGoEncryption}";
- }
- if (String.IsNullOrEmpty(trojanGoPlugin) == false)
- {
- trojanGoUrl += $"&plugin={trojanGoPlugin}";
- }
-
- trojanGoUrl += $"#{trojanGoRemarks}";
- return trojanGoUrl;
- }
- private string EncodeURIComponent(string initialUri)
- {
- return Uri.EscapeDataString(initialUri);
- }
-
- //生成Trojan客户端资料
- private void GenerateTrojanShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("trojan_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxTrojanServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- //string saveFileFolderFirst = TextBoxTrojanServerHost.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir("trojan_config");
- //while (Directory.Exists(@"trojan_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"trojan_config\" + saveFileFolder);
- string trojanUrl = $"trojan://{TextBoxTrojanServerPassword.Text}@{TextBoxTrojanServerHost.Text}:{TextBoxTrojanServerPort.Text}#{TextBoxTrojanServerHost.Text}";
- //MessageBox.Show(v2rayNjsonObject.ToString());
- //string trojanUrl = "trojan://" + ToBase64Encode(v2rayNjsonObject.ToString());
- TextBoxURL.Text = trojanUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(trojanUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(trojanUrl, $"{configSavePath}\\QR.bmp");
-
- //移动Trojan官方程序配置文件到相应目录
- if (File.Exists(@"trojan_config\config.json"))
- {
- File.Move(@"trojan_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为Trojan官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine01").ToString());
-
- //****** "Trojan官方网站:https://trojan-gfw.github.io/trojan/" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine02").ToString());
-
- //sw.WriteLine("Trojan官方程序下载地址:https://github.com/trojan-gfw/trojan/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录,运行trojan.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)扫码导入节点");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine05").ToString());
-
- //sw.WriteLine("Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine06").ToString());
-
- //sw.WriteLine("igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine07").ToString());
-
- //sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxTrojanGoServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxTrojanServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxTrojanGoServerPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxTrojanServerPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxTrojanGoServerPassword.Text}");
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoWebSocketPath").ToString() + $"{TextBoxTrojanGoWSPath.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxTrojanServerPassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
-
- }
-
- }
-
- #region Trojan内容双击复制到剪贴板
-
- private void TextBoxTrojanServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerHost.Text);
- }
-
- private void TextBoxTrojanServerPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerPort.Text);
- }
-
- private void TextBoxTrojanServerPassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxTrojanServerPassword.Text);
- }
-
- #endregion
-
- #endregion
-
- #region NaiveProxy 相关
- //生成NaiveProxy客户端资料
- private void GenerateNaivePrxoyShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("naive_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxNaiveServerHost.Text);
- string configSavePath = configDomainSavePath;
-
- string naiveUrl = $"naive+https://{TextBoxNaiveUser.Text}:{TextBoxNaivePassword.Text}@{TextBoxNaiveServerHost.Text}:443?padding=true#{TextBoxNaiveServerHost.Text}";
-
- TextBoxURL.Text = naiveUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(naiveUrl);
-
- }
- ImageShareQRcode.Source = CreateQRCode(naiveUrl, $"{configSavePath}\\QR.bmp");
-
- //移动NaiveProxy官方程序配置文件到相应目录
- if (File.Exists(@"naive_config\config.json"))
- {
- File.Move(@"naive_config\config.json", $"{configSavePath}\\config.json");
- //File.Delete(@"config\config.json");//删除该文件
- }
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- sw.WriteLine("config.json");
-
- //****** "此文件为NaiveProxy官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine01").ToString());
-
- //****** "NaiveProxy官方网站:https://github.com/klzgrad/naiveproxy" ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine02").ToString());
-
- //sw.WriteLine("NaiveProxy官方程序下载地址:https://github.com/klzgrad/naiveproxy/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine03").ToString());
-
- //sw.WriteLine("下载相应版本,Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录,运行naive.exe即可。");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine04").ToString());
-
- sw.WriteLine("-----------------------------------------");
- sw.WriteLine("QR.bmp");
-
- //sw.WriteLine("此文件为NaiveSharp(windows)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine05").ToString());
-
- //sw.WriteLine("NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine06").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- sw.WriteLine("url.txt");
-
- //sw.WriteLine("此文件为NaiveSharp(windows)复制粘贴导入节点的网址");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine05").ToString());
-
- //sw.WriteLine("NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine06").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //sw.WriteLine("服务器通用连接配置参数");
- sw.WriteLine(Application.Current.FindResource("readmeTxtNaiveProxyExplainLine07").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxNaiveServerHost.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxNaiveServerHost.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 用户名:******
- //sw.WriteLine(Application.Current.FindResource("TextBlockHostUser").ToString() + $"{TextBoxNaiveUser.Text}");
- strApplicat = "TextBlockHostUser";
- strParam = TextBoxNaiveUser.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxNaivePassword.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxNaivePassword.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
-
- }
-
- #region NaiveProxy内容双击复制到剪贴板
- private void TextBoxNaiveServerHost_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaiveServerHost.Text);
- }
-
- private void TextBoxNaivePort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaivePort.Text);
- }
-
- private void TextBoxNaiveUser_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaiveUser.Text);
- }
-
- private void TextBoxNaivePassword_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxNaivePassword.Text);
- }
-
-
-
- #endregion
-
- #endregion
-
- #region SSR 相关
- //生成SSR客户端资料
- private void GenerateSSRShareQRcodeAndBase64Url()
- {
- string proxyfolder = CheckDir("ssr_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxSSRHostAddress.Text);
- string configSavePath = configDomainSavePath;
- //string saveFileFolderFirst = TextBoxSSRHostAddress.Text;
- //int num = 1;
- //saveFileFolder = saveFileFolderFirst;
- //CheckDir("ssr_config");
- //while (Directory.Exists(@"ssr_config\" + saveFileFolder))
- //{
- // saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
- // num++;
- //}
- //CheckDir(@"ssr_config\" + saveFileFolder);
-
- string ssrUrl = GetSSRLinkForServer();
- TextBoxURL.Text = ssrUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(ssrUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(ssrUrl, $"{configSavePath}\\QR.bmp");
-
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- //sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
-
- //***"此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine05").ToString());
-
- //***"ShadowsocksR (windows)下载网址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine06").ToString());
-
- //***"SSRR(Android)下载网址:https://github.com/shadowsocksrr/shadowsocksr-android/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine07").ToString());
-
- //***"Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine08").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
-
- //***"此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtSSRExplainLine09").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //***"服务器通用连接配置参数"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{ TextBoxSSRHostAddress.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxSSRHostAddress.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxSSRPort.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxSSRPort.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxSSRUUID.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxSSRUUID.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 加密方式: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockEncryption").ToString() + $"{TextBoxSSREncryption.Text}");
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxSSREncryption.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 传输协议: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTransferProtocol").ToString() + $"{TextBoxSSRTransmission.Text}");
- strApplicat = "TextBlockTransferProtocol";
- strParam = TextBoxSSRTransmission.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 混淆: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockCamouflageType").ToString() + $"{TextBoxSSRCamouflageType.Text}");
- strApplicat = "TextBlockCamouflageType";
- strParam = TextBoxSSRCamouflageType.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- }
- }
-
- #region SSR内容双击复制到剪贴板
-
- private void TextBoxSSRHostAddress_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRHostAddress.Text);
- }
-
- private void TextBoxSSRPort_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRPort.Text);
- }
-
- private void TextBoxSSRUUID_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRUUID.Text);
- }
-
- private void TextBoxSSREncryption_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSREncryption.Text);
- }
-
- private void TextBoxSSRTransmission_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRTransmission.Text);
- }
-
- private void TextBoxSSRCamouflageType_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxSSRCamouflageType.Text);
- }
- #endregion
-
- //生成SS客户端资料
- private void GenerateShareQRcodeAndBase64UrlSS()
- {
- //创建保存目录
- string proxyfolder = CheckDir("ss_config");
- configDomainSavePath = CreateConfigSaveDir(proxyfolder, TextBoxHostAddressSS.Text);
- string configSavePath = configDomainSavePath;
- //string configSavePath = CreateConfigSaveDir(@"ss_config", TextBoxHostAddressSS.Text);
- string ssUrl;
-
- //生成手机端的URL(无插件时,为电脑手机通用)
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet")==false && String.Equals(TextBoxPluginNameExplainSS.Text, "cloak") == false)
- {
- ssUrl = GetSStoURL(TextBoxPluginNameExplainSS.Text);
- TextBoxURL.Text = ssUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url.txt"))
- {
- sw.WriteLine(ssUrl);
- }
- ImageShareQRcode.Source = CreateQRCode(ssUrl, $"{configSavePath}\\QR.bmp");
- }
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- //生成电脑端
- ssUrl = GetSStoURL(TextBoxPluginNameExplainSSpc.Text);
- TextBoxURLpcSS.Text = ssUrl;
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\url_pc.txt"))
- {
- sw.WriteLine(ssUrl);
- }
- ImageShareQRcodeSSpc.Source = CreateQRCode(ssUrl, $"{configSavePath}\\QR_pc.bmp");
- }
- using (StreamWriter sw = new StreamWriter($"{configSavePath}\\readme.txt"))
- {
- if (String.Equals(TextBoxPluginNameExplainSS.Text, "goquiet") == false && String.Equals(TextBoxPluginNameExplainSS.Text, "cloak") == false)
- {
- //sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR.bmp");
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- //***"此文件为Shadowsocks (windows)、shadowsocks(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS05").ToString());
-
- }
- else
- {
- //***"此文件为shadowsocks(Android)、Shadowrocket(ios)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS05").ToString());
- }
-
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url.txt");
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == true)
- {
- //***"此文件为Shadowsocks (windows)、shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS09").ToString());
- }
- else
- {
- //***"此文件为shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS09").ToString());
- }
- sw.WriteLine("");
- //***"shadowsocks(Android)下载网址:https://github.com/shadowsocks/shadowsocks-android/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS07").ToString());
-
- //***"Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS08").ToString());
- }
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- sw.WriteLine("");
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("QR_pc.bmp");
-
- //***"此文件为Shadowsocks (windows)扫码导入节点"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS01").ToString());
- sw.WriteLine("-----------------------------------------\n");
- sw.WriteLine("url_pc.txt");
-
- //***"此文件为Shadowsocks (windows)复制粘贴导入节点的网址"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS02").ToString());
- sw.WriteLine("");
-
- }
- //***"Shadowsocks(windows)下载网址:https://github.com/shadowsocks/shadowsocks-windows/releases"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtExplainLineSS06").ToString());
- sw.WriteLine("-----------------------------------------\n");
-
- string strApplicat = "";
- string strParam = "";
- int strLenth = 20;
-
- //***"服务器通用连接配置参数"***
- sw.WriteLine(Application.Current.FindResource("readmeTxtTrojanExplainLine10").ToString());
- sw.WriteLine("");
-
- //****** 服务器地址(address): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerAddress").ToString() + $"{TextBoxHostAddressSS.Text}");
- strApplicat = "TextBlockServerAddress";
- strParam = TextBoxHostAddressSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 端口(port): ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockServerPort").ToString() + $"{TextBoxPortSS.Text}");
- strApplicat = "TextBlockServerPort";
- strParam = TextBoxPortSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 密码: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockTrojanGoPassword").ToString() + $"{TextBoxPasswordSS.Text}");
- strApplicat = "TextBlockTrojanGoPassword";
- strParam = TextBoxPasswordSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 加密方式: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockEncryption").ToString() + $"{TextBoxEncryptionSS.Text}");
- strApplicat = "TextBlockEncryption";
- strParam = TextBoxEncryptionSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
-
- if (String.IsNullOrEmpty(TextBoxPluginNameExplainSS.Text) == false)
- {
- //****** 插件程序:: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockPluginNameExplainSS").ToString() + $"{TextBoxPluginNameExplainSS.Text}");
- strApplicat = "TextBlockPluginNameExplainSS";
- strParam = TextBoxPluginNameExplainSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- //****** 插件选项: ******
- //sw.WriteLine(Application.Current.FindResource("TextBlockPluginOptionExplainSS").ToString() + $"{TextBoxPluginOptionExplainSS.Text}");
- strApplicat = "TextBlockPluginOptionExplainSS";
- strParam = TextBoxPluginOptionExplainSS.Text;
- sw.WriteLine(AlignmentStrFunc(Application.Current.FindResource($"{strApplicat}").ToString(), strLenth) + strParam);
-
- sw.WriteLine("-----------------------------------------\n");
- //****** 插件使用说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS").ToString());
-
- //****** ProxySU默认所有插件,在Shadowsocks (windows)运行文件所在文件夹的子文件夹plugins下。 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS01").ToString());
-
- //****** 电脑端手动安装插件说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS02").ToString());
-
- //****** 先下载插件,各个插件Windows客户端下载地址为: ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS03").ToString());
-
- //****** Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下载 obfs-local.zip ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS04").ToString());
-
- //****** V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系统选择:v2ray-plugin-windows-amd64-vx.x.x.tar.gz,32位系统选择:v2ray-plugin-windows-386-vx.x.x.tar.gz (x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS05").ToString());
-
- //****** Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系统选择:kcptun-windows-amd64-xxxxxx.tar.gz,32位系统选择:kcptun-plugin-windows-386-xxxxxx.tar.gz (x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS06").ToString());
-
- ////****** GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系统选择:gq-client-windows-amd64-x.x.x.exe,32位系统选择:gq-client-windows-386-x.x.x.exe(x为数字,是版本号)******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS07").ToString());
-
- ////****** Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系统选择:ck-client-windows-amd64-x.x.x.exe,32位系统选择:ck-client-windows-386-x.x.x.exe(x为数字,是版本号) ******
- //sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS08").ToString());
-
- //****** 在Shadowsocks (windows)运行文件所在文件夹中,新建文件夹plugins,将obfs-local.zip解压出的文件(两个)全部复到plugins中,
- //v2ray -plugin下载得到的文件,解压出的文件,复制到plugins中,并重命名为:v2ray-plugin.exe。
- //Kcptun -plugin下载得到的文件,解压出两个文件,将其中的client_windows开头的文件,复制到plugins中,并重命名为:kcptun-client.exe。
- //GoQuiet-plugin下载得到的文件,直接复制到plugin中,并重命名为:goquiet-client.exe。
- //Cloak-plugin下载得到的文件,直接复制到plugin中,并重命名为:cloak-client.exe
- //******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS09").ToString());
- //******安装完毕 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSS10").ToString());
-
- sw.WriteLine("-----------------------------------------\n");
-
- //******手机安卓客户端插件安装说明 ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid02").ToString());
-
- //****** 先下载插件,各个插件安卓客户端下载地址为: ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid03").ToString());
-
- //****** Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下载 obfs-local-nightly-x.x.x.apk(x为数字,是版本号) ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid04").ToString());
-
- //****** V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般选择v2ray--universal-x.x.x.apk(x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid05").ToString());
-
- //****** Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般选择kcptun--universal-x.x.x.apk(x为数字,是版本号)******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid06").ToString());
- //******将上述apk文件传到手机,安装即可! ******
- sw.WriteLine(Application.Current.FindResource("readmeTxtPluginExplainSSandroid07").ToString());
-
- }
-
- }
-
- }
-
- #region SS内容双击复制到剪贴板
- private void TextBoxHostAddressSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxHostAddressSS.Text);
- }
-
- private void TextBoxPortSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPortSS.Text);
- }
-
- private void TextBoxPasswordSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPasswordSS.Text);
- }
-
- private void TextBoxEncryptionSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxEncryptionSS.Text);
- }
-
- private void TextBoxPluginNameExplainSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginNameExplainSS.Text);
- }
- private void TextBoxPluginNameExplainSSpc_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginNameExplainSSpc.Text);
- }
-
- private void TextBoxPluginOptionExplainSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxPluginOptionExplainSS.Text);
- }
-
- private void TextBoxURLpcSS_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLpcSS.Text);
- }
-
- #endregion
-
- #endregion
-
- #region MTProto 界面控制
- private void RadioButtonMtgIpv4_Checked(object sender, RoutedEventArgs e)
- {
- GridMtgIpv4.Visibility = Visibility.Visible;
- GridMtgIpv6.Visibility = Visibility.Collapsed;
- }
-
- private void RadioButtonMtgIpv6_Checked(object sender, RoutedEventArgs e)
- {
- GridMtgIpv4.Visibility = Visibility.Collapsed;
- GridMtgIpv6.Visibility = Visibility.Visible;
- }
- private void TextBoxURLMtgTgIpv4_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTgIpv4.Text);
- }
-
- private void TextBoxURLMtgTmeIpv4_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTmeIpv4.Text);
- }
-
- private void TextBoxURLMtgTgIpv6_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTgIpv6.Text);
- }
-
- private void TextBoxURLMtgTmeIpv6_MouseDoubleClick(object sender, MouseButtonEventArgs e)
- {
- CopyToClipboard(TextBoxURLMtgTmeIpv6.Text);
- }
-
- #endregion
-
- //生成base64
- private string ToBase64Encode(string text)
- {
- if (String.IsNullOrEmpty(text))
- {
- return text;
- }
-
- byte[] textBytes = Encoding.UTF8.GetBytes(text);
- return Convert.ToBase64String(textBytes);
- }
-
- //生成QRcoder图片,并按给出的路径与名称保存,返回窗口显示的图片源
- private BitmapSource CreateQRCode(string varBase64,string configPath)
- {
- QRCodeGenerator qrGenerator = new QRCodeGenerator();
- QRCodeData qrCodeData = qrGenerator.CreateQrCode(varBase64, QRCodeGenerator.ECCLevel.Q);
- QRCode qrCode = new QRCode(qrCodeData);
- Bitmap qrCodeImage = qrCode.GetGraphic(20);
- IntPtr myImagePtr = qrCodeImage.GetHbitmap();
- BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
- //ImageShareQRcode.Source = imgsource;
- //DeleteObject(myImagePtr);
- qrCodeImage.Save(configPath);
- return imgsource;
-
- }
-
- //判断目录是否存在,不存在则创建
- private string CheckDir(string folder)
- {
- try
- {
- if (!Directory.Exists(folder))//如果不存在就创建file文件夹
- Directory.CreateDirectory(folder);//创建该文件夹
- return folder;
- }
- catch (Exception)
- {
- return "";
- }
- }
-
- //目录已存在则生成序号递增,并返回所创建的目录路径。
- private string CreateConfigSaveDir(string upperDir,string configDir)
- {
- try
- {
- //string saveFileFolderFirst = configDir;
- int num = 1;
- //saveFileFolder = EncodeURIComponent(configDir);
- saveFileFolder = configDir.Replace(":","_");
- CheckDir(upperDir);
- while (Directory.Exists(upperDir + @"\" + saveFileFolder) == true)
- {
- saveFileFolder = configDir + "_copy_" + num.ToString();
- num++;
- }
- CheckDir(upperDir + @"\" + saveFileFolder);
- return upperDir + @"\" + saveFileFolder;
- }
- catch (Exception)
- {
- saveFileFolder = "";
- return upperDir + @"\" + saveFileFolder;
- }
-
- }
-
- //打开文件夹
- private void ButtonOpenSaveDir_Click(object sender, RoutedEventArgs e)
- {
- string openFolderPath = configDomainSavePath;
- System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
- this.Close();
-
- }
-
- //SSR生成URL链接
- private string GetSSRLinkForServer()
- {
- string server = TextBoxSSRHostAddress.Text;
- string server_port = TextBoxSSRPort.Text;
- string password = TextBoxSSRUUID.Text;
- string protocol = TextBoxSSRTransmission.Text;
- string method = TextBoxSSREncryption.Text;
- string obfs = TextBoxSSRCamouflageType.Text;
-
- string obfsparam="";
- string protocolparam = "";
- string remarks = TextBoxSSRHostAddress.Text;
- string group = TextBoxSSRHostAddress.Text;
- bool udp_over_tcp = true;
- int server_udp_port = 0;
-
- string main_part = server + ":" + server_port + ":" + protocol + ":" + method + ":" + obfs + ":" + EncodeUrlSafeBase64(password);
- string param_str = "obfsparam=" + EncodeUrlSafeBase64(obfsparam ?? "");
- if (!string.IsNullOrEmpty(protocolparam))
- {
- param_str += "&protoparam=" + EncodeUrlSafeBase64(protocolparam);
- }
- if (!string.IsNullOrEmpty(remarks))
- {
- param_str += "&remarks=" + EncodeUrlSafeBase64(remarks);
- }
- if (!string.IsNullOrEmpty(group))
- {
- param_str += "&group=" + EncodeUrlSafeBase64(group);
- }
- if (udp_over_tcp)
- {
- param_str += "&uot=" + "1";
- }
- if (server_udp_port > 0)
- {
- param_str += "&udpport=" + server_udp_port.ToString();
- }
- string base64 = EncodeUrlSafeBase64(main_part + "/?" + param_str);
- return "ssr://" + base64;
- }
-
- //SS生成URL链接,需要给出plugin的内容,用于生成手机端或电脑端的URL
- public string GetSStoURL(string plugin,bool legacyUrl = true)
- {
- string tag = string.Empty;
- string url = string.Empty;
-
- server = TextBoxHostAddressSS.Text;
- string server_port = TextBoxPortSS.Text;
-
- string password = TextBoxPasswordSS.Text;
- string method = TextBoxEncryptionSS.Text;
-
- // plugin = TextBoxPluginNameExplainSS.Text;
- string plugin_opts = TextBoxPluginOptionExplainSS.Text;
-
- string remarks = server;
-
- if (legacyUrl && string.IsNullOrWhiteSpace(plugin))
- {
- // For backwards compatiblity, if no plugin, use old url format
- string parts = $"{method}:{password}@{server}:{server_port}";
- string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
- url = base64;
- }
- else
- {
- // SIP002
- string parts = $"{method}:{password}";
- string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
- string websafeBase64 = base64.Replace('+', '-').Replace('/', '_').TrimEnd('=');
-
- url = string.Format(
- "{0}@{1}:{2}/",
- websafeBase64,
- FormalHostName,
- server_port
- );
-
- if (!String.IsNullOrWhiteSpace(plugin))
- {
-
- string pluginPart = plugin;
- if (!String.IsNullOrWhiteSpace(plugin_opts))
- {
- pluginPart += ";" + plugin_opts;
- }
- string pluginQuery = "?plugin=" + HttpUtility.UrlEncode(pluginPart, Encoding.UTF8);
- url += pluginQuery;
- }
- }
-
- if (!String.IsNullOrEmpty(remarks))
- {
- tag = $"#{HttpUtility.UrlEncode(remarks, Encoding.UTF8)}";
- }
- return $"ss://{url}{tag}";
- }
-
- //格式化主机名称
- private string FormalHostName
- {
- get
- {
- // CheckHostName() won't do a real DNS lookup
- switch (Uri.CheckHostName(server))
- {
- case UriHostNameType.IPv6: // Add square bracket when IPv6 (RFC3986)
- return $"[{server}]";
- default: // IPv4 or domain name
- return server;
- }
- }
- }
- //编码安全Base64
- private string EncodeUrlSafeBase64(byte[] val, bool trim)
- {
- if (trim)
- return Convert.ToBase64String(val).Replace('+', '-').Replace('/', '_').TrimEnd('=');
- else
- return Convert.ToBase64String(val).Replace('+', '-').Replace('/', '_');
- }
- //编码安全Base64重载
- private string EncodeUrlSafeBase64(string val, bool trim = true)
- {
- return EncodeUrlSafeBase64(Encoding.UTF8.GetBytes(val), trim);
- }
-
- private void RadioButtonMobile_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxPluginNameExplainSS.Visibility = Visibility.Visible;
- GroupBoxClientQRandURL.Visibility = Visibility.Visible;
-
- TextBoxPluginNameExplainSSpc.Visibility = Visibility.Collapsed;
- GroupBoxClientSSpc.Visibility = Visibility.Collapsed;
-
- }
-
- private void RadioButtonPC_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxPluginNameExplainSS.Visibility = Visibility.Collapsed;
- GroupBoxClientQRandURL.Visibility = Visibility.Collapsed;
-
- TextBoxPluginNameExplainSSpc.Visibility = Visibility.Visible;
- GroupBoxClientSSpc.Visibility = Visibility.Visible;
- }
-
- ///
- ///生成固定长度的空格字符串
- ///
- ///
- ///
-
- private string SpaceStrFunc(int length)
- {
- string strReturn = string.Empty;
- if (length > 0)
- {
- for (int i = 0; i < length; i++)
- {
- strReturn += " ";
- }
- }
- return strReturn;
- }
-
- ///
- ///将字符串生转化为固定长度左对齐,右补空格
- ///
- ///需要补齐的字符串
- ///补齐后的长度
- ///
-
- private string AlignmentStrFunc(string strTemp, int length)
- {
- byte[] byteStr = System.Text.Encoding.Default.GetBytes(strTemp.Trim());
- int iLength = byteStr.Length;
- int iNeed = length - iLength;
-
- byte[] spaceLen = Encoding.Default.GetBytes(" "); //一个空格的长度
- iNeed = iNeed / spaceLen.Length;
-
- string spaceString = SpaceStrFunc(iNeed);
- //return strTemp + spaceString;
- return spaceString + strTemp;
- }
-
-
- }
-
-
-}
diff --git a/ProxySU/SSpluginWindow.xaml b/ProxySU/SSpluginWindow.xaml
deleted file mode 100644
index a3af977..0000000
--- a/ProxySU/SSpluginWindow.xaml
+++ /dev/null
@@ -1,279 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/SSpluginWindow.xaml.cs b/ProxySU/SSpluginWindow.xaml.cs
deleted file mode 100644
index f1f508b..0000000
--- a/ProxySU/SSpluginWindow.xaml.cs
+++ /dev/null
@@ -1,394 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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 ProxySU
-{
- ///
- /// SSpluginWindow.xaml 的交互逻辑
- ///
- public partial class SSpluginWindow : Window
- {
- //SS加密方法设定
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
- public SSpluginWindow()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-ietf-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-ietf-poly1305", Value = "chacha20-ietf-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "xchacha20-ietf-poly1305", Value = "xchacha20-ietf-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-256-gcm", Value = "aes-256-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-192-gcm", Value = "aes-192-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
- }
-
-
-
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
-
- //伪装网站处理
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
-
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
- //UncheckLayouts(TabControlTemplate);
- //SS 经典模式被选中
- if (RadioButtonNonePluginSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "NonePluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonNonePluginSS.Content.ToString();
-
- }
- //SS+obfs+http+web伪装模式被选中
- else if (RadioButtonObfsPluginHttpWebSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "ObfsPluginHttpWebSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonObfsPluginHttpWebSS.Content.ToString();
-
- }
- //SS+obfs+TLS+web模式被选中
- else if (RadioButtonObfsPluginHttpsWebSS.IsChecked == true)
- {
-
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "ObfsPluginHttpsWebSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonObfsPluginHttpsWebSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //V2Ray-Plugin SS+WebSocket 无TLS模式被选中
- else if (RadioButtonWebSocketSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketSS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxWebSocketPathSS.Text);
- }
-
- //V2Ray-Plugin SS+WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLSWebFrontSS.IsChecked == true || RadioButtonWebSocketTLSWebFrontSSHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSWebFrontSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSWebFrontSS.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxWebSocketPathSS.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
- //V2Ray-Plugin SS+QUIC模式被选中
- else if (RadioButtonQuicSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
- //SS+kcptun-plugin模式被选中
- else if (RadioButtonKcptunPluginSS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "KcptunPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonKcptunPluginSS.Content.ToString();
-
- }
- //SS+GoQuiet-Plugin模式被选中
- else if (RadioButtonGoQuietPluginSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "GoQuietPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonGoQuietPluginSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
- //SS+Cloak-Plugin模式被选中
- else if (RadioButtonCloakPluginSS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomainSS.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "CloakPluginSS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonCloakPluginSS.Content.ToString();
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomainSS.Text);
-
- }
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPortSS.Text);
- //传递uuid密码
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUIDSS.Text);
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- #region 其他设置中的界面控制
-
- //无插件的界面
- private void RadioButtonNonePluginSS_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Collapsed;
- TextBoxWebSocketPathSS.Visibility = Visibility.Collapsed;
- ButtonWebSocketPathSS.Visibility = Visibility.Collapsed;
-
- //隐藏域名
- TextBlockDomainSS.Visibility = Visibility.Collapsed;
- TextBoxDomainSS.Visibility = Visibility.Collapsed;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //隐藏伪装网站
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- //初始化端口
-
- TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //使用域名,启用TLS 无Websocket的界面
- private void RadioButtonUseDomainTls_Checked(object sender, RoutedEventArgs e)
- {
-
- TextBoxServerListenPortSS.Text = "443";
- //隐藏Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Collapsed;
- TextBoxWebSocketPathSS.Visibility = Visibility.Collapsed;
- ButtonWebSocketPathSS.Visibility = Visibility.Collapsed;
-
- //显示域名
- TextBlockDomainSS.Visibility = Visibility.Visible;
- TextBoxDomainSS.Visibility = Visibility.Visible;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //显示伪装网站
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- //初始化端口
- //TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //使用V2ray-plugin 的Websocket over https (TLS)
- private void RadioButtonUseDomainWebsocketTls_Checked(object sender, RoutedEventArgs e)
- {
-
- TextBoxServerListenPortSS.Text = "443";
- //显示Websocket Path
- TextBlockWebSocketPathSS.Visibility = Visibility.Visible;
- TextBoxWebSocketPathSS.Visibility = Visibility.Visible;
- ButtonWebSocketPathSS.Visibility = Visibility.Visible;
-
- //显示域名
- TextBlockDomainSS.Visibility = Visibility.Visible;
- TextBoxDomainSS.Visibility = Visibility.Visible;
- //检测域名按钮
- ButtonDomain.Visibility = Visibility.Collapsed;
- //显示伪装网站
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
-
- //初始化密码
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
-
- //初始化端口
-
- //TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
-
- //初始化Websocket Path
- TextBoxWebSocketPathSS.Text = GenerateRandomPath();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- #endregion
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
-
- }
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUIDSS.Text = GenerateRandomUUID();
- }
-
- //产生随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPortSS.Text = GenerateRandomPort().ToString();
- }
- //产生随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- TextBoxWebSocketPathSS.Text = GenerateRandomPath();
- }
-
- #region 相关参数生成函数
- //产生随机的UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
- //产生随机端口
- private int GenerateRandomPort()
- {
- Random random = new Random();
- return random.Next(30001, 50000);
- }
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- //string methodName;
- //object methodSelected;
- //methodSelected = ComboBoxEncryptionMethodInfo.SelectedValue;
- //methodName = methodSelected.ToString();
- //return methodName;
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- //产生随机的Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- Guid uuid = Guid.NewGuid();
- string[] pathArray = uuid.ToString().Split('-');
- string path = pathArray[randomSerialNum];
- return $"/{path}";
- }
-
- #endregion
-
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
-
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomainSS.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
- }
-}
diff --git a/ProxySU/Translations/ProxySU.en-US.xaml b/ProxySU/Translations/ProxySU.en-US.xaml
deleted file mode 100644
index a7ff3f0..0000000
--- a/ProxySU/Translations/ProxySU.en-US.xaml
+++ /dev/null
@@ -1,619 +0,0 @@
-
-
- The new version has been released!
- Downloading...Wait Prompt...
- The download of the latest version failed, please try again later!
- Download the latest version successfully, the file has been saved in the same directory of the current ProxySU.exe
- Update
- 界面語言:
- Deployment
- Resources
- Free Wall URL
- Common Error
- Host:
- IP or Domain (Not empty)
- Port:
- User:
- Password:
- Key:
- Key file Path (Not Empty)
- Open...
- Password Login
- Key Login
- No Proxy
- Not Login
- Requires Login
- Proxy Addr:
- Email
- Acme.sh SSL must an available email address.
- Save Installation Log...
- Waiting for installation and deployment
- System Tools
-
- Xray template library
- Xray one-click installation
- Upgrade Xay
-
- V2Ray Templates
- V2ray install
- Upgrade V2Ray
- Cancel
- Trojan-Go Templates
- Trojan-Go install
- Upgrade Trojan-Go
- Cancel
- Currently selected plan:
- No plan selected
-
- Parameter settings
- Mode: Trojan+TLS+Caddy
- Domain:
- Port: 443
- Domain Not Empty
- Password:
- Change
- Trojan install
- Upgrade Trojan
- Cancel
-
- Mode: NaiveProxy+TLS+Caddy
- Random
- NaiveProxy install
- Cancel
-
- Mode: SSR+TLS+Caddy
- SSR install
-
-
- Mode: MTProto+TLS
- MTProto install
- Making domain name:
- Recommended https ports 443, 2053, 2083, 2087, 2096, 8443
- The secret key will be randomly generated by the server.
-
-
- SS install
- SS plug-in library
- Classic mode
- Tip: This mode, long time, large traffic use, easy to be blocked and interfered, is not recommended!
- SS Classic
- SS classic use mode, no domain name is required, data is encrypted with high strength, and the data is recognized as unknown data. At present, the traffic is easy to be identified, and it is easy to be interfered and blocked. Use it with caution! Putting here is just a feeling and tribute!
- Simple-obfs plug-in
- Tip: This is a traffic obfuscation scheme used in the early days of SS. The plug-in has not been updated for a long time and is not recommended!
- SS+obfs+http+Web
- Does not require a domain name, the data is highly encrypted, the traffic is confused as http (not the real http), and the use of Web site camouflage can enhance the anti-recognition to a certain extent! CDN is not supported.
- SS+obfs+TLS(https)+Web
- requires a domain name, the use of a domain name will greatly enhance the anti-identification, high-strength data encryption, traffic confusion as https (not real https), the use of Web site camouflage, further enhance the anti-identification! CDN is not supported.
- V2Ray plug-in
- Reminder: ShadowRocket(ios) does not support SS+Quic mode
- SS+WebSocket+TLS+Caddy (Web post)
- SS+WebSocket+TLS+Caddy (Web front)
- Tip: In the above scheme, there is no difference in the use effect between Web front and Web post. In the Web post scheme, the TLS certificate is applied for by acme.sh. After the certificate expires, acme.sh will automatically renew, but you need to manually restart SS to load the new certificate. The certificate in the web front-end solution is automatically applied for and loaded by Caddy without restarting SS.
- SS+QUIC
- V2Ray-Plugin uses QUIC protocol for transmission, and TLS encryption is mandatory. Encrypted data transmission, identified as udp traffic, was originally initiated by Google, advantages: reduced delay, multiplexing, connection migration, domain name is required,
-
- kcptun Plugin
- Reminder: Shadowrocket(ios) does not support GoQuiet-plugin. shadowsocks (Android) does not support GoQuiet-plugin and Cloak-plugin plug-ins
- KCP is a fast and reliable protocol. It can waste 10%-20% of bandwidth than TCP in exchange for a 30%-40% reduction in average latency and a three-fold reduction in maximum latency The transmission effect. Use UDP protocol for transmission, high-strength data encryption, transmission of the same content, kcp generally consumes more traffic than TCP, and will greatly increase the network speed under lines with high packet loss rates, and may be restricted by QOS at individual operators .
- The basic principle is to simulate TLS traffic while disguising the server as a normal web server. This confusion is not the first: simple-obfs and ShadowsocksR’s tls1.2_ticket_auth mode proves this. It works. This plug-in improves the existing methods, and its goal is to make large-scale blockade of HTTPS servers (even IP segments) the only effective way to block SS
- Use encryption to confuse proxy traffic into legitimate HTTPS traffic, and disguise the proxy server as a normal Web server to avoid Internet censorship. It can be seen as an upgraded version of GoQuiet above, optimizing the network connection speed, and not confusing https but real https traffic.
- Plugin program:
- Plugin options:
- Use the compilation method, it will take a little longer, please be patient...
-
-
- Proofreading Time
- Release 80/443
- Enable BBR
- Uninstall Proxy
- Enable root password login
- root prohibits password login
- Enable root certificate key login
- Only the proxy software installed by ProxySU and related configurations are supported. Please make sure that important configurations have been backed up. Uninstalling agents installed using other methods or scripts is not supported. Are you sure you want to uninstall the agent software on the remote host?
- This function requires that the currently logged-in account has sudo permissions. Is the root account enabled and password set for the remote host?
- This function requires that the currently logged-in account has root or sudo authority. Is root certificate key login enabled for the remote host?
- This function requires that the remote host has enabled other login methods, such as key mode, etc., otherwise the remote host may not be able to connect. Is the root account password login method of the remote host prohibited?
- is closing the root account password login method.....
- The remote host root account password login method is closed!
- The root account certificate key login of the remote host has been enabled, and the key file rootuser.key is saved in the subsequent opened folder!
- The current account already has root privileges, no need to set it up!
- The current account cannot obtain sudo permission, the setting failed!
- Generate a 20-digit random password!
- Save password information!
- Generating a key...
- The key is being downloaded...
- The remote host enables key login.......
- The remote host Root account password login is enabled, and the password is saved in the folder opened afterwards!
- Start uninstall......
- Detected installed
- Uninstallation failed! Please ask the developer!
- Uninstall successfully!
-
- Home
- Forward
- Back
- Due to well-known reasons, loading is slow at certain times, please be patient
-
- Trojan-go template library
- http/2 transmission, Caddy2 camouflage website, anti-recognition, CDN of CloudFlare is not currently supported
- Use WebSocket transmission, Caddy2 camouflage website, anti-identification, support CloudFlare CDN
- Parameter settings
- Domain name:
- Port: 443
- Password:
- Use the existing password and paste it directly into the box
- WebSocket Path:
- Mux multiplexing
- The settings here are only valid for the official client configuration file config.json, other clients need to be set manually, and the server automatically adapts.
- This field does not appear in the QR code and sharing URL. The client needs to set it by itself, and the server enables automatic adaptation by default.
- OK
- Cancel
-
- V2Ray Templates
- Recommend
- EarlyPlan
- VLESS
- VLESS is a lightweight transmission protocol. Unlike VMess, VLESS don't depend on the system time. The authentication method is also UUID, but alterId is not required. Currently VLESS does not have its own encryption, please use it for reliable channels, such as TLS. Advantages: It can effectively reduce host resource consumption. Currently VLESS does not support sharing. Please ensure that both the client and server v2ray-core are the latest version.
- XTLS works well on devices with low performance or without AES hard-decoding. For example, XTLS is used on hard routers, and the network speed can be doubled when the CPU is full, or the same The CPU occupancy rate is halved at Internet speed, and for mobile devices, the reduction in the amount of calculation means power saving.Version requires 4.29+ (Domain required) Not support CDN.
- Lightweight protocol VLESS, occupies less host resources, data TLS encrypted transmission, and Caddy2 is used as a disguised website on the node. Suitable for VPS with low configuration, or shared nodes by multiple people, the server client version requires 4.27+ (Domain required) Notsupport CDN.
- VLESS protocol, this type of solution with VMESS is more lightweight. Stability is strong, Caddy2 is front-facing, hidden proxy features, it is recognized as https traffic visiting the website, the strongest anti-blocking recognition, (Domain required) CDN is supported
- VLESS protocol, this type of solution with VMESS is more lightweight. Based on HTTP/2 transmission. Completely implemented in accordance with the HTTP/2 standard, with Caddy2 as the front, hidden proxy features, H2C protocol forwarding to V2Ray, (Domain required) CloudFlare CDN is not supported
- TCP
- WebSocket
- Http/2
- mKCP
- QUIC
- Parameter settings
- Server port:
- Random
- If TLS encryption is used, please keep the default port 443
- Use the existing UUID and paste it directly into the box
- QUIC Key:
- mKCP Seed:
- Enable the mKCP Seed key to enhance anti-recognition, leave it blank to disable it. Version 4.24.2+
- Path:
- VLESS ws path:
- VMESS tcp path:
- VMESS ws path:
- QUIC Encryption:
- Domain name:
- Trojan password is the same as V2ray UUID.
- Mask a website:
- Set this option to increase proxy concealment (can be empty)
- Enter only the domain name, excluding "http" and "/" etc.
- Only forbid root account to log in with password, please make sure that other login methods of root account have taken effect
- The root account will be enabled and set to password login
- will enable or set the root account as the key certificate login
- The input format of the fake URL is wrong! please enter again!
- Strong stability, Caddy2 as the front, hidden proxy feature, recognized as https traffic to the website, the strongest anti-blocking recognition, domain name is required, CDN support
- based on HTTP/2 transmission. Completely implemented in accordance with the HTTP/2 standard, with Caddy2 as the front, hidden proxy features, H2C protocol forwarding to V2Ray, domain name is required, and CloudFlare CDN is not currently supported
- Currently Xray is a superset of V2Ray, and it will have a different development direction from V2Ray in the future.
- VLESS over TCP with XTLS + fallback and shunt to WHATEVER (ultimate configuration), configured and recommended by rprx boss (author of xtls), configure the following six solutions at the same time on the server side, sharing the same domain name and port 443, WS can pass through CDN.
- VLESS over TCP with XTLS + fallback and shunt to WHATEVER (ultimate configuration), configured and recommended by rprx boss (author of xtls), configure the following five solutions at the same time on the server side, sharing the same domain name and port 443, WS can pass through CDN.(If you want to add XTLS scheme, please use Xray configuration)
- Encrypted data transmission will be recognized as unknown tcp traffic
- TCP+Http camouflage
- Encrypted data transmission and HTTP disguise will be recognized as http traffic, but not real http access
- Data encrypted transmission, the transmission protocol uses TLS, it will be recognized as TLS traffic, not equivalent to https traffic characteristics (domain name required)
- TCP+TLS (self-signed certificate)
- Data encrypted transmission, the transmission protocol uses TLS, it will be recognized as TLS traffic, not equivalent to https traffic characteristics (no domain name required)
- Shadowrocket (ios) needs to manually open the "Allow Unsafe" option
- Data encrypted transmission, the transmission protocol uses WebSocket, if TLS is not enabled, it will be recognized as WebSocket traffic.
- Data encrypted transmission, the transmission protocol uses WebSocket, and TLS is enabled, it will be recognized as TLS traffic. (Domain name required),Support CDN.
- WebSocket+TLS (self-signed certificate)
- Data encrypted transmission, the transmission protocol uses WebSocket, and TLS is enabled, and it will be recognized as TLS traffic. (No domain name required)
- The transmission method based on HTTP/2. It is fully implemented in accordance with the HTTP/2 standard and requires a domain name
- HTTP2 (self-signed certificate)
- The transmission method based on HTTP/2. It is fully implemented in accordance with the HTTP/2 standard, uses a self-signed certificate, and does not require a domain name
- mKCP (no camouflage)
- Encrypted data transmission to increase bandwidth usage and reduce delay, udp protocol, no camouflage, will be recognized as udp traffic
- Same as mKCP (without camouflage), add disguised as SRTP packet, it will be recognized as video call data (such as FaceTime)
- Same as mKCP (without camouflage), adding a uTP packet disguised as a uTP data packet will be recognized as BT download data
- Same as mKCP (no camouflage), adding data packets disguised as WeChat video calls
- Same as mKCP (without camouflage), add disguised as DTLS 1.2 data packet
- Same as mKCP (without camouflage), with the addition of disguised as WireGuard packets. (Not the real WireGuard protocol)
- Reminder: Shadowrocket currently does not support QUIC transmission mode.
- QUIC (no camouflage)
- Encrypted data transmission, no pretense will be recognized as udp traffic, originally created by Google, advantages: reduced delay, multiplexing, connection migration
- Same as QUIC (no camouflage), adding a packet disguised as SRTP, it will be recognized as video call data (such as FaceTime)
- Same as QUIC (without camouflage), add disguised as uTP data packet, it will be recognized as BT download data
- Same as QUIC (no camouflage), adding data packets disguised as WeChat video calls
- Same as QUIC (without camouflage), add disguised as DTLS 1.2 packet
- Same as QUIC (without camouflage), adding a pretend to be a WireGuard packet. (Not the real WireGuard protocol)
-
- Sync Network Time
- Correct the remote host time to the network time. Note: The time of the local computer must also be synchronized with the network time, otherwise the local computer V2ray may have a connection error
Recommendation: First use this method to proofread time
- Sync local time
- Synchronize the remote host’s time to the local time. Note: The local computer’s time must be accurate and synchronized with the network time, otherwise there may be connection errors in other clients
Use this method when you can’t check the time when using the network
- Update the local time
- Synchronize the local computer time with the network time.
Note: To use this function, you must run this program as an administrator
- Detection Time
- Proofread
-
- Client configuration parameters
- Server address:
- Port:
- User ID(uuid)/Password:
- Copy
- Copied to the clipboard!
- Empty content!
- alterId:
- The default is 16, and you can fill in a value not exceeding 64. If the client does not have this option, leave it blank
- Encryption method:
- Transfer Protocol:
- Camouflage type(Confuse):
- TLS Set:
- Tip: Double-click the above content window to copy it to the clipboard.
- Path:
- mKCP Seed/QUIC key:
- default auto
- QR/URL
- The above parameters can be entered into the client manually or by scanning. The configuration and related files used for the official client have been stored in the directory. Click the OK button to open
- QR code and URL link can be used
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
Import v2ray node
Note: The Vless protocol requires manual input of configuration parameters, and the QR code and URL are invalid
- " can be used for ShadowRocket (ios), ignore (Android), Qv2ray (windows) to scan codes and import URLs. Note: some clients may not support WebSocket mode ."
- "Can be used for ShadowRocket (ios), ignore (Android), Qv2ray (windows) to scan codes and import URLs. Note: Some clients may not support WebSocket mode."
- URL import link for NaiveSharp (windows)
- Used to scan codes and import URL import links for ShadowsocksR (windows), SSRR (android), Shadowrocket (ios)
- For mobile phone client shadowsocks(android), Shadowrocket(ios) scan code and URL import link
- For the computer client Shadowsocks (windows) scan code and URL import link
- Scan code and URL import link for Shadowsocks (windows), shadowsocks(android), Shadowrocket(ios)
- Reminder: The import format of the computer client Shadowsocks (windows) and the mobile client shadowsocks (android) and Shadowrocket (ios) are not compatible. Please select the corresponding format.
- Mobile phone
- Computer side
- TG format QR
- TG format URL (double-click to copy to the clipboard)
- T.ME format QR
- T.ME format URL (double-click to copy to the clipboard)
-
- Host address, host port, and user name are required and cannot be empty!!
- The connection port contains non-numeric characters!
- The login password is required and cannot be empty!!
- The key file is required and cannot be empty!!
- If a proxy is selected, the proxy address and port cannot be empty!
- If the proxy needs to log in, the user name and password for proxy login cannot be empty!
- The remote host connection information is wrong, please check!
- Please select a configuration template first!
- An error occurred, the installation was interrupted...
- Logging in to the remote host...
- The host login is successful!
- Detect whether it is running under root permissions...
- Please use an account with root permissions to log in to the host! !
- Detection result: OK!
- Check whether the system has been installed
- The remote host has been installed
- , it is recommended to uninstall first, or reinstall the system, if the forced installation may fail. Do you force a reinstallation?
- installation canceled, exit
- Selected mandatory installation
- Test result: not installed
- Check whether the system meets the installation requirements...
- The current system kernel version is
- , V2ray requires the kernel to be 2.6.23 and above. Please upgrade the kernel and install again!
- The system kernel version does not meet the requirements, and the installation failed! !
- The system lacks necessary installation components such as: apt||dnf||yum||zypper||Syetemd, the host system is recommended to use: CentOS 7/8, Debian 8/9/10 ,Ubuntu 16.04 and above
- The system environment does not meet the requirements, and the installation fails! !
- Test result: OK!
- It is detected that the system has SELinux enabled and it is working in strict mode. It needs to be changed to relaxed mode! Modifying...
- The modification is complete!
- Proofreading time...
- The difference between the local time and the remote host’s time exceeds the limit (90 seconds), please use'System Tools-->Time Correction' to verify the time before setting
- Time comparison failed...
- The time difference meets the requirements, OK!
- is checking whether the domain name is resolved to the IP of the current VPS...
- is detecting whether it is a pure ipv6 host...
- A valid IP address was not detected...
- Finding the fastest Nat64 gateway...
- Failed to find a valid Nat64 gateway...
- The fastest Nat64 gateway of the current host is:
- Nat64 gateway is being set up......
- Nat64 gateway is being deleted...
- The resolution is correct! OK!
- detects that the current host is a pure ipv6 host, it is not currently supported!
- The domain name could not be correctly resolved to the IP of the current VPS! Installation failed!
- The domain name cannot be correctly resolved to the IP of the current VPS, please check! If the resolution setting is correct, please wait for it to take effect before retrying the installation. If the domain name uses CDN, please close it first!
- Detect port occupancy...
- If one or all of the 80/443 ports are occupied, will the program occupying 80/443 ports be forcibly stopped?
- The port is occupied and the installation failed...
- is releasing port 80/443...
- The release of port 80/443 is complete!
- The port is occupied, will the program occupying this port be forcibly stopped?
- Release the port...
- The port is released!
- Test result: Not occupied!
- The system environment has been tested and the installation requirements are met, and the deployment begins...
- Open the corresponding port of the firewall...
- Installing
- File download failed!
- Compiling, please wait patiently.............
- The installation failed, the script runs incorrectly!
- The installation is successful!
- After installation, upload the configuration file......
- Installing acme.sh......
- acme.sh is installed successfully!
- acme.sh installation failed! The reason is unknown, please ask the developer!
- Apply for domain name certificate...
- The certificate application is successful!
- Certificate application failed! The reason is unknown, please ask the developer!
- Install the certificate to
- The certificate is successfully installed to
- The certificate is installed to
- failed, the reason is unknown, you can ask the developer!
- Install Caddy...
- Test result: Caddy is not installed!
- The installation of Caddy failed!
- Caddy installed successfully!
- is upgrading the Caddy v2.2.0 beta version for Http2Web mode!
- Upload Caddy configuration file...
- Caddy configuration file upload failed!
- The Caddy configuration file is uploaded successfully, OK!
- Starting Caddy...
- Caddy started successfully!
- Caddy failed to start!
- Starting Caddy (second attempt)!
- Caddy failed to start (second time)! Exit the installation!
- Caddy failed to start, the reason is unknown! Please ask the developer!
- Starting
- Startup is successful!
- Startup failed!
- is trying to start the second time
- failed to start (second time)! Exit the installation!
- Startup failed, the reason is as above! Please troubleshoot the reason!
- BBR test...
- Enable BBR...
- BBR has been enabled!
- The system does not meet the conditions for enabling BBR, and the enabling failed!
- BBR is successfully activated!
- Generate client configuration...
- Failed to obtain client configuration!
- The installation is successful, Enjoy it!!
- Installation Failed!
- An error occurred!
- Wrong password or wrong username!
- Please check whether the host address and port are correct, if it passes the proxy, please check whether the proxy is working properly
- The selected key file is wrong or the format is wrong!
- Login using the key, the key file is wrong or the user name is wrong!
- The host address is wrong. If a proxy is used, it may also be the wrong port to connect to the proxy!
- Exit! Reason: The remote host is not installed
- V2Ray using the old installation script is detected...
- The V2Ray using the old installation script is detected. Do you want to uninstall the old version and reinstall it with the new installation script?
- Uninstalling the old version...
- Uninstall the old version, OK!
- Install the new version...
- Migrate the original configuration file.
- has been updated to the latest version.
- The current version of the remote host is: v
- The latest version is:
- Is it upgraded to the latest version?
- Upgrading to the latest version
- The upgrade is successful! It is currently the latest version!
- The upgrade failed. The reason is unknown. Please ask the developer!
- Upgrade is cancelled, exit!
- The remote host is currently the latest version:
- No need to upgrade! drop out!
- The domain name cannot be empty, please check the relevant parameter settings!
- Please install in x86_64 system
- Back up the Trojan configuration file...
- Restore the Trojan configuration file...
- "Caddy has been installed on the remote host, but I’m not sure whether it supports forward proxy. Do I force a reinstallation?"
- Please uninstall Caddy or reinstall the VPS system first!
- Installing dependent software......
- The installation is complete! OK!
- Installing Caddy.....
- The server is being upgraded for NaiveProxy
- The upgrade is complete, OK!
- Optimizing network parameters...
- Optimize network parameters, OK!
-
- This file is the client configuration file used by the official Xay program. It is configured in global mode, socks5 address: 127.0.0.1:1080, http proxy address: 127.0.0.1:1081
- Xray official website: https://github.com/XTLS/Xray-core
- Xray official program download address: https://github.com/XTLS/Xray-core/releases
- Download the corresponding version, select xray-windows-64.zip or xray-windows-32.zip for Windows, extract xray.exe after decompression. Put it in the same directory as config.json, just run xray.exe.
-
- This file is the client configuration file used by the official V2Ray program. It is configured in global mode, socks5 address: 127.0.0.1:1080, http proxy address: 127.0.0.1:1081
- v2ray official website: https://www.v2ray.com/
- v2ray official program download address: https://github.com/v2ray/v2ray-core/releases
- download the corresponding version, Windows select v2ray-windows-64.zip or v2ray-windows-32.zip, extract v2ctl.exe and v2ray.exe after decompression. Put it in the same directory as config.json, just run v2ray.exe.
- This file is v2rayN, Qv2ray, v2rayNG(Android), Shadowrocket(ios) scan code import node
- v2rayN download URL: https://github.com/2dust/v2rayN/releases
- Qv2ray download URL: https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android) download URL: https://github.com/2dust/v2rayNG/releases
- v2rayNG (Android) download URL on Google Play: https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is v2rayN, Qv2ray, v2rayNG(Android), Shadowrocket(ios) copy and paste the vmess URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official Trojan-go program, configured in global mode, http and socks5 address: 127.0.0.1:1080
- Trojan-go official website: https://github.com/p4gefau1t/trojan-go
- Trojan-go official program download address: https://github.com/p4gefau1t/trojan-go/releases
- Download the corresponding version, select Trojan-go-x.xx-win.zip for Windows, extract trojan-go.exe after decompression. Put it in the same directory as config.json, just run trojan-go.exe.
- This file is for Qv2ray (windows), ignore (Android) scan code import node
- Qv2ray (windows) download URL: https://github.com/Qv2ray/Qv2ray/releases
- igniter (Android) download URL: https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is Qv2ray (windows), ignore (Android)copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official Trojan program. It is configured in global mode, http and socks5 address: 127.0.0.1:1080
- Trojan official website: https://trojan-gfw.github.io/trojan/
- Trojan official program download address: https://github.com/trojan-gfw/trojan/releases
- Download the corresponding version, select Trojan-x.xx-win.zip for Windows, extract trojan.exe after decompression. Put it in the same directory as config.json, just run trojan.exe.
- This file is Qv2ray (windows), ignore (Android), Shadowrocket (ios) scan code import node
- Qv2ray (windows) download URL: https://github.com/Qv2ray/Qv2ray/releases
- igniter (Android) download URL: https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is Qv2ray (windows), ignore (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is the client configuration file used by the official NaiveProxy program, configured in global mode, socks5 address: 127.0.0.1:1080
- NaiveProxy official website: https://github.com/klzgrad/naiveproxy
- NaiveProxy official program download address: https://github.com/klzgrad/naiveproxy/releases
- download the corresponding version, select naiveproxy-x.xx-win.zip for Windows, extract naive.exe after decompression. Put it in the same directory as config.json, just run naive.exe.
- This file is NaiveSharp (windows) copy and paste the URL of the imported node
- NaiveSharp(windows) download URL: https://github.com/KevinZonda/NaiveSharp/releases
- Server general connection configuration parameters
-
- This file is for ShadowsocksR (windows), SSRR (Android), Shadowrocket (ios) scan code import node
- ShadowsocksR (windows) download URL: https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR (Android) download URL: https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is ShadowsocksR (windows), SSRR (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
-
- This file is a Shadowsocks (windows) scan code import node
- This file is Shadowsocks (windows) copy and paste the URL of the imported node
- This file is for shadowsocks (Android), Shadowrocket (ios) scan code to import nodes
- Shadowsocks (windows) download URL: https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks (Android) download URL: https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios) download, you need to use the AppleID of the foreign region. Please Google method yourself.
- This file is shadowsocks (Android), Shadowrocket (ios) copy and paste the URL of the imported node
- Server general connection configuration parameters
- plug-in instructions
- ProxySU defaults all plug-ins, under the subfolder plugins of the folder where the Shadowsocks (windows) run file is located.
- Instructions for manually installing the plug-in on the computer
- First download the plug-in, the download address of each plug-in Windows client is:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases only download obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64-bit system selection: v2ray-plugin-windows-amd64-vx.xxtar.gz , 32-bit system selection: v2ray-plugin-windows-386-vx.xxtar.gz (x is a number, is the version number)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64-bit system selection: kcptun-windows-amd64-xxxxxx.tar.gz, 32-bit system selection :Kcptun-plugin-windows-386-xxxxxx.tar.gz (x is a number, is the version number)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64-bit system selection: gq-client-windows-amd64-xxxexe, 32-bit system selection: gq-client-windows-386-xxxexe (x is a number, is the version number)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64-bit system selection: ck-client-windows-amd64-xxxexe, 32-bit system selection: ck-client-windows-386-xxxexe (x is a number, is the version number)
- In the folder where the Shadowsocks (windows) run file is located, create a new folder plugins, and copy all the files (two) extracted from obfs-local.zip to plugins, v2ray -plugin download the file, unzip the file, copy it to plugins, and rename it to: v2ray-plugin.exe. Kcptun-plugin downloads the file, unzip the two files, copy the file starting with client_windows into the plugins, and rename it to: kcptun-client.exe. The file downloaded by GoQuiet-plugin is directly copied to the plugin and renamed to: goquiet-client.exe. The file downloaded by Cloak-plugin is directly copied to the plugin and renamed to: cloak-client.exe
- installation completed
- Mobile Android client plug-in installation instructions
- first download the plug-in, the download address of each plug-in Android client is:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases only download obfs-local-nightly-xxxapk (x is a number, is the version Number)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases Generally choose v2ray--universal-xxxapk (x is a number, is the version number )
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases Generally choose kcptun--universal-xxxapk (x is a number, is the version number)
- Transfer the above apk file to the phone and install it!
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/Translations/ProxySU.zh-CN.xaml b/ProxySU/Translations/ProxySU.zh-CN.xaml
deleted file mode 100644
index 1db4354..0000000
--- a/ProxySU/Translations/ProxySU.zh-CN.xaml
+++ /dev/null
@@ -1,507 +0,0 @@
-
-
- 最新版本已发布了,快去更新一下吧!
- 正在下载最新版,请等待完成提示....
- 最新版下载失败,请稍后重试!
- 下载最新版成功,文件已存入当前ProxySU.exe同一目录
- 下载更新
- Languages:
- 应用布署
- 资源工具
- 免翻网址资源
- 常见问题
- 主机:
- IP或域名(不可为空)
- 端口:
- 用户:
- 密码:
- 密钥:
- 密钥文件存放路径(不可为空)
- 浏览...
- 密码登录
- 密钥登录
- 无代理
- 不需登录
- 需要登录
- 代理地址:
- Email
- 申请SSL证书需要一个可用的Email地址
- 安装日志另存为...
- 等待安装布署
- 系统工具
-
- Xray模板库
- Xray一键安装
- 升级Xay
-
- V2Ray模板库
- V2ray一键安装
- 升级V2ray
- 取消
-
- Trojan-Go参数设置
- Trojan-Go一键安装
- 升级Trojan-Go
- 取消
- 当前所选方案:
- 未选择方案
-
- 参数设置
- 模式:Trojan+TLS+Caddy
- 服务器地址(域名):
- 端口:443
- 域名不可为空
- 密码:
- 更新
- Trojan一键安装
- 升级Trojan
- 取消
-
- 模式:NaiveProxy+TLS+Caddy
- 随机
- NaiveProxy一键安装
- 取消
-
- 模式:SSR+TLS+Caddy
- SSR一键安装
-
-
- 模式:MTProto+TLS
- MTProto一键安装
- 伪装域名:
- 推荐用常见https端口443、2053、2083、2087、2096、8443
- 密钥将由服务端随机生成,这里无需设置。
-
-
- SS 一键安装
- SS 插件库
- 经典模式
- 提示:这种模式,长时间,大流量使用,容易被阻断和干扰,不推荐使用!
- SS 经典
- SS经典使用模式,无需域名,数据高强度加密,数据被识别为未知数据。目前流量容易被识别,极易被干扰与阻断,慎重使用!放在这里仅仅只是一种情怀与致敬!
- Simple-obfs 插件
- 提示:这是SS早期使用的流量混淆方案,插件已经长时间不再更新,不推荐使用!
- SS+obfs+http+Web
- 无需域名,数据高强度加密,流量混淆为http(并非真正的http),使用Web网站伪装,可在一定程度上增强抗识别!不支持CDN。
- SS+obfs+TLS(https)+Web
- 需要域名,使用域名将很大增强抗识别,数据高强度加密,流量混淆为https(并非真正的https),使用Web网站伪装,进一步增强抗识别!不支持CDN。
- V2Ray 插件
- 提醒:ShadowRocket(ios)不支持SS+Quic模式
- SS+WebSocket+TLS+Caddy(Web后置)
- SS+WebSocket+TLS+Caddy(Web前置)
- 提示:上面方案中的Web前置与Web后置,使用效果上没有差别,Web后置方案,TLS证书由acme.sh申请,证书到期后,acme.sh会自动续期,但是需要手动重启SS加载新证书。而Web前置方案中的证书由Caddy自动申请并加载,不需要重启SS。
- SS+QUIC
- 通过V2Ray-Plugin使用QUIC协议传输,强制使用TLS加密。数据加密传输,被识别为udp流量,最初由谷歌创始,优点:减少延迟、多路复用、连接迁移,需要域名,
-
- kcptun 插件
- 提醒:Shadowrocket(ios)不支持GoQuiet-plugin插件。shadowsocks(Android)不支持GoQuiet-plugin与Cloak-plugin插件
- KCP是一个快速可靠协议,能以比 TCP浪费10%-20%的带宽的代价,换取平均延迟降低 30%-40%,且最大延迟降低三倍的传输效果。使用UDP协议传输,数据高强度加密,传输同样的内容,kcp 一般比 TCP 消耗更多的流量,在丢包率高的线路下将极大提高网速,在个别运营商处可能会被QOS限制。
- 基本原理为模拟TLS的流量同时将服务器伪装成一个正常的网站服务器,这个混淆思路并非首创:simple-obfs和ShadowsocksR的tls1.2_ticket_auth模式证明这条道是行得通的。此插件对现有的方法进行了改善,其目标为让大规模封锁HTTPS服务器(甚至IP段)成为封锁SS的唯一有效手段
- 通过加密方式将代理流量混淆为合法的HTTPS流量,并将代理服务器伪装成普通的Web服务器以规避互联网审查。可以看成是上面GoQuiet升级版,优化网络连接速度,并且不是混淆https而是真正的https流量。
- 插件程序:
- 插件选项:
- 使用编译方式,时间稍长,请耐心等待......
-
-
- 校对时间
- 释放80/443端口
- 启用BBR
- 卸载代理
- 启用root密码登录
- 启用root证书密钥登录
- root禁止密码登录
- 仅支持卸载由ProxySU安装的代理软件及相关配置,请确保重要配置已备份。不支持卸载使用其他方法或脚本安装的代理。确定要卸载远程主机上的代理软件吗?
- 本功能需要当前登录的账户具有sudo权限,是否为远程主机启用root账户并设置密码?
- 本功能需要当前登录的账户具有root或者sudo权限,是否为远程主机启用root证书密钥登录?
- 本功能需要远程主机已经开启了其他登录方式,如密钥方式等,否则将可能造成远程主机无法连接,是否禁止远程主机的root账户密码登录方式?
- 正在关闭root账户密码登录方式.....
- 远程主机root账户密码登录方式已关闭!
- 远程主机root账户证书密钥登录已启用,密钥文件rootuser.key保存在随后打开的文件夹中!
- 当前账户已经具有root权限,无需再设置!
- 当前账户无法获取sudo权限,设置失败!
- 生成20位随机密码!
- 保存密码信息!
- 正在生成密钥......
- 正在下载密钥......
- 远程主机启用密钥登录.......
- 远程主机Root账户密码登录已启用,密码保存在随后打开的文件夹中!
- 开始卸载
- 检测到已安装
- 卸载失败!请向开发者问询!
- 卸载成功!
-
-
- 主页
- 前进
- 后退
- 由于众所周知的原因,在某些时候,加载缓慢,请耐心等待一下
-
- Trojan-go 模板库
- http/2传输,Caddy2伪装网站,抗识别,暂不支持CloudFlare的CDN
- 使用WebSocket传输,Caddy2伪装网站,抗识别,支持CloudFlare的CDN
- 参数设置
- 域名:
- 端口: 443
- 密码:
- 使用已有密码,直接粘贴到框中
- WebSocket路径:
- Mux多路复用
- 此处设置只对官方客户端配置文件config.json有效,其他客户端需手动设置,服务端自动适配。
- 此字段不出现在QR码及分享URL中,客户端需自行设置,服务端默认启用自动适配。
- 确定
- 取消
-
- V2Ray 模板库
- 推荐方案
- 尝鲜方案
- VLESS协议
- VLESS 是一个无状态的轻量传输协议,与 VMess 不同,VLESS 不依赖于系统时间,认证方式同样为 UUID,但不需要 alterId。目前 VLESS 没有自带加密,请用于可靠信道,如 TLS。优点:可以有效的降低主机资源消耗。目前 VLESS 不支持分享。VLESS 处于公测阶段,测试期间请确保客户端与服务端的 v2ray-core 均为最新版本。
- XTLS 在低性能或没有 AES 硬解的设备上效果出众,如在硬路由上换用 XTLS,同样跑满 CPU 时实现网速 翻倍,或是相同网速时 CPU 占用率减半,而对于移动设备,计算量减少意味着省电。服务端客户端版本要求4.29+ (需域名)不支持CDN。
- 轻量协议VLESS,占用更少主机资源,数据TLS加密传输,用Caddy2在节点上做伪装网站。适合配置低的VPS,或多人共用节点,服务端客户端版本要求4.27+ (需域名)不支持CDN。
- 使用VLESS协议,与VMESS的此类型方案,更轻量。稳定性强,Caddy2做前置,隐藏代理特征,被识别为访问网站的https流量,抗封锁识别最强,需要域名,支持CDN
- 使用VLESS协议,与VMESS的此类型方案,更轻量。基于 HTTP/2 传输。完整按 HTTP/2 标准实现,Caddy2做前置,隐藏代理特征,H2C协议转发到V2Ray,需要域名,暂不支持CloudFlare的CDN
-
- TCP传输协议
- WebSocket传输协议
- Http/2传输协议
- mKCP传输协议
- QUIC传输协议
- 参数设置
- 服务器端口:
- 随机选择
- 若使用TLS加密,请保持默认的443端口
- 使用已有UUID,直接粘贴到框中
- QUIC密钥:
- mKCP Seed:
- 启用mKCP Seed密钥,可增强抗识别,留空则禁用,要求版本4.24.2+
- 路径:
- VLESS ws路径:
- VMESS tcp路径:
- VMESS ws路径:
-
- QUIC加密方式:
- 域名:
- Trojan密码与UUID相同。
- 伪装网站:
- 设置此项可增加代理的隐蔽(可为空)
- 仅仅输入域名,不包括"http"及"/"等
- 仅仅禁止root账户使用密码登录,请确保root账户其他登录方式已生效
- 将启用root账户,并设置为密码登录
- 将启用或设置root账户为密钥证书登录
- 伪装网址输入格式错误!请重新输入!
- 稳定性强,Caddy2做前置,隐藏代理特征,被识别为访问网站的https流量,抗封锁识别最强,需要域名,支持CDN
- 基于 HTTP/2 传输。完整按 HTTP/2 标准实现,Caddy2做前置,隐藏代理特征,H2C协议转发到V2Ray,需要域名,暂不支持CloudFlare的CDN
- 当前Xray是V2Ray的超集,未来与V2Ray会有不同的发展方向。
- VLESS over TCP with XTLS + 回落 and 分流 to WHATEVER(终极配置),由rprx大佬 (xtls作者) 配置并推荐,在服务端同时配置以下六种方案,共用同一域名与443端口,其中 WS 都可以通过 CDN。
- VLESS over TCP with XTLS + 回落 and 分流 to WHATEVER(终极配置),由rprx大佬 (xtls作者) 配置并推荐,在服务端同时配置以下五种方案,共用同一域名与443端口,其中 WS 都可以通过 CDN。(想增加XTLS方案请使用Xray配置)
- TCP+Http伪装
- 数据加密传输,会被识别为未知的tcp流量
- 数据加密传输,并做http伪装,会被识别为http流量,但并不是真正的http访问
- 数据加密传输,传输协议使用TLS,会被识别为TLS流量,不等同于https流量特征 (需域名)
- TCP+TLS(自签证书)
- 数据加密传输,传输协议使用TLS,会被识别为TLS流量,不等同于https流量特征 (无需域名)
- Shadowrocket (ios)需要手动打开“允许不安全”选项
- 数据加密传输,传输协议使用WebSocket,未启用TLS,将被识别为WebSocket流量。
- 数据加密传输,传输协议使用WebSocket,启用TLS,将被识别为TLS流量。(需要域名)支持CDN。
- WebSocket+TLS(自签证书)
- 数据加密传输,传输协议使用WebSocket,启用TLS,将被识别为TLS流量。(无需域名)
- 基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,需要域名
- HTTP2(自签证书)
- 基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,使用自签名证书,不需要域名
- mKCP(无伪装)
- 数据加密传输,以增加带宽占用,减少延迟,udp协议,无伪装,会被识别为udp流量
- 同mKCP(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)
- 同mKCP(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据
- 同mKCP(无伪装),增加伪装成微信视频通话的数据包
- 同mKCP(无伪装),增加伪装成 DTLS 1.2 数据包
- 同mKCP(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)
- 提醒:Shadowrocket目前暂不支持QUIC的传输模式。
- QUIC(无伪装)
- 数据加密传输,无伪装会被识别为udp流量,最初由谷歌创始,优点:减少延迟、多路复用、连接迁移
- 同QUIC(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)
- 同QUIC(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据
- 同QUIC(无伪装),增加伪装成微信视频通话的数据包
- 同QUIC(无伪装),增加伪装成 DTLS 1.2 数据包
- 同QUIC(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)
-
- 同步网络时间
- 将远程主机时间校正为网络时间,注意:本机电脑的时间必须也是与网络时间同步的,否则本机电脑V2ray有可能连接出错
推荐:优先使用此方法校对时间
- 同步本机时间
- 将远程主机时间同步为本地时间,注意:本机电脑的时间必须是准确的,与网络时间同步的,否则其他客户端中,有可能连接出错
使用网络校时无法校对时间时,使用此种方法
- 更新本机时间
- 将本机电脑时间与网络时间同步。
注意:使用此项功能,必须以管理员身份运行本程序
- 检测时间误差
- 校对时间
-
- 客户端配置参数
- 服务器地址(address):
- 端口(port):
- 用户ID(uuid)/密码:
- 复制
- 已复制到剪贴板中!
- 空内容!
- 额外ID:
- 不超过64,客户端没此项可不填
- 加密方式:
- 传输协议:
- 伪装类型(混淆):
- TLS设置:
- 提示:双击以上内容窗,即可复制到剪贴板中。
- 路径(Path):
- QUIC密钥:
- mKCP Seed:
- 默认auto
- 二维码/URL
- 以上参数可以手动或扫描输入客户端,用于官方客户端的配置和相关文件已经存放入目录下,点击 确定 按扭可打开
- 二维码和URL链接可用于
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
导入v2ray节点
注意:Vless协议需要手动输入配置参数,二维码和URL无效
- "可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。"
- "可用于ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 扫码和导入url。注意:有的客户端可能不支持WebSocket模式。"
- 用于NaiveSharp(windows)的URL导入链接
- 用于ShadowsocksR(windows)、SSRR(android)、Shadowrocket(ios)的扫码和URL导入链接
- 用于手机客户端shadowsocks(android)、Shadowrocket(ios)的扫码和URL导入链接
- 用于电脑客户端Shadowsocks (windows)的扫码和URL导入链接
- 用于Shadowsocks (windows)、shadowsocks(android)、Shadowrocket(ios)的扫码和URL导入链接
- 提醒: 电脑客户端Shadowsocks (windows)与手机客户端shadowsocks(android)、Shadowrocket(ios)的导入格式不兼容,请选择相应格式。
- 手机端
- 电脑端
- TG格式QR
- TG格式URL(双击复制到剪切板中)
- T.ME格式QR
- T.ME格式URL(双击复制到剪切板中)
-
-
- 主机地址、主机端口、用户名为必填项,不能为空!!
- 连接端口含有非数字字符!
- 登录密码为必填项,不能为空!!
- 密钥文件为必填项,不能为空!!
- 如果选择了代理,则代理地址与端口不能为空!
- 如果代理需要登录,则代理登录的用户名与密码不能为空!
- 远程主机连接信息有误,请检查!
- 请先选择配置模板!
- 发生错误,安装中断......
- 正在登录远程主机......
- 主机登录成功!
- 检测是否运行在root权限下...
- 请使用具有root权限的账户登录主机!!
- 检测结果:OK!
- 检测系统是否已经安装
- 远程主机已安装
- ,建议先执行卸载,或者重装系统,若强制安装有一定机率失败。是否强制重新安装?
- 安装取消,退出
- 已选择强制安装
- 检测结果:未安装
- 检测系统是否符合安装要求......
- 当前系统内核版本为
- ,V2ray要求内核为2.6.23及以上。请升级内核再安装!
- 系统内核版本不符合要求,安装失败!!
- 系统缺乏必要的安装组件如:apt||dnf||yum||zypper||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本
- 系统环境不满足要求,安装失败!!
- 检测结果:OK!
- 检测到系统启用SELinux,且工作在严格模式下,需改为宽松模式!修改中......
- 修改完毕!
- 校对时间......
- 本地时间与远程主机时间相差超过限制(90秒),请先用 '系统工具-->时间校对' 校对时间后再设置
- 时间较对失败......
- 时间差符合要求,OK!
- 正在检测域名是否解析到当前VPS的IP上......
- 正在检测是否为纯ipv6主机......
- 未检测到有效的IP地址......
- 正在查找最快的Nat64网关......
- 未能找到有效的Nat64网关......
- 当前主机最快的Nat64网关为:
- 正在设置Nat64网关......
- 正在删除Nat64网关......
- 解析正确!OK!
- 检测当前主机为纯ipv6主机,目前暂不支持!
- 域名未能正确解析到当前VPS的IP上!安装失败!
- 域名未能正确解析到当前VPS的IP上,请检查!若解析设置正确,请等待生效后再重试安装。如果域名使用了CDN,请先关闭!
- 检测端口占用情况......
- 80/443端口之一,或全部被占用,将强制停止占用80/443端口的程序?
- 端口被占用,安装失败......
- 正在释放80/443端口......
- 80/443端口释放完毕!
- 端口被占用,将强制停止占用此端口的程序?
- 正在释放端口......
- 端口释放完毕!
- 检测结果:未被占用!
- 系统环境检测完毕,符合安装要求,开始布署......
- 开启防火墙相应端口......
- 正在安装
- 文件下载失败!
- 编译中,请耐心等待.............
- 安装失败,脚本运行出错!
- 安装成功!
- 安装完毕,上传配置文件......
- 正在安装acme.sh......
- acme.sh安装成功!
- acme.sh安装失败!原因未知,请向开发者提问!
- 申请域名证书......
- 证书申请成功!
- 证书申请失败!原因未知,请向开发者提问!
- 安装证书到
- 证书成功安装到
- 证书安装到
- 失败,原因未知,可以向开发者提问!
- 安装Caddy......
- 检测结果:未安装Caddy!
- 安装Caddy失败!
- Caddy安装成功!
- 正在为Http2Web模式升级Caddy v2.2.0测试版!
- 上传Caddy配置文件......
- Caddy配置文件上传失败!
- Caddy配置文件上传成功,OK!
- 正在启动Caddy......
- Caddy启动成功!
- Caddy启动失败!
- 正在启动Caddy(第二次尝试)!
- Caddy启动失败(第二次)!退出安装!
- Caddy启动失败,原因未知!请向开发者问询!
- 正在启动
- 启动成功!
- 启动失败!
- 正在第二次尝试启动
- 启动失败(第二次)!退出安装!
- 启动失败,原因如上!请排查原因!
- BBR测试......
- 正在启用BBR......
- BBR已经启用了!
- 系统不满足启用BBR的条件,启用失败!
- BBR 启用成功!
- 生成客户端配置......
- 客户端配置获取失败!
- 安装成功,祝你玩的愉快!!
- 安装失败!
- 发生错误!
- 密码错误或用户名错误!
- 请检查主机地址及端口是否正确,如果通过代理,请检查代理是否正常工作
- 所选密钥文件错误或者格式不对!
- 使用密钥登录,密钥文件错误或用户名错误!
- 主机地址错误,如果使用了代理,也可能是连接代理的端口错误!
- 退出!原因:远程主机未安装
- 检测到使用旧安装脚本的V2Ray......
- 检测到使用旧安装脚本的V2Ray,是否卸载旧版本并使用新安装脚本重新安装?
- 正在卸载旧版本......
- 卸载旧版本,OK!
- 安装新版本......
- 迁移原配置文件。
- 已更新到最新版本。
- 远程主机当前版本为:v
- 最新版本为:
- 是否升级为最新版本?
- 正在升级到最新版本
- 升级成功!当前已是最新版本!
- 升级失败,原因未知,请向开发者提问!
- 升级取消,退出!
- 远程主机当前已是最新版本:
- 无需升级!退出!
- 域名不能为空,请检查相关参数设置!
- 请在x86_64系统中安装
- 备份Trojan配置文件......
- 恢复Trojan配置文件......
- "远程主机已安装Caddy,但不确定是否支持forward proxy,是否强制重新安装?"
- 请先行卸载Caddy或重装VPS系统!
- 正在安装依赖的软件......
- 安装完毕!OK!
- 正在安装Caddy.....
- 正在为NaiveProxy升级服务端
- 升级完毕,OK!
- 正在优化网络参数......
- 优化网络参数,OK!
-
- 此文件为Xay官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- Xray官方网站:https://github.com/XTLS/Xray-core
- Xray官方程序下载地址:https://github.com/XTLS/Xray-core/releases
- 下载相应版本,Windows选择xray-windows-64.zip或者xray-windows-32.zip,解压后提取xray.exe。与config.json放在同一目录,运行xray.exe即可。
-
-
- 此文件为V2Ray官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- v2ray官方网站:https://www.v2ray.com/
- v2ray官方程序下载地址:https://github.com/v2ray/v2ray-core/releases
- 下载相应版本,Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip,解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录,运行v2ray.exe即可。
-
- 此文件为v2rayN(windows)、Qv2ray(windows)、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点
- v2rayN下载网址:https://github.com/2dust/v2rayN/releases
- Qv2ray下载网址:https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android)下载网址:https://github.com/2dust/v2rayNG/releases
- v2rayNG(Android)在Google Play下载网址:https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址
- 服务器通用连接配置参数:
-
- 此文件为Trojan-go官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080
- Trojan-go官方网站:https://github.com/p4gefau1t/trojan-go
- Trojan-go官方程序下载地址:https://github.com/p4gefau1t/trojan-go/releases
- 下载相应版本,Windows选择Trojan-go-x.xx-win.zip,解压后提取trojan-go.exe。与config.json放在同一目录,运行trojan-go.exe即可。
- 此文件为Qv2ray (windows)、igniter(Android)扫码导入节点
- Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为Qv2ray (windows)、igniter(Android)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为Trojan官方程序所使用的客户端配置文件,配置为全局模式,http与socks5地址:127.0.0.1:1080
- Trojan官方网站:https://trojan-gfw.github.io/trojan/
- Trojan官方程序下载地址:https://github.com/trojan-gfw/trojan/releases
- 下载相应版本,Windows选择Trojan-x.xx-win.zip,解压后提取trojan.exe。与config.json放在同一目录,运行trojan.exe即可。
- 此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)扫码导入节点
- Qv2ray (windows)下载网址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下载网址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为NaiveProxy官方程序所使用的客户端配置文件,配置为全局模式,socks5地址:127.0.0.1:1080
- NaiveProxy官方网站:https://github.com/klzgrad/naiveproxy
- NaiveProxy官方程序下载地址:https://github.com/klzgrad/naiveproxy/releases
- 下载相应版本,Windows选择naiveproxy-x.xx-win.zip,解压后提取naive.exe。与config.json放在同一目录,运行naive.exe即可。
- 此文件为NaiveSharp(windows)复制粘贴导入节点的网址
- NaiveSharp(windows)下载网址:https://github.com/KevinZonda/NaiveSharp/releases
- 服务器通用连接配置参数
-
- 此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)扫码导入节点
- ShadowsocksR (windows)下载网址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR(Android)下载网址:https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
-
- 此文件为Shadowsocks (windows)扫码导入节点
- 此文件为Shadowsocks (windows)复制粘贴导入节点的网址
- 此文件为shadowsocks(Android)、Shadowrocket(ios)扫码导入节点
- Shadowsocks (windows)下载网址:https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks(Android)下载网址:https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。
- 此文件为shadowsocks(Android)、Shadowrocket(ios)复制粘贴导入节点的网址
- 服务器通用连接配置参数
- 插件使用说明
- ProxySU默认所有插件,在Shadowsocks (windows)运行文件所在文件夹的子文件夹plugins下。
- 电脑端手动安装插件说明
- 先下载插件,各个插件Windows客户端下载地址为:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下载 obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系统选择:v2ray-plugin-windows-amd64-vx.x.x.tar.gz,32位系统选择:v2ray-plugin-windows-386-vx.x.x.tar.gz (x为数字,是版本号)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系统选择:kcptun-windows-amd64-xxxxxx.tar.gz,32位系统选择:kcptun-plugin-windows-386-xxxxxx.tar.gz (x为数字,是版本号)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系统选择:gq-client-windows-amd64-x.x.x.exe,32位系统选择:gq-client-windows-386-x.x.x.exe(x为数字,是版本号)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系统选择:ck-client-windows-amd64-x.x.x.exe,32位系统选择:ck-client-windows-386-x.x.x.exe(x为数字,是版本号)
- 在Shadowsocks (windows)运行文件所在文件夹中,新建文件夹plugins,将obfs-local.zip解压出的文件(两个)全部复制到plugins中,v2ray -plugin下载得到的文件,解压出的文件,复制到plugins中,并重命名为:v2ray-plugin.exe。Kcptun -plugin下载得到的文件,解压出两个文件,将其中的client_windows开头的文件,复制到plugins中,并重命名为:kcptun-client.exe。GoQuiet-plugin下载得到的文件,直接复制到plugin中,并重命名为:goquiet-client.exe。Cloak-plugin下载得到的文件,直接复制到plugin中,并重命名为:cloak-client.exe
- 安装完毕
- 手机安卓客户端插件安装说明
- 先下载插件,各个插件安卓客户端下载地址为:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下载 obfs-local-nightly-x.x.x.apk(x为数字,是版本号)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般选择v2ray--universal-x.x.x.apk(x为数字,是版本号)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般选择kcptun--universal-x.x.x.apk(x为数字,是版本号)
- 将上述apk文件传到手机,安装即可!
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU/Translations/ProxySU.zh-TW.xaml b/ProxySU/Translations/ProxySU.zh-TW.xaml
deleted file mode 100644
index 3b98e2e..0000000
--- a/ProxySU/Translations/ProxySU.zh-TW.xaml
+++ /dev/null
@@ -1,488 +0,0 @@
-
-
- 最新版本已發布了,快去更新一下吧!
- 正在下載最新版,請等待完成提示....
- 最新版下載失敗,請稍後重試!
- 下載最新版成功,文件已存入當前ProxySU.exe同一目錄
- 下載更新
- Languages:
- 應用佈署
- 資源工具
- 免翻網址資源
- 常見問題
- 主機:
- IP或域名(不可為空)
- 端口:
- 用戶:
- 密碼:
- 密鑰::
- 密鑰文件存放路徑(不可為空)
- 瀏覽...
- 密碼登錄
- 密鑰登錄
- 無代理
- 不需登錄
- 需要登錄
- 代理地址:
- Email
- 申請SSL證書需要一個可用的Email地址
- 安裝日誌另存為...
- 等待安裝佈署
- 系統工具
-
- Xray模板庫
- Xray一鍵安裝
- 升級Xay
-
- V2Ray模板庫
- V2ray一鍵安裝
- 升級V2Ray
- 取消
- Trojan-Go參數設置
- Trojan-Go一鍵安裝
- 升級Trojan-Go
- 取消
- 當前所選方案:
- 未選擇方案
-
- 參數設置
- 模式:Trojan+TLS+Caddy
- 服務器地址(域名):
- 端口:443
- 域名不可為空
- 密碼:
- 更新
- Trojan一鍵安裝
- 升級Trojan
- 取消
-
- 模式:NaiveProxy+TLS+Caddy
- 隨機
- NaiveProxy一鍵安裝
- 取消
-
- 模式:SSR+TLS+Caddy
- SSR一鍵安裝
-
-
- 模式:MTProto+TLS
- MTProto一鍵安裝
- 偽裝域名:
- 推薦用常見https端口443、2053、2083、2087、2096、8443
- 密鑰將由服務端隨機生成,這裡無需設置。
-
-
- SS 一鍵安裝
- SS 插件庫
- 經典模式
- 提示:這種模式,長時間,大流量使用,容易被阻斷和乾擾,不推薦使用!
- SS 經典
- SS經典使用模式,無需域名,數據高強度加密,數據被識別為未知數據。目前流量容易被識別,極易被干擾與阻斷,慎重使用!放在這裡僅僅只是一種情懷與致敬!
- Simple-obfs 插件
- 提示:這是SS早期使用的流量混淆方案,插件已經長時間不再更新,不推薦使用!
- SS+obfs+http+Web
- 無需域名,數據高強度加密,流量混淆為http(並非真正的http),使用Web網站偽裝,可在一定程度上增強抗識別!不支持CDN。
- SS+obfs+TLS(https)+Web
- 需要域名,使用域名將很大增強抗識別,數據高強度加密,流量混淆為https(並非真正的https),使用Web網站偽裝,進一步增強抗識別!不支持CDN。
- V2Ray 插件
- 提醒:ShadowRocket(ios)不支持SS+Quic模式
- SS+WebSocket+TLS+Caddy(Web後置)
- SS+WebSocket+TLS+Caddy(Web前置)
- 提示:上面方案中的Web前置與Web後置,使用效果上沒有差別,Web後置方案,TLS證書由acme.sh申請,證書到期後, acme.sh會自動續期,但是需要手動重啟SS加載新證書。而Web前置方案中的證書由Caddy自動申請並加載,不需要重啟SS。
- SS+QUIC
- 通過V2Ray-Plugin使用QUIC協議傳輸,強制使用TLS加密。數據加密傳輸,被識別為udp流量,最初由谷歌創始,優點:減少延遲、多路復用、連接遷移,需要域名,
-
- kcptun 插件
- 提醒:Shadowrocket(ios)不支持GoQuiet-plugin插件。 shadowsocks(Android)不支持GoQuiet-plugin與Cloak-plugin插件
- KCP是一個快速可靠協議,能以比TCP浪費10%-20%的帶寬的代價,換取平均延遲降低30%-40%,且最大延遲降低三倍的傳輸效果。使用UDP協議傳輸,數據高強度加密,傳輸同樣的內容,kcp 一般比TCP 消耗更多的流量,在丟包率高的線路下將極大提高網速,在個別運營商處可能會被QOS限制。
- 基本原理為模擬TLS的流量同時將服務器偽裝成一個正常的網站服務器,這個混淆思路並非首創:simple-obfs和ShadowsocksR的tls1.2_ticket_auth模式證明這條道是行得通的。此插件對現有的方法進行了改善,其目標為讓大規模封鎖HTTPS服務器(甚至IP段)成為封鎖SS的唯一有效手段
- 通過加密方式將代理流量混淆為合法的HTTPS流量,並將代理服務器偽裝成普通的Web服務器以規避互聯網審查。可以看成是上面GoQuiet升級版,優化網絡連接速度,並且不是混淆https而是真正的https流量。
- 插件程序:
- 插件選項:
- 使用編譯方式,時間稍長,請耐心等待......
-
-
- 校對時間
- 釋放80/443端口
- 啟用BBR
- 卸載代理
- 啟用root密碼登錄
- root禁止密碼登錄
- 啟用root證書密鑰登錄
- 僅支持卸載由ProxySU安裝的代理軟件及相關配置,請確保重要配置已備份。不支持卸載使用其他方法或腳本安裝的代理。確定要卸載遠程主機上的代理軟件嗎?
- 本功能需要當前登錄的賬戶具有sudo權限,是否為遠程主機啟用root賬戶並設置密碼?
- 本功能需要當前登錄的賬戶具有root或者sudo權限,是否為遠程主機啟用root證書密鑰登錄?
- 本功能需要遠程主機已經開啟了其他登錄方式,如密鑰方式等,否則將可能造成遠程主機無法連接,是否禁止遠程主機的root賬戶密碼登錄方式?
- 正在關閉root賬戶密碼登錄方式.....
- 遠程主機root賬戶密碼登錄方式已關閉!
- 遠程主機root賬戶證書密鑰登錄已啟用,密鑰文件rootuser.key保存在隨後打開的文件夾中!
- 當前賬戶已經具有root權限,無需再設置!
- 當前賬戶無法獲取sudo權限,設置失敗!
- 生成20位隨機密碼!
- 保存密碼信息!
- 正在生成密鑰......
- 正在下載密鑰......
- 遠程主機啟用密鑰登錄.......
- 遠程主機Root賬戶密碼登錄已啟用,密碼保存在隨後打開的文件夾中!
- 開始卸載......
- 檢測到已安裝
- 卸載失敗!請向開發者問詢!
- 卸載成功!
-
- 主頁
- 前進
- 後退
- 由於眾所周知的原因,在某些時候,加載緩慢,請耐心等待一下
-
- Trojan-go 模板庫
- http/2傳輸,Caddy2偽裝網站,抗識別,暫不支持CloudFlare的CDN
- 使用WebSocket傳輸,Caddy2偽裝網站,抗識別,支持CloudFlare的CDN
- 參數設置
- 域名:
- 端口: 443
- 密碼:
- 使用已有密碼,直接粘貼到框中
- WebSocket路徑:
- Mux多路復用
- 此處設置只對官方客戶端配置文件config.json有效,其他客戶端需手動設置,服務端自動適配。
- 此字段不出現在QR碼及分享URL中,客戶端需自行設置,服務端默認啟用自動適配。
- 確定
- 取消
-
- V2Ray 模板庫
- 推薦方案
- 嚐鮮方案
- VLESS協議
- VLESS 是一個無狀態的輕量傳輸協議,與 VMess 不同,VLESS 不依賴於系統時間,認證方式同樣為 UUID,但不需要 alterId。目前 VLESS 沒有自帶加密,請用於可靠信道,如 TLS。優點:可以有效的降低主機資源消耗。目前 VLESS 不支持分享。 VLESS 處於公測階段,測試期間請確保客戶端與服務端的 v2ray-core 均為最新版本。
- XTLS 在低性能或沒有AES 硬解的設備上效果出眾,如在硬路由上換用XTLS,同樣跑滿CPU 時實現網速翻倍,或是相同網速時CPU 佔用率減半,而對於移動設備,計算量減少意味著省電。服務端客戶端版本要求4.29+ (需域名)不支持CDN。
- 輕量協議VLESS,佔用更少主機資源,數據TLS加密傳輸,用Caddy2在節點上做偽裝網站。適合配置低的VPS,或多人共用節點,服務端客戶端版本要求4.27+ (需域名)不支持CDN。
- 使用VLESS協議,與VMESS的此類型方案,更輕量。穩定性強,Caddy2做前置,隱藏代理特徵,被識別為訪問網站的https流量,抗封鎖識別最強,需要域名,支持CDN
- 使用VLESS協議,與VMESS的此類型方案,更輕量。基於 HTTP/2 傳輸。完整按 HTTP/2 標準實現,Caddy2做前置,隱藏代理特徵,H2C協議轉發到V2Ray,需要域名,暫不支持CloudFlare的CDN
- TCP傳輸協議
- WebSocket傳輸協議
- Http/2傳輸協議
- mKCP傳輸協議
- QUIC傳輸協議
- 參數設置
- 服務器端口:
- 隨機選擇
- 若使用TLS加密,請保持默認的443端口
- 使用已有UUID,直接粘貼到框中
- QUIC密鑰:
- mKCP Seed:
- 啟用mKCP Seed密鑰,可增強抗識別,留空則禁用,要求版本4.24.2+
- 路徑:
- VLESS ws路徑:
- VMESS tcp路徑:
- VMESS ws路徑:
- QUIC加密方式:
- 域名:
- Trojan密碼與V2ray的UUID相同。
- 偽裝網站:
- 設置此項可增加代理的隱蔽(可為空)
- 僅僅輸入域名,不包括"http"及"/"等
- 僅僅禁止root賬戶使用密碼登錄,請確保root賬戶其他登錄方式已生效
- 將啟用root賬戶,並設置為密碼登錄
- 將啟用或設置root賬戶為密鑰證書登錄
- 偽裝網址輸入格式錯誤!請重新輸入!
- 穩定性強,Caddy2做前置,隱藏代理特徵,被識別為訪問網站的https流量,抗封鎖識別最強,需要域名,支持CDN
- 基於 HTTP/2 傳輸。完整按 HTTP/2 標準實現,Caddy2做前置,隱藏代理特徵,H2C協議轉發到V2Ray,需要域名,暫不支持CloudFlare的CDN
- 當前Xray是V2Ray的超集,未來與V2Ray會有不同的發展方向。
- VLESS over TCP with XTLS + 回落and 分流to WHATEVER(終極配置),由rprx大佬(xtls作者)配置並推薦,在服務端同時配置以下六種方案,共用同一域名與443端口,其中 WS 都可以通過 CDN。
- VLESS over TCP with XTLS + 回落and 分流to WHATEVER(終極配置),由rprx大佬(xtls作者)配置並推薦,在服務端同時配置以下五種方案,共用同一域名與443端口,其中 WS 都可以通過 CDN。(想增加XTLS方案請使用Xray配置)
- 數據加密傳輸,會被識別為未知的tcp流量
- TCP+Http偽裝
- 數據加密傳輸,並做http偽裝,會被識別為http流量,但並不是真正的http訪問
- 數據加密傳輸,傳輸協議使用TLS,會被識別為TLS流量,不等同於https流量特徵 (需域名)
- TCP+TLS(自簽證書)
- 數據加密傳輸,傳輸協議使用TLS,會被識別為TLS流量,不等同於https流量特徵 (無需域名)
- Shadowrocket (ios)需要手動打開“允許不安全”選項
- 數據加密傳輸,傳輸協議使用WebSocket,未啟用TLS,將被識別為WebSocket流量。
- 數據加密傳輸,傳輸協議使用WebSocket,啟用TLS,將被識別為TLS流量。 (需要域名)支持CDN。
- WebSocket+TLS(自簽證書)
- 數據加密傳輸,傳輸協議使用WebSocket,啟用TLS,將被識別為TLS流量。 (無需域名)
- 基於 HTTP/2 的傳輸方式。它完整按照 HTTP/2 標準實現,需要域名
- HTTP2(自簽證書)
- 基於 HTTP/2 的傳輸方式。它完整按照 HTTP/2 標準實現,使用自簽名證書,不需要域名
- mKCP(無偽裝)
- 數據加密傳輸,以增加帶寬佔用,減少延遲,udp協議,無偽裝,會被識別為udp流量
- 同mKCP(無偽裝),增加偽裝成 SRTP 數據包,會被識別為視頻通話數據(如 FaceTime)
- 同mKCP(無偽裝),增加偽裝成 uTP 數據包,會被識別為 BT 下載數據
- 同mKCP(無偽裝),增加偽裝成微信視頻通話的數據包
- 同mKCP(無偽裝),增加偽裝成 DTLS 1.2 數據包
- 同mKCP(無偽裝),增加偽裝成 WireGuard 數據包。 (並不是真正的 WireGuard 協議)
- 提醒:Shadowrocket目前暫不支持QUIC的傳輸模式。
- QUIC(無偽裝)
- 數據加密傳輸,無偽裝會被識別為udp流量,最初由谷歌創始,優點:減少延遲、多路復用、連接遷移
- 同QUIC(無偽裝),增加偽裝成 SRTP 數據包,會被識別為視頻通話數據(如 FaceTime)
- 同QUIC(無偽裝),增加偽裝成 uTP 數據包,會被識別為 BT 下載數據
- 同QUIC(無偽裝),增加偽裝成微信視頻通話的數據包
- 同QUIC(無偽裝),增加偽裝成 DTLS 1.2 數據包
- 同QUIC(無偽裝),增加偽裝成 WireGuard 數據包。 (並不是真正的 WireGuard 協議)
-
- 同步網絡時間
- 將遠程主機時間校正為網絡時間,注意:本機電腦的時間必須也是與網絡時間同步的,否則本機電腦V2ray有可能連接出錯
推薦:優先使用此方法校對時間
- 同步本機時間
- 將遠程主機時間同步為本地時間,注意:本機電腦的時間必須是準確的,與網絡時間同步的,否則其他客戶端中,有可能連接出錯
使用網絡校時無法校對時間時,使用此種方法
- 更新本機時間
- 將本機電腦時間與網絡時間同步。
注意:使用此項功能,必須以管理員身份運行本程序
- 檢測時間誤差
- 校對時間
-
- 客戶端配置參數
- 服務器地址(address):
- 端口(port):
- 用戶ID(uuid)/密碼:
- 複製
- 已復製到剪貼板中!
- 空內容!
- 額外ID:
- 不超過64,客戶端沒此項可不填
- 加密方式:
- 傳輸協議:
- 偽裝類型(混淆):
- TLS設置:
- 提示:雙擊以上內容窗,即可複製到剪貼板中。
- 路徑(Path):
- mKCP Seed/QUIC密鑰:
- 默認auto
- 二維碼/URL
- 以上參數可以手動或掃描輸入客戶端,用於官方客戶端的配置和相關文件已經存放入目錄下,點擊 確定 按扭可打開
- 二維碼和URL鏈接可用於
v2rayN(windows)
Qv2ray(windows)
Qv2ray(windows)
Shadowrocket(ios)
v2rayNG(Android)
導入v2ray節點
注意:Vless協議需要手動輸入配置參數,二維碼和URL無效
- "可用於ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 掃碼和導入url。注意:有的客戶端可能不支持WebSocket模式。"
- "可用於ShadowRocket (ios)、igniter(Android)、Qv2ray (windows) 掃碼和導入url。注意:有的客戶端可能不支持WebSocket模式。"
- 用於NaiveSharp(windows)的URL導入鏈接
- 用於ShadowsocksR(windows)、SSRR(android)、Shadowrocket(ios)的掃碼和導入URL導入鏈接
- 用於手機客戶端shadowsocks(android)、Shadowrocket(ios)的掃碼和URL導入鏈接
- 用於電腦客戶端Shadowsocks (windows)的掃碼和URL導入鏈接
- 用於Shadowsocks (windows)、shadowsocks(android)、Shadowrocket(ios)的掃碼和URL導入鏈接
- 提醒: 電腦客戶端Shadowsocks (windows)與手機客戶端shadowsocks(android)、Shadowrocket(ios)的導入格式不兼容,請選擇相應格式。
- 手機端
- 電腦端
- TG格式QR
- TG格式URL(雙擊複製到剪切板中)
- T.ME格式QR
- T.ME格式URL(雙擊複製到剪切板中)
-
- 主機地址、主機端口、用戶名為必填項,不能為空!!
- 連接端口含有非數字字符!
- 登錄密碼為必填項,不能為空!!
- 密鑰文件為必填項,不能為空!!
- 如果選擇了代理,則代理地址與端口不能為空!
- 如果代理需要登錄,則代理登錄的用戶名與密碼不能為空!
- 遠程主機連接信息有誤,請檢查!
- 請先選擇配置模板!
- 發生錯誤,安裝中斷......
- 正在登錄遠程主機......
- 主機登錄成功!
- 檢測是否運行在root權限下...
- 請使用具有root權限的賬戶登錄主機! !
- 檢測結果:OK!
- 檢測系統是否已經安裝
- 遠程主機已安裝
- ,建議先執行卸載,或者重裝系統,若強制安裝有一定機率失敗。是否強制重新安裝?
- 安裝取消,退出
- 已選擇強制安裝
- 檢測結果:未安裝
- 檢測系統是否符合安裝要求......
- 當前系統內核版本為
- ,V2ray要求內核為2.6.23及以上。請升級內核再安裝!
- 系統內核版本不符合要求,安裝失敗! !
- 系統缺乏必要的安裝組件如:apt||dnf||yum||zypper||Syetemd,主機系統推薦使用:CentOS 7/8,Debian 8/9/10 ,Ubuntu 16.04及以上版本
- 系統環境不滿足要求,安裝失敗! !
- 檢測結果:OK!
- 檢測到系統啟用SELinux,且工作在嚴格模式下,需改為寬鬆模式!修改中......
- 修改完畢!
- 校對時間......
- 本地時間與遠程主機時間相差超過限制(90秒),請先用 '系統工具-->時間校對' 校對時間後再設置
- 時間較對失敗......
- 時間差符合要求,OK!
- 正在檢測域名是否解析到當前VPS的IP上......
- 正在檢測是否為純ipv6主機......
- 未檢測到有效的IP地址......
- 正在查找最快的Nat64網關......
- 未能找到有效的Nat64網關......
- 當前主機最快的Nat64網關為:
- 正在設置Nat64網關......
- 正在刪除Nat64網關......
- 解析正確! OK!
- 檢測當前主機為純ipv6主機,目前暫不支持!
- 域名未能正確解析到當前VPS的IP上!安裝失敗!
- 域名未能正確解析到當前VPS的IP上,請檢查!若解析設置正確,請等待生效後再重試安裝。如果域名使用了CDN,請先關閉!
- 檢測端口占用情況......
- 80/443端口之一,或全部被佔用,將強制停止佔用80/443端口的程序?
- 端口被佔用,安裝失敗......
- 正在釋放80/443端口......
- 80/443端口釋放完畢!
- 端口被佔用,將強制停止佔用此端口的程序?
- 正在釋放端口......
- 端口釋放完畢!
- 檢測結果:未被佔用!
- 系統環境檢測完畢,符合安裝要求,開始佈署......
- 開啟防火牆相應端口......
- 正在安裝
- 文件下載失敗!
- 編譯中,請耐心等待.............
- 安裝失敗,腳本運行出錯!
- 安裝成功!
- 安裝完畢,上傳配置文件......
- 正在安裝acme.sh......
- acme.sh安裝成功!
- acme.sh安裝失敗!原因未知,請向開發者提問!
- 申請域名證書......
- 證書申請成功!
- 證書申請失敗!原因未知,請向開發者提問!
- 安裝證書到
- 證書成功安裝到
- 證書安裝到
- 失敗,原因未知,可以向開發者提問!
- 安裝Caddy......
- 檢測結果:未安裝Caddy!
- 安裝Caddy失敗!
- Caddy安裝成功!
- 正在為Http2Web模式升級Caddy v2.2.0測試版!
- 上傳Caddy配置文件......
- Caddy配置文件上傳失敗!
- Caddy配置文件上傳成功,OK!
- 正在啟動Caddy......
- Caddy啟動成功!
- Caddy啟動失敗!
- 正在啟動Caddy(第二次嘗試)!
- Caddy啟動失敗(第二次)!退出安裝!
- Caddy啟動失敗,原因未知!請向開發者問詢!
- 正在啟動
- 啟動成功!
- 啟動失敗!
- 正在第二次嘗試啟動
- 啟動失敗(第二次)!退出安裝!
- 啟動失敗,原因如上!請排查原因!
- BBR測試......
- 正在啟用BBR......
- BBR已經啟用了!
- 系統不滿足啟用BBR的條件,啟用失敗!
- BBR 啟用成功!
- 生成客戶端配置......
- 客戶端配置獲取失敗!
- 安裝成功,祝你玩的愉快! !
- 安裝失敗!
- 發生錯誤!
- 密碼錯誤或用戶名錯誤!
- 請檢查主機地址及端口是否正確,如果通過代理,請檢查代理是否正常工作
- 所選密鑰文件錯誤或者格式不對!
- 使用密鑰登錄,密鑰文件錯誤或用戶名錯誤!
- 主機地址錯誤,如果使用了代理,也可能是連接代理的端口錯誤!
- 退出!原因:遠程主機未安裝
- 檢測到使用舊安裝腳本的V2Ray......
- 檢測到使用舊安裝腳本的V2Ray,是否卸載舊版本並使用新安裝腳本重新安裝?
- 正在卸載舊版本......
- 卸載舊版本,OK!
- 安裝新版本......
- 遷移原配置文件。
- 已更新到最新版本。
- 遠程主機當前版本為:v
- 最新版本為:
- 是否升級為最新版本?
- 正在升級到最新版本
- 升級成功!當前已是最新版本!
- 升級失敗,原因未知,請向開發者提問!
- 升級取消,退出!
- 遠程主機當前已是最新版本:
- 無需升級!退出!
- 域名不能為空,請檢查相關參數設置!
- 請在x86_64系統中安裝
- 備份Trojan配置文件......
- 恢復Trojan配置文件......
- "遠程主機已安裝Caddy,但不確定是否支持forward proxy,是否強制重新安裝?"
- 請先行卸載Caddy或重裝VPS系統!
- 正在安裝依賴的軟件......
- 安裝完畢! OK!
- 正在安裝Caddy.....
- 正在為NaiveProxy升級服務端
- 升級完畢,OK!
- 正在優化網絡參數......
- 優化網絡參數,OK!
-
- 此文件為Xay官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- Xray官方網站:https://github.com/XTLS/Xray-core
- Xray官方程序下載地址:https://github.com/XTLS/Xray-core/releases
- 下載相應版本,Windows選擇xray-windows-64.zip或者xray-windows-32.zip,解壓後提取xray.exe。與config.json放在同一目錄,運行xray.exe即可。
-
- 此文件為V2Ray官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080,http代理地址:127.0.0.1:1081
- v2ray官方網站:https://www.v2ray.com/
- v2ray官方程序下載地址:https://github.com/v2ray/v2ray-core/releases
- 下載相應版本,Windows選擇v2ray-windows-64.zip或者v2ray-windows-32.zip,解壓後提取v2ctl.exe和v2ray.exe。與config.json放在同一目錄,運行v2ray.exe即可。
- 此文件為v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)掃碼導入節點
- v2rayN下載網址:https://github.com/2dust/v2rayN/releases
- Qv2ray下載網址:https://github.com/Qv2ray/Qv2ray/releases
- v2rayNG(Android)下載網址:https://github.com/2dust/v2rayNG/releases
- v2rayNG(Android)在Google Play下載網址:https://play.google.com/store/apps/details?id=com.v2ray.ang
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為v2rayN、Qv2ray、v2rayNG(Android)、Shadowrocket(ios)複製粘貼導入節點的vmess網址
- 服務器通用連接配置參數
-
- 此文件為Trojan-go官方程序所使用的客戶端配置文件,配置為全局模式,http與socks5地址:127.0.0.1:1080
- Trojan-go官方網站:https://github.com/p4gefau1t/trojan-go
- Trojan-go官方程序下載地址:https://github.com/p4gefau1t/trojan-go/releases
- 下載相應版本,Windows選擇Trojan-go-x.xx-win.zip,解壓後提取trojan-go.exe。與config.json放在同一目錄,運行trojan-go.exe即可。
- 此文件為Qv2ray (windows)、igniter(Android)掃碼導入節點
- Qv2ray (windows)下載網址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下載網址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為Qv2ray (windows)、igniter(Android)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為Trojan官方程序所使用的客戶端配置文件,配置為全局模式,http與socks5地址:127.0.0.1:1080
- Trojan官方網站:https://trojan-gfw.github.io/trojan/
- Trojan官方程序下載地址:https://github.com/trojan-gfw/trojan/releases
- 下載相應版本,Windows選擇Trojan-x.xx-win.zip,解壓後提取trojan.exe。與config.json放在同一目錄,運行trojan.exe即可。
- 此文件為Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)掃碼導入節點
- Qv2ray (windows)下載網址:https://github.com/Qv2ray/Qv2ray/releases
- igniter(Android)下載網址:https://github.com/trojan-gfw/igniter/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為Qv2ray (windows)、igniter(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為NaiveProxy官方程序所使用的客戶端配置文件,配置為全局模式,socks5地址:127.0.0.1:1080
- NaiveProxy官方網站:https://github.com/klzgrad/naiveproxy
- NaiveProxy官方程序下載地址:https://github.com/klzgrad/naiveproxy/releases
- 下載相應版本,Windows選擇naiveproxy-x.xx-win.zip,解壓後提取naive.exe。與config.json放在同一目錄,運行naive.exe即可。
- 此文件為NaiveSharp(windows)複製粘貼導入節點的網址
- NaiveSharp(windows)下載網址:https://github.com/KevinZonda/NaiveSharp/releases
- 服務器通用連接配置參數
-
- 此文件為ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)掃碼導入節點
- ShadowsocksR (windows)下載網址:https://github.com/shadowsocksrr/shadowsocksr-csharp/releases
- SSRR(Android)下載網址:https://github.com/shadowsocksrr/shadowsocksr-android/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為ShadowsocksR (windows)、SSRR(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
-
- 此文件為Shadowsocks (windows)掃碼導入節點
- 此文件為Shadowsocks (windows)複製粘貼導入節點的網址
- 此文件為shadowsocks(Android)、Shadowrocket(ios)掃碼導入節點
- Shadowsocks (windows)下載網址:https://github.com/shadowsocks/shadowsocks-windows/releases
- shadowsocks(Android)下載網址:https://github.com/shadowsocks/shadowsocks-android/releases
- Shadowrocket(ios)下載,需要使用國外區的AppleID。請自行谷歌方法。
- 此文件為shadowsocks(Android)、Shadowrocket(ios)複製粘貼導入節點的網址
- 服務器通用連接配置參數
- 插件使用說明
- ProxySU默認所有插件,在Shadowsocks (windows)運行文件所在文件夾的子文件夾plugins下。
- 電腦端手動安裝插件說明
- 先下載插件,各個插件Windows客戶端下載地址為:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs/releases 只下載 obfs-local.zip
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin/releases 64位系統選擇:v2ray-plugin-windows-amd64-vx.xxtar.gz ,32位系統選擇:v2ray-plugin-windows-386-vx.xxtar.gz (x為數字,是版本號)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun/releases 64位系統選擇:kcptun-windows-amd64-xxxxxx.tar.gz,32位系統選擇:kcptun-plugin-windows-386-xxxxxx.tar.gz (x為數字,是版本號)
- GoQuiet-plugin: https://github.com/cbeuw/GoQuiet/releases 64位系統選擇:gq-client-windows-amd64-xxxexe,32位系統選擇: gq-client-windows-386-xxxexe(x為數字,是版本號)
- Cloak-plugin: https://github.com/cbeuw/Cloak/releases 64位系統選擇:ck-client-windows-amd64-xxxexe,32位系統選擇: ck-client-windows-386-xxxexe(x為數字,是版本號)
- 在Shadowsocks (windows)運行文件所在文件夾中,新建文件夾plugins,將obfs-local.zip解壓出的文件(兩個)全部複製到plugins中,v2ray -plugin下載得到的文件,解壓出的文件,複製到plugins中,並重命名為:v2ray-plugin.exe。 Kcptun -plugin下載得到的文件,解壓出兩個文件,將其中的client_windows開頭的文件,複製到plugins中,並重命名為:kcptun-client.exe。 GoQuiet-plugin下載得到的文件,直接複製到plugin中,並重命名為:goquiet-client.exe。 Cloak-plugin下載得到的文件,直接複製到plugin中,並重命名為:cloak-client.exe
- 安裝完畢
- 手機安卓客戶端插件安裝說明
- 先下載插件,各個插件安卓客戶端下載地址為:
- Simple-obfs: https://github.com/shadowsocks/simple-obfs-android/releases 只下載obfs-local-nightly-xxxapk(x為數字,是版本號)
- V2ray-plugin: https://github.com/shadowsocks/v2ray-plugin-android/releases 一般選擇v2ray--universal-xxxapk(x為數字,是版本號)
- Kcptun-plugin: https://github.com/shadowsocks/kcptun-android/releases 一般選擇kcptun--universal-xxxapk(x為數字,是版本號)
- 將上述apk文件傳到手機,安裝即可!
-
\ No newline at end of file
diff --git a/ProxySU/TrojanGoTemplateWindow.xaml b/ProxySU/TrojanGoTemplateWindow.xaml
deleted file mode 100644
index 1c59fa4..0000000
--- a/ProxySU/TrojanGoTemplateWindow.xaml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/TrojanGoTemplateWindow.xaml.cs b/ProxySU/TrojanGoTemplateWindow.xaml.cs
deleted file mode 100644
index 59816c7..0000000
--- a/ProxySU/TrojanGoTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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 ProxySU
-{
- ///
- /// TrojanGoTemplateWindow.xaml 的交互逻辑
- ///
- public partial class TrojanGoTemplateWindow : Window
- {
- public TrojanGoTemplateWindow()
- {
- InitializeComponent();
- RadioButtonTrojanGoTLS2Web.IsChecked = true;
- CheckBoxMuxSelect.IsChecked = false;
- GridTrojanGoMuxSelected.Visibility = Visibility.Collapsed;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Collapsed;
- }
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- //{
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return;
- //}
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = "443";
- //传递密码(uuid)
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
- if (RadioButtonTrojanGoTLS2Web.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TrojanGoTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTrojanGoTLS2Web.Content.ToString();
-
- }
- else if (RadioButtonTrojanGoWebSocketTLS2Web.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TrojanGoWebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTrojanGoWebSocketTLS2Web.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- }
- //传递Mux的concurrency与idle_timeout
- if (CheckBoxMuxSelect.IsChecked == true)
- {
- MainWindow.ReceiveConfigurationParameters[9] = "true";
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxConcurrency.Text);
- MainWindow.ReceiveConfigurationParameters[5] = PreTrim(TextBoxIdle_timeout.Text);
- }
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
- //更新密码
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
- //更新路径
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- //MessageBox.Show(path);
- }
- //private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- //{
- // TextBoxServerListenPort.Text = GetRandomPort();
- //}
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
- private void RadioButtonTrojanTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = uuid.ToString();
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- //Random random = new Random();
- //int randomServerPort = random.Next(10000, 50000);
- //TextBoxServerListenPort.Text = "443";
- }
- private void RadioButtonTrojanGoWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = uuid.ToString();
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- ButtonPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/trojan";
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- private void CheckBoxMuxSelect_Checked(object sender, RoutedEventArgs e)
- {
- GridTrojanGoMuxSelected.Visibility = Visibility.Visible;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Visible;
- }
-
- private void CheckBoxMuxSelect_Unchecked(object sender, RoutedEventArgs e)
- {
- GridTrojanGoMuxSelected.Visibility = Visibility.Collapsed;
- TextBlockExplainCheckBoxMuxSelect.Visibility = Visibility.Collapsed;
- }
-
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
-
- //处理伪装网站域名中的前缀
- //private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
- //return fakeUrl;
- // }
- }
-}
diff --git a/ProxySU/V2RayTemplateWindow.xaml b/ProxySU/V2RayTemplateWindow.xaml
deleted file mode 100644
index a3e0577..0000000
--- a/ProxySU/V2RayTemplateWindow.xaml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/V2RayTemplateWindow.xaml.cs b/ProxySU/V2RayTemplateWindow.xaml.cs
deleted file mode 100644
index 0b171a6..0000000
--- a/ProxySU/V2RayTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,1146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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;
-//using System.Windows.Forms;
-
-namespace ProxySU
-{
- ///
- /// WindowTemplateConfiguration.xaml 的交互逻辑
- ///
- public partial class WindowTemplateConfiguration : Window
- {
- //QUIC 加密方法
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
-
- public WindowTemplateConfiguration()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-poly1305", Value = "chacha20-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "none", Value = "none" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
-
- //隐藏QUIC密钥
- FirstQuicHideEncryption();
- RadioButtonVMESSmKCP.IsChecked = true;
- }
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
- //传递所选择的参数与模板方案
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
-
- #region TCP 传输协议(VMESS)
-
- //TCP模式被选中
- if (RadioButtonTCP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP.Content.ToString();
-
- }
-
- //TCP+http伪装模式被选中
- else if (RadioButtonTCPhttp.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCPhttp.Content.ToString();
- //伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "http";
-
- }
-
- //TCP+TLS模式被选中
- else if (RadioButtonTCP2TLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP2TLS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //tcp+TLS(自签证书)模式被选中
- else if (RadioButtonTcpTLS2SelfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTcpTLS2SelfSigned.Content.ToString();
-
- //传递域名
- // MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region VLESS协议
-
- //VLESS+TCP+XTLS+Web模式选中
- else if (RadioButtonVlessXtlsTcp.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessXtlsTcp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessXtlsTcp.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+TCP+TLS+Web模式选中
- else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessTcpTlsWeb.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+WebSocket+TLS+Web模式选中
- else if (RadioButtonVlessWebSocketTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessWebSocketTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessWebSocketTlsWeb.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+http2+TLS+Web模式选中
- else if (RadioButtonVlessHttp2Web.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessHttp2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessHttp2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web模式被选中
- else if (RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessVmessXtlsTcpWebSocketWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessVmessXtlsTcpWebSocketHot.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxPathVlessWS.Text);//VLESS ws Path
- MainWindow.ReceiveConfigurationParameters[9] = PreTrim(TextBoxPathVmessTcp.Text);//VMESS tcp Path
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPathVmessWS.Text);//VMESS ws Path
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递混淆方式(VMESS TCP Path方式所用)
- MainWindow.ReceiveConfigurationParameters[5] = "http";
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- #endregion
-
- #region WebSocket传输协议(VMESS)
-
- //webSocket模式被选中
- else if (RadioButtonWebSocket.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "webSocket";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocket.Content.ToString();
-
- }
-
- //WebSocket+TLS模式被选中
- else if (RadioButtonWebSocketTLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLS2Web.IsChecked == true|| RadioButtonWebSocketTLS2WebHot.IsChecked==true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //WebSocket+TLS(自签证书)模式被选中
- else if (RadioButtonWebSocketTLSselfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSselfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region http2传输协议(VMESS)
-
- //http2模式被选中
- else if (RadioButtonHTTP2.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Http2";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //http2+TLS+Web模式被选中
- else if (RadioButtonHTTP2Web.IsChecked == true || RadioButtonHTTP2WebHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //http2(自签证书)模式被选中
- else if (RadioButtonHTTP2selfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2selfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2selfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region mKCP 传输协议 (VMESS)
-
- //mKCP无伪装模式被选中
- else if (RadioButtonMkcpNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonMkcpNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) ==false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+srtp伪装模式被选中
- else if (RadioButton2mKCP2SRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2SRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+utp伪装模式被选中
- else if (RadioButton2mKCPuTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCPuTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wechat-video伪装模式被选中
- else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+dtls伪装模式被选中
- else if (RadioButton2mKCP2DTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2DTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wireguard伪装模式被选中
- else if (RadioButton2mKCP2WireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- #endregion
-
- #region QUIC传输协议(VMESS)
-
- //QUIC无伪装模式被选中
- else if (RadioButtonQuicNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+srtp伪装模式被选中
- else if (RadioButtonQuicSRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+utp伪装模式被选中
- else if (RadioButtonQuic2uTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Quic2uTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuic2uTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wechat-video伪装模式被选中
- else if (RadioButtonQuicWechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+dtls伪装模式被选中
- else if (RadioButtonQuicDTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicDTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicDTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wireguard伪装模式被选中
- else if (RadioButtonQuicWireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- #endregion
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPort.Text);
- //传递uuid
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
-
- if (RadioButtonVLESSmKCP.IsChecked == true)
- {
- MainWindow.mKCPvlessIsSet = true;
- }
- else
- {
- MainWindow.mKCPvlessIsSet = false;
- }
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- //取消选择返回主窗口
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- //伪装网站处理
- //DisguiseURLprocessing(string fakeUrl);
- // private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //Console.WriteLine(uri.Host);
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
-
- //}
-
- #region 其他设置中的界面控制
-
- private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "80";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCP2TLS_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessTcpTlsWeb_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessVmessXtlsTcpWebSocketHot_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示复合路径
- ShowVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //生成UUID
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //单击TextBlockVlessVmessXtlsTcpWebSocket标签则选中RadioButtonVlessVmessXtlsTcpWebSocketHot
- private void TextBlockVlessVmessXtlsTcpWebSocket_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked = true;
- }
- private void RadioButtonTCP2TLSnoDomain_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLSselfSigned_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //mKCP显示界面
- private void RadioButtonMkcp_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏QUIC密钥
- HideQuic();
-
- //显示mKCP Seed
- ShowMkcpSeed();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //QUIC显示界面
- private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //显示QUIC密钥
- ShowQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
-
- //隐藏QUIC相关项
- private void HideQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- //TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //如果加密方法选择none,则隐藏只QUIC密钥
- private void NoneEncryptionHideQuicKey()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- }
- //窗口初始化时,需要做一次隐藏QUIC加密方法
- private void FirstQuicHideEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- }
- //显示QUIC相关项
- private void ShowQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Visible;
-
- //隐藏mKCP相关项
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏mKCP Seed相关项
- private void HideMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
-
- }
- //显示mKCP Seed相关项
- private void ShowMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockMkcpUUID.Visibility = Visibility.Visible;
- //隐藏QUIC标示
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏路径相关项
- private void HidePath()
- {
- //隐藏Path
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- }
- //显示路径相关项
- private void ShowPath()
- {
- HideVlessVmessMultiplePath();//隐藏VLESS VMESS多种方案的路径Path
- //显示Path
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/ray";
- ButtonPath.Visibility = Visibility.Visible;
- }
- //隐藏VLESS VMESS复合方案路径
- private void HideVlessVmessMultiplePath()
- {
- TextBlockPathVlessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVlessWS.Visibility = Visibility.Collapsed;
- TextBlockPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBoxPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBlockPathVmessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVmessWS.Visibility = Visibility.Collapsed;
- ButtonVlessVmessPath.Visibility = Visibility.Collapsed;
- TextBlockTrojanPassword.Visibility = Visibility.Collapsed;
-
- }
- //显示VLESS VMESS复合方案路径
- private void ShowVlessVmessMultiplePath()
- {
- HidePath();//隐藏普通路径Path
- TextBlockPathVlessWs.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Text = "/vlessws";
-
- TextBlockPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Text = "/vmesstcp";
-
- TextBlockPathVmessWs.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Text = "/vmessws";
-
- ButtonVlessVmessPath.Visibility = Visibility.Visible;
- TextBlockTrojanPassword.Visibility = Visibility.Visible;
- }
- //隐藏域名相关项
- private void HideDomain()
- {
- //隐藏域名
- TextBlockDomain.Visibility = Visibility.Collapsed;
- TextBoxDomain.Visibility = Visibility.Collapsed;
- ButtonDomain.Visibility = Visibility.Collapsed;
- }
- //显示域名相关项
- private void ShowDomain()
- {
- //显示域名
- TextBlockDomain.Visibility = Visibility.Visible;
- TextBoxDomain.Visibility = Visibility.Visible;
- //ButtonDomain.Visibility = Visibility.Visible;
- }
- //隐藏伪装网站
- private void HideMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
- }
- //显示伪装网站
- private void ShowMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
- }
- #endregion
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
-
- //产生QUIC密钥/mKCP Seed所用的UUID
- private void ButtonQuicAndMkcpSeedUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
- }
-
- //更新随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- }
-
- //更新单方案随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- }
-
- //更新多方案共存的Path
- private void ButtonVlessVmessPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPathVlessWS.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessTcp.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessWS.Text = $"/{path}";
- }
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string getMethond = GetEncryptionMethodSS();
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = getMethond;
- if (String.Equals(getMethond,"none"))
- {
- NoneEncryptionHideQuicKey();
- }
- else
- {
- ShowQuic();
- }
-
- }
-
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- private void ButtonDomain_Click(object sender, RoutedEventArgs e)
- {
-
- }
-
-
-
-
-
-
-
-
-
- //private void ButtonTestChecked_Click(object sender, RoutedEventArgs e)
- //{
- // UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
-
- //}
- }
-}
diff --git a/ProxySU/XayTemplateWindow.xaml b/ProxySU/XayTemplateWindow.xaml
deleted file mode 100644
index 0daad4e..0000000
--- a/ProxySU/XayTemplateWindow.xaml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU/XayTemplateWindow.xaml.cs b/ProxySU/XayTemplateWindow.xaml.cs
deleted file mode 100644
index 1079966..0000000
--- a/ProxySU/XayTemplateWindow.xaml.cs
+++ /dev/null
@@ -1,1146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-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;
-//using System.Windows.Forms;
-
-namespace ProxySU
-{
- ///
- /// WindowTemplateConfiguration.xaml 的交互逻辑
- ///
- public partial class XrayWindowTemplateConfiguration : Window
- {
- //QUIC 加密方法
- public class EncryptionMethodInfo
- {
- public string Name { get; set; }
- public string Value { get; set; }
- }
-
- public XrayWindowTemplateConfiguration()
- {
- InitializeComponent();
-
- #region 加密方法选择 初始设置为chacha20-poly1305
- List methodList = new List();
-
- methodList.Add(new EncryptionMethodInfo { Name = "chacha20-poly1305", Value = "chacha20-poly1305" });
- methodList.Add(new EncryptionMethodInfo { Name = "aes-128-gcm", Value = "aes-128-gcm" });
- methodList.Add(new EncryptionMethodInfo { Name = "none", Value = "none" });
-
- ComboBoxEncryptionMethodInfo.ItemsSource = methodList;
-
- ComboBoxEncryptionMethodInfo.DisplayMemberPath = "Name";//显示出来的值
- ComboBoxEncryptionMethodInfo.SelectedValuePath = "Value";//实际选中后获取的结果的值
- ComboBoxEncryptionMethodInfo.SelectedIndex = 0;
-
- DataContext = this;
- #endregion
-
- //隐藏QUIC密钥
- FirstQuicHideEncryption();
- RadioButtonVMESSmKCP.IsChecked = true;
- }
- //取消不在当前活动选项卡中的其他所有选项卡中的所有RadioBuuton的选中状态
- //代码参考网址:https://blog.csdn.net/weixin_42583999/article/details/103468857
- //调用:UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- private void UncheckLayouts(TabItem activePage)
- {
- foreach (TabItem tabPage in TabControlTemplate.Items)
- {
- if (tabPage == activePage) continue;
- Grid grid = (Grid)tabPage.Content;
- foreach (UIElement element in grid.Children)
- {
- if (element is RadioButton)
- {
- RadioButton radiobutton = (element as RadioButton);
- radiobutton.IsChecked = false;
- }
-
- }
- }
- }
-
- //传递所选择的参数与模板方案
- private void ButtondDecide_Click(object sender, RoutedEventArgs e)
- {
- bool preDomainMask = ClassModel.PreDomainMask(TextBoxMaskSites.Text);
- bool domainNotEmpty = true;
-
- #region TCP 传输协议(VMESS)
-
- //TCP模式被选中
- if (RadioButtonTCP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP.Content.ToString();
-
- }
-
- //TCP+http伪装模式被选中
- else if (RadioButtonTCPhttp.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCPhttp.Content.ToString();
- //伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "http";
-
- }
-
- //TCP+TLS模式被选中
- else if (RadioButtonTCP2TLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTCP2TLS.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //tcp+TLS(自签证书)模式被选中
- else if (RadioButtonTcpTLS2SelfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "tcpTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonTcpTLS2SelfSigned.Content.ToString();
-
- //传递域名
- // MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region VLESS协议
-
- //VLESS+TCP+XTLS+Web模式选中
- else if (RadioButtonVlessXtlsTcp.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessXtlsTcp";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessXtlsTcp.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+TCP+TLS+Web模式选中
- else if (RadioButtonVlessTcpTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessTcpTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessTcpTlsWeb.Content.ToString();
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //VLESS+WebSocket+TLS+Web模式选中
- else if (RadioButtonVlessWebSocketTlsWeb.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessWebSocketTlsWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessWebSocketTlsWeb.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+http2+TLS+Web模式选中
- else if (RadioButtonVlessHttp2Web.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessHttp2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessHttp2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
- }
-
- //VLESS+VMESS+Trojan+XTLS+TCP+WebSocket+Web模式被选中
- else if (RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "VlessVmessXtlsTcpWebSocketWeb";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonVlessVmessXtlsTcpWebSocketHot.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[3] = PreTrim(TextBoxPathVlessWS.Text);//VLESS ws Path
- MainWindow.ReceiveConfigurationParameters[9] = PreTrim(TextBoxPathVmessTcp.Text);//VMESS tcp Path
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPathVmessWS.Text);//VMESS ws Path
-
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递混淆方式(VMESS TCP Path方式所用)
- MainWindow.ReceiveConfigurationParameters[5] = "http";
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- #endregion
-
- #region WebSocket传输协议(VMESS)
-
- //webSocket模式被选中
- else if (RadioButtonWebSocket.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "webSocket";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocket.Content.ToString();
-
- }
-
- //WebSocket+TLS模式被选中
- else if (RadioButtonWebSocketTLS.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS.Content.ToString();
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //WebSocket+TLS+Web模式被选中
- else if (RadioButtonWebSocketTLS2Web.IsChecked == true|| RadioButtonWebSocketTLS2WebHot.IsChecked==true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLS2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //WebSocket+TLS(自签证书)模式被选中
- else if (RadioButtonWebSocketTLSselfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLSselfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonWebSocketTLSselfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region http2传输协议(VMESS)
-
- //http2模式被选中
- else if (RadioButtonHTTP2.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Http2";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- //http2+TLS+Web模式被选中
- else if (RadioButtonHTTP2Web.IsChecked == true || RadioButtonHTTP2WebHot.IsChecked == true)
- {
- domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxDomain.Text);
-
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2Web.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
- //传递伪装网站
- MainWindow.ReceiveConfigurationParameters[7] = ClassModel.DisguiseURLprocessing(PreTrim(TextBoxMaskSites.Text));
-
- }
-
- //http2(自签证书)模式被选中
- else if (RadioButtonHTTP2selfSigned.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "http2selfSigned";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonHTTP2selfSigned.Content.ToString();
-
- //传递路径
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxPath.Text);
- //传递域名
- //MainWindow.ReceiveConfigurationParameters[4] = PreTrim(TextBoxDomain.Text);
-
- }
-
- #endregion
-
- #region mKCP 传输协议 (VMESS)
-
- //mKCP无伪装模式被选中
- else if (RadioButtonMkcpNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonMkcpNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) ==false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+srtp伪装模式被选中
- else if (RadioButton2mKCP2SRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2SRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+utp伪装模式被选中
- else if (RadioButton2mKCPuTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCPuTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wechat-video伪装模式被选中
- else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+dtls伪装模式被选中
- else if (RadioButton2mKCP2DTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2DTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- //mKCP+wireguard伪装模式被选中
- else if (RadioButton2mKCP2WireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButton2mKCP2WireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //传递mKCP Seed
- if (String.IsNullOrEmpty(PreTrim(TextBoxQuicAndMkcpSeedUUID.Text)) == false)
- {
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- }
- }
-
- #endregion
-
- #region QUIC传输协议(VMESS)
-
- //QUIC无伪装模式被选中
- else if (RadioButtonQuicNone.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicNone";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicNone.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "none";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+srtp伪装模式被选中
- else if (RadioButtonQuicSRTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicSRTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicSRTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "srtp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+utp伪装模式被选中
- else if (RadioButtonQuic2uTP.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "Quic2uTP";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuic2uTP.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "utp";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wechat-video伪装模式被选中
- else if (RadioButtonQuicWechatVideo.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWechatVideo";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWechatVideo.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+dtls伪装模式被选中
- else if (RadioButtonQuicDTLS.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicDTLS";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicDTLS.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "dtls";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- //QUIC+wireguard伪装模式被选中
- else if (RadioButtonQuicWireGuard.IsChecked == true)
- {
- //传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "QuicWireGuard";
- //传递方案名称
- MainWindow.ReceiveConfigurationParameters[8] = RadioButtonQuicWireGuard.Content.ToString();
- //传递伪装类型
- MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
- //QUIC 密钥
- MainWindow.ReceiveConfigurationParameters[6] = PreTrim(TextBoxQuicAndMkcpSeedUUID.Text);
- //QUIC加密方法
- MainWindow.ReceiveConfigurationParameters[3] = GetEncryptionMethodSS();
- }
-
- #endregion
-
- //传递服务端口
- MainWindow.ReceiveConfigurationParameters[1] = PreTrim(TextBoxServerListenPort.Text);
- //传递uuid
- MainWindow.ReceiveConfigurationParameters[2] = PreTrim(TextBoxNewUUID.Text);
-
- if (RadioButtonVLESSmKCP.IsChecked == true)
- {
- MainWindow.mKCPvlessIsSet = true;
- }
- else
- {
- MainWindow.mKCPvlessIsSet = false;
- }
-
- if (domainNotEmpty == true && preDomainMask == true)
- {
- this.Close();
- }
-
- }
-
- //取消选择返回主窗口
- private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
-
-
- //伪装网站处理
- //DisguiseURLprocessing(string fakeUrl);
- // private string DisguiseURLprocessing(string fakeUrl)
- //{
- //var uri = new Uri(fakeUrl);
- //return uri.Host;
- //Console.WriteLine(uri.Host);
-
- ////处理伪装网站域名中的前缀
- //if (fakeUrl.Length >= 7)
- //{
- // string testDomainMask = fakeUrl.Substring(0, 7);
- // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://"))
- // {
- // string[] tmpUrl = fakeUrl.Split('/');
- // fakeUrl = tmpUrl[2];
- // }
-
- //}
-
- //}
-
- #region 其他设置中的界面控制
-
- private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "80";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonTCP2TLS_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessTcpTlsWeb_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonVlessVmessXtlsTcpWebSocketHot_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示复合路径
- ShowVlessVmessMultiplePath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //生成UUID
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- //单击TextBlockVlessVmessXtlsTcpWebSocket标签则选中RadioButtonVlessVmessXtlsTcpWebSocketHot
- private void TextBlockVlessVmessXtlsTcpWebSocket_MouseDown(object sender, MouseButtonEventArgs e)
- {
- RadioButtonVlessVmessXtlsTcpWebSocketHot.IsChecked = true;
- }
- private void RadioButtonTCP2TLSnoDomain_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //显示伪装网站
- ShowMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonWebSocketTLSselfSigned_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
- private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
- {
- TextBoxServerListenPort.Text = "443";
-
- //隐藏mKCP项
- HideMkcpSeed();
-
- //隐藏QUIC密钥
- HideQuic();
-
- //显示Path
- ShowPath();
-
- //显示域名
- ShowDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //mKCP显示界面
- private void RadioButtonMkcp_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏QUIC密钥
- HideQuic();
-
- //显示mKCP Seed
- ShowMkcpSeed();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
- //QUIC显示界面
- private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e)
- {
- //隐藏mKCP项
- HideMkcpSeed();
-
- //显示QUIC密钥
- ShowQuic();
-
- //隐藏Path
- HidePath();
- HideVlessVmessMultiplePath();
-
- //隐藏域名
- HideDomain();
-
- //隐藏伪装网站
- HideMaskSites();
-
- //Guid uuid = Guid.NewGuid();
- TextBoxNewUUID.Text = GenerateRandomUUID();
-
- //uuid = Guid.NewGuid();
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
-
- //Random random = new Random();
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- //清除其他选项卡中的选项
- UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
- }
-
-
- //隐藏QUIC相关项
- private void HideQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- //TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //如果加密方法选择none,则隐藏只QUIC密钥
- private void NoneEncryptionHideQuicKey()
- {
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- }
- //窗口初始化时,需要做一次隐藏QUIC加密方法
- private void FirstQuicHideEncryption()
- {
- TextBlockQuicEncryption.Visibility = Visibility.Collapsed;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Collapsed;
- }
- //显示QUIC相关项
- private void ShowQuic()
- {
- TextBlockQuicUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockQuicEncryption.Visibility = Visibility.Visible;
- ComboBoxEncryptionMethodInfo.Visibility = Visibility.Visible;
-
- //隐藏mKCP相关项
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏mKCP Seed相关项
- private void HideMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Collapsed;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Collapsed;
- TextBlockMkcpUUID.Visibility = Visibility.Collapsed;
-
- }
- //显示mKCP Seed相关项
- private void ShowMkcpSeed()
- {
- TextBlockMkcpSeedUUID.Visibility = Visibility.Visible;
- TextBoxQuicAndMkcpSeedUUID.Visibility = Visibility.Visible;
- ButtonQuicAndmKcpSeedUUID.Visibility = Visibility.Visible;
- TextBlockMkcpUUID.Visibility = Visibility.Visible;
- //隐藏QUIC标示
- TextBlockQuicUUID.Visibility = Visibility.Collapsed;
- }
- //隐藏路径相关项
- private void HidePath()
- {
- //隐藏Path
- TextBlockPath.Visibility = Visibility.Collapsed;
- TextBoxPath.Visibility = Visibility.Collapsed;
- ButtonPath.Visibility = Visibility.Collapsed;
- }
- //显示路径相关项
- private void ShowPath()
- {
- HideVlessVmessMultiplePath();//隐藏VLESS VMESS多种方案的路径Path
- //显示Path
- TextBlockPath.Visibility = Visibility.Visible;
- TextBoxPath.Visibility = Visibility.Visible;
- TextBoxPath.Text = "/ray";
- ButtonPath.Visibility = Visibility.Visible;
- }
- //隐藏VLESS VMESS复合方案路径
- private void HideVlessVmessMultiplePath()
- {
- TextBlockPathVlessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVlessWS.Visibility = Visibility.Collapsed;
- TextBlockPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBoxPathVmessTcp.Visibility = Visibility.Collapsed;
- TextBlockPathVmessWs.Visibility = Visibility.Collapsed;
- TextBoxPathVmessWS.Visibility = Visibility.Collapsed;
- ButtonVlessVmessPath.Visibility = Visibility.Collapsed;
- TextBlockTrojanPassword.Visibility = Visibility.Collapsed;
-
- }
- //显示VLESS VMESS复合方案路径
- private void ShowVlessVmessMultiplePath()
- {
- HidePath();//隐藏普通路径Path
- TextBlockPathVlessWs.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Visibility = Visibility.Visible;
- TextBoxPathVlessWS.Text = "/vlessws";
-
- TextBlockPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Visibility = Visibility.Visible;
- TextBoxPathVmessTcp.Text = "/vmesstcp";
-
- TextBlockPathVmessWs.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Visibility = Visibility.Visible;
- TextBoxPathVmessWS.Text = "/vmessws";
-
- ButtonVlessVmessPath.Visibility = Visibility.Visible;
- TextBlockTrojanPassword.Visibility = Visibility.Visible;
- }
- //隐藏域名相关项
- private void HideDomain()
- {
- //隐藏域名
- TextBlockDomain.Visibility = Visibility.Collapsed;
- TextBoxDomain.Visibility = Visibility.Collapsed;
- ButtonDomain.Visibility = Visibility.Collapsed;
- }
- //显示域名相关项
- private void ShowDomain()
- {
- //显示域名
- TextBlockDomain.Visibility = Visibility.Visible;
- TextBoxDomain.Visibility = Visibility.Visible;
- //ButtonDomain.Visibility = Visibility.Visible;
- }
- //隐藏伪装网站
- private void HideMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Collapsed;
- TextBoxMaskSites.Visibility = Visibility.Collapsed;
- }
- //显示伪装网站
- private void ShowMaskSites()
- {
- TextBlockMaskSites.Visibility = Visibility.Visible;
- TextBoxMaskSites.Visibility = Visibility.Visible;
- }
- #endregion
-
- //产生随机的uuid
- private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxNewUUID.Text = GenerateRandomUUID();
- }
-
- //产生QUIC密钥/mKCP Seed所用的UUID
- private void ButtonQuicAndMkcpSeedUUID_Click(object sender, RoutedEventArgs e)
- {
- TextBoxQuicAndMkcpSeedUUID.Text = GenerateRandomUUID();
- }
-
- //更新随机服务端口
- private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
- {
- int randomServerPort = GetRandomPort();
- TextBoxServerListenPort.Text = randomServerPort.ToString();
- }
-
- //更新单方案随机的Path
- private void ButtonPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPath.Text = $"/{path}";
- }
-
- //更新多方案共存的Path
- private void ButtonVlessVmessPath_Click(object sender, RoutedEventArgs e)
- {
- string path = GenerateRandomPath();
- TextBoxPathVlessWS.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessTcp.Text = $"/{path}";
-
- path = GenerateRandomPath();
- TextBoxPathVmessWS.Text = $"/{path}";
- }
- //TextBox输入内容做预处理
- private string PreTrim(string preString)
- {
- return preString.Trim();
- }
- //生成随机端口
- private int GetRandomPort()
- {
- Random random = new Random();
- return random.Next(10001, 60000);
- }
-
- //生成随机UUID
- private string GenerateRandomUUID()
- {
- Guid uuid = Guid.NewGuid();
- return uuid.ToString();
- }
-
- //生成随机Path
- private string GenerateRandomPath()
- {
- Random random = new Random();
- int randomSerialNum = random.Next(0, 4);
- //Guid uuid = Guid.NewGuid();
- string uuid = GenerateRandomUUID();
- string[] pathArray = uuid.Split('-');
- string path = pathArray[randomSerialNum];
- return path;
- }
- //域名检测是否为空
- //private bool TestDomainIsEmpty()
- //{
- // if (string.IsNullOrEmpty(PreTrim(TextBoxDomain.Text)) == true)
- // {
- // //****** "域名不能为空,请检查相关参数设置!" ******
- // MessageBox.Show(Application.Current.FindResource("MessageBoxShow_DomainNotEmpty").ToString());
- // return false;
- // }
- // else
- // {
- // return true;
- // }
- //}
-
- //加密方法更改后的动作
- private void ComboBoxEncryptionMethodInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- string getMethond = GetEncryptionMethodSS();
- //传递加密方式
- MainWindow.ReceiveConfigurationParameters[3] = getMethond;
- if (String.Equals(getMethond,"none"))
- {
- NoneEncryptionHideQuicKey();
- }
- else
- {
- ShowQuic();
- }
-
- }
-
- //读取加密方式
- private string GetEncryptionMethodSS()
- {
- return ComboBoxEncryptionMethodInfo.SelectedValue.ToString();
- }
- private void ButtonDomain_Click(object sender, RoutedEventArgs e)
- {
-
- }
-
-
-
-
-
-
-
-
-
- //private void ButtonTestChecked_Click(object sender, RoutedEventArgs e)
- //{
- // UncheckLayouts((TabItem)TabControlTemplate.SelectedItem);
-
- //}
- }
-}
diff --git a/ProxySU/bin/Beta/Beta.zip b/ProxySU/bin/Beta/Beta.zip
deleted file mode 100644
index 500116a..0000000
Binary files a/ProxySU/bin/Beta/Beta.zip and /dev/null differ
diff --git a/ProxySU/packages.config b/ProxySU/packages.config
deleted file mode 100644
index cd7f780..0000000
--- a/ProxySU/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/App.config b/ProxySU_Core/App.config
deleted file mode 100644
index 824190f..0000000
--- a/ProxySU_Core/App.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/App.xaml b/ProxySU_Core/App.xaml
deleted file mode 100644
index d59fcda..0000000
--- a/ProxySU_Core/App.xaml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/App.xaml.cs b/ProxySU_Core/App.xaml.cs
deleted file mode 100644
index 2ccb782..0000000
--- a/ProxySU_Core/App.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace ProxySU_Core
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-}
diff --git a/ProxySU_Core/AssemblyInfo.cs b/ProxySU_Core/AssemblyInfo.cs
deleted file mode 100644
index 8b5504e..0000000
--- a/ProxySU_Core/AssemblyInfo.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Windows;
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
diff --git a/ProxySU_Core/Common/Base64.cs b/ProxySU_Core/Common/Base64.cs
deleted file mode 100644
index 0a61841..0000000
--- a/ProxySU_Core/Common/Base64.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Common
-{
- public class Base64
- {
- public static string Encode(string plainText)
- {
- var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
- return System.Convert.ToBase64String(plainTextBytes);
- }
-
- public static string Decode(string base64EncodedData)
- {
- var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
- return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
- }
- }
-}
diff --git a/ProxySU_Core/Converters/LoginSecretTypeConverter.cs b/ProxySU_Core/Converters/LoginSecretTypeConverter.cs
deleted file mode 100644
index be26ed8..0000000
--- a/ProxySU_Core/Converters/LoginSecretTypeConverter.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Text;
-using System.Windows.Data;
-
-namespace ProxySU_Core.Converters
-{
- public class LoginSecretTypeConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value != null && value.Equals(parameter);
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return Binding.DoNothing;
- }
-
- if (!value.Equals(true))
- {
- return Binding.DoNothing;
- }
-
- return parameter;
-
- }
- }
-}
diff --git a/ProxySU_Core/Converters/ProxyTypeConverter.cs b/ProxySU_Core/Converters/ProxyTypeConverter.cs
deleted file mode 100644
index 771cb62..0000000
--- a/ProxySU_Core/Converters/ProxyTypeConverter.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Text;
-using System.Windows.Data;
-
-namespace ProxySU_Core.Converters
-{
- public class ProxyTypeConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value != null && value.Equals(parameter);
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return Binding.DoNothing;
- }
-
- if (!value.Equals(true))
- {
- return Binding.DoNothing;
- }
-
- return parameter;
- }
- }
-}
diff --git a/ProxySU_Core/Converters/VisibleConverter.cs b/ProxySU_Core/Converters/VisibleConverter.cs
deleted file mode 100644
index f52a08d..0000000
--- a/ProxySU_Core/Converters/VisibleConverter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Data;
-
-namespace ProxySU_Core.Converters
-{
- public class VisibleConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value.Equals(true) ? Visibility.Visible : Visibility.Collapsed;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return false;
- }
-
- if (value.Equals(Visibility.Visible))
- {
- return true;
- }
-
- return false;
- }
- }
-}
diff --git a/ProxySU_Core/Models/AppSettings.cs b/ProxySU_Core/Models/AppSettings.cs
deleted file mode 100644
index 0b42488..0000000
--- a/ProxySU_Core/Models/AppSettings.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Models
-{
- public class AppSettings
- {
- public string Language { get; set; }
- }
-}
diff --git a/ProxySU_Core/Models/Developers/IParameters.cs b/ProxySU_Core/Models/Developers/IParameters.cs
deleted file mode 100644
index f80f33a..0000000
--- a/ProxySU_Core/Models/Developers/IParameters.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ProxySU_Core.Models.Developers
-{
- public interface IParameters
- {
- int Port { get; set; }
-
- string Domain { get; set; }
-
- List FreePorts { get; }
- }
-}
diff --git a/ProxySU_Core/Models/Developers/Project.cs b/ProxySU_Core/Models/Developers/Project.cs
deleted file mode 100644
index 5aaa233..0000000
--- a/ProxySU_Core/Models/Developers/Project.cs
+++ /dev/null
@@ -1,740 +0,0 @@
-using ProxySU_Core.Tools;
-using ProxySU_Core.ViewModels;
-using Renci.SshNet;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace ProxySU_Core.Models.Developers
-{
- public enum CmdType
- {
- None,
- Apt,
- Dnf,
- Yum
- }
-
- public abstract class Project : BaseViewModel where TParameters : IParameters
- {
- private SshClient _sshClient;
-
- protected Action WriteOutput;
-
- protected CmdType CmdType { get; set; }
-
- protected bool IsSELinux { get; set; }
-
- protected bool OnlyIpv6 { get; set; }
-
- protected string IPv4 { get; set; }
-
- protected string IPv6 { get; set; }
-
- protected TParameters Parameters { get; set; }
-
- public Project(SshClient sshClient, TParameters parameters, Action writeOutput)
- {
- _sshClient = sshClient;
- WriteOutput = writeOutput;
- Parameters = parameters;
- }
-
- protected string RunCmd(string cmdStr)
- {
- var cmd = _sshClient.CreateCommand(cmdStr);
- WriteOutput(cmdStr);
-
- var result = cmd.Execute();
- WriteOutput(result);
- return result;
- }
-
- ///
- /// 执行安装命令
- ///
- public abstract void Install();
-
- ///
- /// 配置系统基础环境
- ///
- protected void EnsureSystemEnv()
- {
- string cmd;
-
- // 确认安装命令
- if (CmdType == CmdType.None)
- {
- cmd = RunCmd("command -v apt-get");
- if (!string.IsNullOrEmpty(cmd))
- {
- CmdType = CmdType.Apt;
- }
- }
-
- if (CmdType == CmdType.None)
- {
- cmd = RunCmd("command -v dnf");
- if (!string.IsNullOrEmpty(cmd))
- {
- CmdType = CmdType.Dnf;
- }
- }
-
- if (CmdType == CmdType.None)
- {
- cmd = RunCmd("command -v yum");
- if (!string.IsNullOrEmpty(cmd))
- {
- CmdType = CmdType.Yum;
- }
- }
-
- // systemctl
- cmd = RunCmd("command -v systemctl");
- var hasSystemCtl = !string.IsNullOrEmpty(cmd);
-
- // SELinux
- cmd = RunCmd("command -v getenforce");
- IsSELinux = !string.IsNullOrEmpty(cmd);
-
- if (CmdType == CmdType.None || !hasSystemCtl)
- {
- throw new Exception("系统缺乏必要的安装组件如:apt-get||dnf||yum||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本");
- }
-
-
- // 判断是否启用了SELinux,如果启用了,并且工作在Enforcing模式下,则改为Permissive模式
- if (IsSELinux)
- {
- cmd = RunCmd("getenforce");
-
- // 检测到系统启用SELinux,且工作在严格模式下,需改为宽松模式
- if (cmd.Contains("Enforcing"))
- {
- RunCmd("setenforce 0");
- RunCmd(@"sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config");
- }
- }
- }
-
- ///
- /// 确保Root账户登陆
- ///
- protected void EnsureRootAuth()
- {
- // 禁止一些可能产生的干扰信息
- RunCmd(@"sed -i 's/echo/#echo/g' ~/.bashrc");
- RunCmd(@"sed -i 's/echo/#echo/g' ~/.profile");
-
-
- // 检测是否运行在Root权限下
- var cmd = RunCmd("id -u");
- if (!cmd.Equals("0\n"))
- {
- throw new Exception("请使用Root账户登陆主机");
- }
- }
-
- ///
- /// 配置IPV6环境
- ///
- protected void ConfigureIPv6()
- {
- if (IsOnlyIpv6())
- {
- SetNat64();
- }
- }
-
- ///
- /// 配置必要的软件
- ///
- protected void ConfigureSoftware()
- {
- string cmd = RunCmd("command -v sudo");
- if (string.IsNullOrEmpty(cmd))
- {
- RunCmd(GetInstallCmd("sudo"));
- }
-
- // 安装curl,wget,unzip
- cmd = RunCmd("command -v curl");
- if (string.IsNullOrEmpty(cmd))
- {
- RunCmd(GetInstallCmd("curl"));
- }
-
- cmd = RunCmd("command -v wget");
- if (string.IsNullOrEmpty(cmd))
- {
- RunCmd(GetInstallCmd("wget"));
- }
-
- cmd = RunCmd("command -v unzip");
- if (string.IsNullOrEmpty(cmd))
- {
- RunCmd(GetInstallCmd("unzip"));
- }
-
- // 安装dig
- cmd = RunCmd("command -v dig");
- if (string.IsNullOrEmpty(cmd))
- {
- if (CmdType == CmdType.Apt)
- {
- RunCmd(GetUpdateCmd());
- RunCmd(GetInstallCmd("dnsutils"));
- }
- else if (CmdType == CmdType.Dnf)
- {
- RunCmd(GetUpdateCmd());
- RunCmd(GetInstallCmd("bind-utils"));
- }
- else if (CmdType == CmdType.Yum)
- {
- RunCmd(GetUpdateCmd());
- RunCmd(GetInstallCmd("bind-utils"));
- }
- }
-
-
- // 处理极其少见的xz-utils未安装的情况
- if (CmdType == CmdType.Apt)
- {
- RunCmd(GetInstallCmd("xz-utils"));
- }
- else
- {
- RunCmd(GetInstallCmd("xz-devel"));
- }
-
- // 检测是否安装lsof
- cmd = RunCmd("command -v lsof");
- if (string.IsNullOrEmpty(cmd))
- {
- RunCmd(GetInstallCmd("lsof"));
- }
- }
-
- protected void ClosePort(params int[] portList)
- {
- string cmd;
-
- cmd = RunCmd("command -v firewall-cmd");
- if (!string.IsNullOrEmpty(cmd))
- {
- //有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
- //用于保证acme.sh申请证书成功
- cmd = RunCmd("firewall-cmd --state");
- if (cmd.Trim() != "running")
- {
- RunCmd("systemctl restart firewalld");
- }
-
- foreach (var port in portList)
- {
- RunCmd($"firewall-cmd --zone=public --remove-port={port}/tcp --permanent");
- RunCmd($"firewall-cmd --zone=public --remove-port={port}/udp --permanent");
- }
- RunCmd("yes | firewall-cmd --reload");
- }
- else
- {
- cmd = RunCmd("command -v ufw");
- if (!string.IsNullOrEmpty(cmd))
- {
- foreach (var port in portList)
- {
- RunCmd($"ufw delete allow {port}/tcp");
- RunCmd($"ufw delete allow {port}/udp");
- }
- RunCmd("yes | ufw reload");
- }
- }
- }
-
- protected void OpenPort(params int[] portList)
- {
-
- string cmd;
-
- cmd = RunCmd("command -v firewall-cmd");
- if (!string.IsNullOrEmpty(cmd))
- {
- //有很奇怪的vps主机,在firewalld未运行时,端口是关闭的,无法访问。所以要先启动firewalld
- //用于保证acme.sh申请证书成功
- cmd = RunCmd("firewall-cmd --state");
- if (cmd.Trim() != "running")
- {
- RunCmd("systemctl restart firewalld");
- }
-
- foreach (var port in portList)
- {
- RunCmd($"firewall-cmd --zone=public --add-port={port}/tcp --permanent");
- RunCmd($"firewall-cmd --zone=public --add-port={port}/udp --permanent");
- }
- RunCmd("yes | firewall-cmd --reload");
- }
- else
- {
- cmd = RunCmd("command -v ufw");
- if (!string.IsNullOrEmpty(cmd))
- {
- foreach (var port in portList)
- {
- RunCmd($"ufw allow {port}/tcp");
- RunCmd($"ufw allow {port}/udp");
- }
- RunCmd("yes | ufw reload");
- }
- }
- }
-
- ///
- /// 配置防火墙
- ///
- protected void ConfigureFirewall()
- {
- var portList = new List();
- portList.Add(80);
- portList.Add(Parameters.Port);
- portList.AddRange(Parameters.FreePorts);
-
- OpenPort(portList.ToArray());
- }
-
- ///
- /// 配置同步时间差
- ///
- protected void SyncTimeDiff()
- {
- RunCmd("rm -f /etc/localtime");
- RunCmd("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
-
- var result = RunCmd("date +%s");
- var vpsSeconds = Convert.ToInt64(result);
- var localSeconds = (int)(DateTime.Now.ToUniversalTime() - DateTime.Parse("1970-01-01")).TotalSeconds;
-
- if (Math.Abs(vpsSeconds - localSeconds) >= 90)
- {
- // 同步本地时间
- var netUtcTime = DateTimeUtils.GetUTCTime();
- DateTimeUtils.SetDate(netUtcTime.ToLocalTime());
-
- // 同步VPS时间
- var utcTS = DateTimeUtils.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
- RunCmd($"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"");
- }
- }
-
- ///
- /// 验证域名是否绑定了主机
- ///
- protected void ValidateDomain()
- {
- if (OnlyIpv6)
- {
- string cmdFilter = @"| grep -oE '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))' | head -n 1";
- var cmd = $"dig @resolver1.opendns.com AAAA {Parameters.Domain} +short -6 {cmdFilter}";
- var result = RunCmd(cmd).TrimEnd('\r', '\n');
-
- if (result == IPv6) return;
- }
-
- else
- {
- string cmdFilter = @"| grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1";
- var cmd = $"dig @resolver1.opendns.com A {Parameters.Domain} +short -4 {cmdFilter}";
- var result = RunCmd(cmd).TrimEnd('\r', '\n');
-
- if (result == IPv4) return;
-
- }
-
-
- var btnResult = MessageBox.Show(
- $"{Parameters.Domain}未能正常解析到服务器的IP,如果您使用了CDN请忽略,是否继续安装?", "提示", MessageBoxButton.YesNo);
-
- if (btnResult == MessageBoxResult.No)
- {
- throw new Exception($"域名解析失败,安装停止!");
- }
-
- }
-
- ///
- /// 判断是否安装某个软件
- ///
- ///
- ///
- protected bool FileExists(string path)
- {
- var cmdStr = $"if [[ -f {path} ]];then echo '1';else echo '0'; fi";
- var cmd = RunCmd(cmdStr);
- return cmd.Trim() == "1";
- }
-
- ///
- /// 安装 Caddy
- ///
- protected void InstallCaddy()
- {
- RunCmd("rm -rf caddy_install.sh");
- RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- RunCmd("yes | bash caddy_install.sh");
- RunCmd("rm -rf caddy_install.sh");
- RunCmd("systemctl enable caddy.service");
- }
-
- ///
- /// 卸载 Caddy
- ///
- protected void UninstallCaddy()
- {
- RunCmd("rm -rf caddy_install.sh");
- RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
- RunCmd("yes | bash caddy_install.sh uninstall");
- RunCmd("rm -rf caddy_install.sh");
- RunCmd("rm -rf /usr/share/caddy");
- }
-
-
- #region 检测系统环境
-
- private bool IsOnlyIpv6()
- {
- string cmd;
-
- cmd = RunCmd(@"curl -s https://api.ip.sb/ip --ipv4 --max-time 8");
- IPv4 = cmd.TrimEnd('\r', '\n');
-
- if (!string.IsNullOrEmpty(IPv4))
- {
- OnlyIpv6 = false;
- return false;
- }
-
- cmd = RunCmd(@"curl -s https://api.ip.sb/ip --ipv6 --max-time 8");
- IPv6 = cmd.TrimEnd('\r', '\n');
-
- if (string.IsNullOrEmpty(IPv6))
- {
- throw new Exception("未检测可用的的IP地址");
- }
-
- OnlyIpv6 = true;
- return OnlyIpv6;
- }
-
- private bool SetPortFree(int port, bool force = true)
- {
- string result = RunCmd($"lsof -n -P -i :{port} | grep LISTEN");
-
- if (!string.IsNullOrEmpty(result))
- {
- if (force)
- {
- var btnResult = MessageBox.Show($"{port}端口被占用,将强制停止占用{port}端口的程序?", "提示", MessageBoxButton.YesNo);
- if (btnResult == MessageBoxResult.No)
- {
- throw new Exception($"{port}端口被占用,安装停止!");
- }
-
- string[] process = result.Split(' ');
- RunCmd($"systemctl stop {process[0]}");
- RunCmd($"systemctl disable {process[0]}");
- RunCmd($"pkill {process[0]}");
- return SetPortFree(port, force: false);
- }
- else
- {
- return false;
- }
- }
-
- return true;
- }
-
- public void ConfigurePort()
- {
- if (Parameters.Port == 80 || Parameters.Port == 443)
- {
- SetPortFree(80);
- SetPortFree(443);
- }
- else
- {
- SetPortFree(80);
- SetPortFree(443);
- SetPortFree(Parameters.Port);
-
- Parameters.FreePorts.ForEach(port =>
- {
- SetPortFree(port);
- });
- }
- }
-
- protected void SetNat64()
- {
- var dns64List = FilterFastestIP();
- if (dns64List.Count == 0)
- {
- throw new Exception("未找到有效的Nat64网关");
- }
-
- var exists = FileExists("/etc/resolv.conf.proxysu");
- if (!exists)
- {
- var cmdStr = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
- RunCmd(cmdStr);
- }
-
- foreach (var gateip in dns64List)
- {
- RunCmd($"echo \"nameserver {gateip}\" > /etc/resolv.conf");
- }
- }
-
- protected void RemoveNat64()
- {
- RunCmd("rm /etc/resolv.conf");
- RunCmd("mv /etc/resolv.conf.proxysu /etc/resolv.conf");
- }
-
- private List FilterFastestIP()
- {
- string[] gateNat64 = {
- "2a01:4f9:c010:3f02::1",
- "2001:67c:2b0::4",
- "2001:67c:2b0::6",
- "2a09:11c0:f1:bbf0::70",
- "2a01:4f8:c2c:123f::1",
- "2001:67c:27e4:15::6411",
- "2001:67c:27e4::64",
- "2001:67c:27e4:15::64",
- "2001:67c:27e4::60",
- "2a00:1098:2b::1",
- "2a03:7900:2:0:31:3:104:161",
- "2a00:1098:2c::1",
- "2a09:11c0:100::53",
- };
-
- Dictionary dns64List = new Dictionary();
- foreach (var gateip in gateNat64)
- {
- var cmdStr = $"ping6 -c4 {gateip} | grep avg | awk '{{print $4}}'|cut -d/ -f2";
- var cmd = RunCmd(cmdStr);
- if (!string.IsNullOrEmpty(cmd))
- {
- if (float.TryParse(cmd, out float delay))
- {
- dns64List.Add(gateip, delay);
- }
- }
- }
-
- return dns64List.Keys.ToList();
- }
-
- #endregion
-
-
- #region BBR
- private bool CheckKernelVersionBBR(string kernelVer)
- {
- string[] linuxKernelCompared = kernelVer.Split('.');
- if (int.Parse(linuxKernelCompared[0]) > 4)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[0]) < 4)
- {
- return false;
- }
- else if (int.Parse(linuxKernelCompared[0]) == 4)
- {
- if (int.Parse(linuxKernelCompared[1]) >= 9)
- {
- return true;
- }
- else if (int.Parse(linuxKernelCompared[1]) < 9)
- {
- return false;
- }
-
- }
- return false;
-
- }
-
- protected void EnableBBR()
- {
- var osVersion = RunCmd("uname -r");
- var canInstallBBR = CheckKernelVersionBBR(osVersion.Split('-')[0]);
-
- var bbrInfo = RunCmd("sysctl net.ipv4.tcp_congestion_control | grep bbr");
- var installed = bbrInfo.Contains("bbr");
- if (canInstallBBR && !installed)
- {
- RunCmd(@"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'");
- RunCmd(@"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'");
- RunCmd(@"sysctl -p");
-
- if (OnlyIpv6)
- {
- RemoveNat64();
- }
- WriteOutput("BBR启动成功");
- }
-
- if (!canInstallBBR)
- {
- WriteOutput("****** 系统不满足启用BBR条件,启动失败。 ******");
- }
-
- }
- #endregion
-
- ///
- /// 安装证书
- ///
- ///
- ///
- protected void InstallCert(string dirPath, string certName, string keyName)
- {
- string certPath = Path.Combine(dirPath, certName);
- string keyPath = Path.Combine(dirPath, keyName);
-
- // 安装依赖
- RunCmd(GetInstallCmd("socat"));
-
- // 解决搬瓦工CentOS缺少问题
- RunCmd(GetInstallCmd("automake autoconf libtool"));
-
- // 安装Acme
- var result = RunCmd($"curl https://get.acme.sh yes | sh");
- if (result.Contains("Install success"))
- {
- WriteOutput("安装 acme.sh 成功");
- }
- else
- {
- WriteOutput("安装 acme.sh 失败,请联系开发者!");
- throw new Exception("安装 acme.sh 失败,请联系开发者!");
- }
-
- RunCmd("cd ~/.acme.sh/");
- RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
-
- // 申请证书
- if (OnlyIpv6)
- {
- var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --listen-v6";
- result = RunCmd(cmd);
- }
- else
- {
- var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain}";
- result = RunCmd(cmd);
- }
-
- if (result.Contains("success"))
- {
- WriteOutput("申请证书成功");
- }
- else
- {
- WriteOutput("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
- throw new Exception("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
- }
-
- // 安装证书
- RunCmd($"mkdir -p {dirPath}");
- RunCmd($"/root/.acme.sh/acme.sh --installcert -d {Parameters.Domain} --certpath {certPath} --keypath {keyPath} --capath {certPath}");
-
- result = RunCmd($@"if [ ! -f ""{keyPath}"" ]; then echo ""0""; else echo ""1""; fi | head -n 1");
-
- if (result.Contains("1"))
- {
- WriteOutput("安装证书成功");
- }
- else
- {
- WriteOutput("安装证书失败,请联系开发者!");
- throw new Exception("安装证书失败,请联系开发者!");
- }
-
- RunCmd($"chmod 755 {dirPath}");
- }
-
- ///
- /// 上传文件
- ///
- ///
- ///
- protected void UploadFile(Stream stream, string path)
- {
- using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
- {
- sftp.Connect();
- sftp.UploadFile(stream, path, true);
- sftp.Disconnect();
- }
- }
-
- ///
- /// 根据系统环境匹配更新命令
- ///
- ///
- protected string GetUpdateCmd()
- {
- if (CmdType == CmdType.Apt)
- {
- return "apt-get update";
- }
- else if (CmdType == CmdType.Dnf)
- {
- return "dnf clean all;dnf makecache";
- }
- else if (CmdType == CmdType.Yum)
- {
- return "yum clean all;yum makecache";
- }
-
- throw new Exception("未识别的系统");
- }
-
- ///
- /// 根据系统匹配安装命令
- ///
- ///
- ///
- protected string GetInstallCmd(string soft)
- {
- if (CmdType == CmdType.Apt)
- {
- return "echo y | apt-get install " + soft;
- }
- else if (CmdType == CmdType.Dnf)
- {
- return "echo y | dnf -y install " + soft;
- }
- else if (CmdType == CmdType.Yum)
- {
- return "echo y | yum -y install " + soft;
- }
-
- throw new Exception("未识别的系统");
- }
-
- }
-}
diff --git a/ProxySU_Core/Models/Developers/TrojanGoConfigBuilder.cs b/ProxySU_Core/Models/Developers/TrojanGoConfigBuilder.cs
deleted file mode 100644
index c02a9d0..0000000
--- a/ProxySU_Core/Models/Developers/TrojanGoConfigBuilder.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Models.Developers
-{
- public class TrojanGoConfigBuilder
- {
- public static readonly int WebPort = 8088;
-
- public static readonly string TrojanGoSettingPath = @"Templates\trojan-go\trojan-go.json";
-
- public static readonly string CaddyFilePath = @"Templates\trojan-go\base.caddyfile";
-
- public static string BuildTrojanGoConfig(TrojanGoSettings parameters)
- {
- var jsonStr = File.ReadAllText(TrojanGoSettingPath);
- var settings = JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
-
- settings["remote_port"] = WebPort;
- settings["password"][0] = parameters.Password;
- settings["ssl"]["sni"] = parameters.Domain;
-
- return JsonConvert.SerializeObject(settings, Formatting.Indented, new JsonSerializerSettings()
- {
- NullValueHandling = NullValueHandling.Ignore
- });
- }
-
- public static string BuildCaddyConfig(TrojanGoSettings parameters, bool useCustomWeb = false)
- {
- var caddyStr = File.ReadAllText(CaddyFilePath);
- caddyStr.Replace("##domain##", parameters.Domain);
- caddyStr.Replace("##port##", WebPort.ToString());
-
- 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());
-
- caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
- }
- else
- {
- caddyStr = caddyStr.Replace("##reverse_proxy##", "");
- }
-
- return caddyStr;
- }
- }
-
-}
diff --git a/ProxySU_Core/Models/Developers/TrojanGoProject.cs b/ProxySU_Core/Models/Developers/TrojanGoProject.cs
deleted file mode 100644
index bf6cf19..0000000
--- a/ProxySU_Core/Models/Developers/TrojanGoProject.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using Renci.SshNet;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace ProxySU_Core.Models.Developers
-{
- public class TrojanGoProject : Project
- {
- public TrojanGoProject(SshClient sshClient, TrojanGoSettings parameters, Action writeOutput) : base(sshClient, parameters, writeOutput)
- {
- }
-
- public override void Install()
- {
- try
- {
- EnsureRootAuth();
-
- if (FileExists("/usr/local/bin/xray"))
- {
- var btnResult = MessageBox.Show("已经安装Xray,是否需要重装?", "提示", MessageBoxButton.YesNo);
- if (btnResult == MessageBoxResult.No)
- {
- MessageBox.Show("安装终止", "提示");
- return;
- }
- }
-
- WriteOutput("检测安装系统环境...");
- EnsureSystemEnv();
- WriteOutput("检测安装系统环境完成");
-
- WriteOutput("配置服务器端口...");
- ConfigurePort();
- WriteOutput("端口配置完成");
-
- WriteOutput("安装必要的系统工具...");
- ConfigureSoftware();
- WriteOutput("系统工具安装完成");
-
- WriteOutput("检测IP6...");
- ConfigureIPv6();
- WriteOutput("检测IP6完成");
-
- WriteOutput("配置防火墙...");
- ConfigureFirewall();
- WriteOutput("防火墙配置完成");
-
- WriteOutput("同步系统和本地时间...");
- SyncTimeDiff();
- WriteOutput("时间同步完成");
-
- WriteOutput("检测域名是否绑定本机IP...");
- ValidateDomain();
- WriteOutput("域名检测完成");
-
- WriteOutput("安装Trojan-Go...");
- InstallTrojanGo();
- WriteOutput("Trojan-Go安装完成");
-
- WriteOutput("安装Caddy...");
- InstallCaddy();
- WriteOutput("Caddy安装完成");
-
- WriteOutput("启动BBR");
- EnableBBR();
-
- UploadCaddyFile();
- WriteOutput("************");
- WriteOutput("安装完成,尽情享用吧......");
- WriteOutput("************");
- }
- catch (Exception ex)
- {
- var errorLog = "安装终止," + ex.Message;
- WriteOutput(errorLog);
- MessageBox.Show(errorLog);
- }
- }
-
- private void InstallTrojanGo()
- {
- WriteOutput("安装Trojan-Go");
- RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh yes | bash");
- var success = FileExists("/usr/local/etc/trojan-go");
- if (success == false)
- {
- throw new Exception("trojan-go 安装失败,请联系开发者!");
- }
-
- RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service");
- RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service");
- RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service");
- RunCmd($"systemctl daemon-reload");
-
- RunCmd("systemctl enable trojan-go");
- RunCmd("systemctl start trojan-go");
- WriteOutput("Trojan-Go 安装完成");
-
- InstallCert(
- dirPath: "/usr/local/etc/trojan-go",
- certName: "trojan-go.crt",
- keyName: "trojan-go.key");
-
- if (FileExists("/usr/local/etc/trojan-go/config.json"))
- {
- RunCmd("mv /usr/local/etc/trojan-go/config.json config.json.old");
- }
-
- // 上传配置
- var settings = TrojanGoConfigBuilder.BuildTrojanGoConfig(Parameters);
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(settings));
- UploadFile(stream, "/usr/local/etc/trojan-go/config.json");
- RunCmd("systemctl restart trojan-go");
- }
-
- private void UploadCaddyFile(bool useCustomWeb = false)
- {
- var config = TrojanGoConfigBuilder.BuildCaddyConfig(Parameters, useCustomWeb);
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(config));
- if (FileExists("/etc/caddy/Caddyfile"))
- {
- RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
- }
- UploadFile(stream, "/etc/caddy/Caddyfile");
- RunCmd("systemctl restart caddy");
- }
- }
-
-}
diff --git a/ProxySU_Core/Models/Developers/TrojanGoSettings.cs b/ProxySU_Core/Models/Developers/TrojanGoSettings.cs
deleted file mode 100644
index 6dd2102..0000000
--- a/ProxySU_Core/Models/Developers/TrojanGoSettings.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Models.Developers
-{
- public class TrojanGoSettings : IParameters
- {
- public int Port { get; set; }
-
- public List FreePorts
- {
- get
- {
- return new List();
- }
- }
-
- public string Domain { get; set; }
-
- public List Types { get; set; }
-
- public string Password { get; set; }
-
- public string MaskDomain { get; set; }
- }
-}
diff --git a/ProxySU_Core/Models/Developers/XrayConfigBuilder.cs b/ProxySU_Core/Models/Developers/XrayConfigBuilder.cs
deleted file mode 100644
index d7eb4be..0000000
--- a/ProxySU_Core/Models/Developers/XrayConfigBuilder.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-namespace ProxySU_Core.Models.Developers
-{
- public class XrayConfigBuilder
- {
- private const string ServerLogDir = @"Templates\xray\server\00_log";
- private const string ServerApiDir = @"Templates\xray\server\01_api";
- private const string ServerDnsDir = @"Templates\xray\server\02_dns";
- private const string ServerRoutingDir = @"Templates\xray\server\03_routing";
- private const string ServerPolicyDir = @"Templates\xray\server\04_policy";
- private const string ServerInboundsDir = @"Templates\xray\server\05_inbounds";
- private const string ServerOutboundsDir = @"Templates\xray\server\06_outbounds";
- private const string ServerTransportDir = @"Templates\xray\server\07_transport";
- private const string ServerStatsDir = @"Templates\xray\server\08_stats";
- private const string ServerReverseDir = @"Templates\xray\server\09_reverse";
- private const string CaddyFileDir = @"Templates\xray\caddy";
-
- public static int VLESS_TCP_Port = 1110;
- public static int VLESS_WS_Port = 1111;
- public static int VLESS_H2_Port = 1112;
- public static int VLESS_mKCP_Port = 1113;
-
- public static int VMESS_TCP_Port = 1210;
- public static int VMESS_WS_Port = 1211;
- public static int VMESS_H2_Port = 1212;
-
- public static int Trojan_TCP_Port = 1310;
- public static int Trojan_WS_Port = 1311;
-
- public static int FullbackPort = 8080;
-
-
-
- public static dynamic LoadXrayConfig()
- {
- dynamic logObj = LoadJsonObj(Path.Combine(ServerLogDir, "00_log.json"));
- dynamic apiObj = LoadJsonObj(Path.Combine(ServerApiDir, "01_api.json"));
- dynamic dnsObj = LoadJsonObj(Path.Combine(ServerDnsDir, "02_dns.json"));
- dynamic routingObj = LoadJsonObj(Path.Combine(ServerRoutingDir, "03_routing.json"));
- dynamic policyObj = LoadJsonObj(Path.Combine(ServerPolicyDir, "04_policy.json"));
- dynamic inboundsObj = LoadJsonObj(Path.Combine(ServerInboundsDir, "05_inbounds.json"));
- dynamic outboundsObj = LoadJsonObj(Path.Combine(ServerOutboundsDir, "06_outbounds.json"));
- dynamic transportObj = LoadJsonObj(Path.Combine(ServerTransportDir, "07_transport.json"));
- dynamic statsObj = LoadJsonObj(Path.Combine(ServerStatsDir, "08_stats.json"));
- dynamic reverseObj = LoadJsonObj(Path.Combine(ServerReverseDir, "09_reverse.json"));
-
- return new
- {
- log = logObj["log"],
- //api = apiObj["api"], api不能为空
- dns = dnsObj["dns"],
- routing = routingObj["routing"],
- policy = policyObj["policy"],
- inbounds = inboundsObj["inbounds"],
- outbounds = outboundsObj["outbounds"],
- transport = transportObj["transport"],
- stats = statsObj["stats"],
- reverse = reverseObj["reverse"]
- };
- }
-
- public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
- {
- var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
- caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
- caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
-
- 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());
-
- caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
- }
- else
- {
- caddyStr = caddyStr.Replace("##reverse_proxy##", "");
- }
-
- return caddyStr;
- }
-
- public static string BuildXrayConfig(XraySettings parameters)
- {
- var xrayConfig = LoadXrayConfig();
- var baseBound = GetBound("VLESS_TCP_XTLS.json");
- baseBound.port = parameters.Port;
- baseBound.settings.fallbacks.Add(JToken.FromObject(new
- {
- dest = FullbackPort
- }));
- xrayConfig.inbounds.Add(baseBound);
- baseBound.settings.clients[0].id = parameters.UUID;
-
- if (parameters.Types.Contains(XrayType.VLESS_WS))
- {
- var wsInbound = GetBound("VLESS_WS.json");
- wsInbound.port = VLESS_WS_Port;
- wsInbound.settings.clients[0].id = parameters.UUID;
- wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
- baseBound.settings.fallbacks.Add(JToken.FromObject(new
- {
- dest = VLESS_WS_Port,
- path = parameters.VLESS_WS_Path,
- xver = 1,
- }));
- xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
- }
-
- if (parameters.Types.Contains(XrayType.VLESS_gRPC))
- {
- var gRPCInBound = GetBound("VLESS_gRPC.json");
- gRPCInBound.port = parameters.VLESS_gRPC_Port;
- gRPCInBound.settings.clients[0].id = parameters.UUID;
- gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
- xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
- }
-
- if (parameters.Types.Contains(XrayType.VLESS_KCP))
- {
- var kcpBound = GetBound("VLESS_KCP.json");
- kcpBound.port = parameters.VLESS_KCP_Port;
- kcpBound.settings.clients[0].id = parameters.UUID;
- kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
- kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
- xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
- }
-
- if (parameters.Types.Contains(XrayType.VMESS_TCP))
- {
- var mtcpBound = GetBound("VMESS_TCP.json");
- mtcpBound.port = VMESS_TCP_Port;
- mtcpBound.settings.clients[0].id = parameters.UUID;
- mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
- baseBound.settings.fallbacks.Add(JToken.FromObject(new
- {
- dest = VMESS_TCP_Port,
- path = parameters.VMESS_TCP_Path,
- xver = 1,
- }));
- xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
- }
-
- if (parameters.Types.Contains(XrayType.VMESS_WS))
- {
- var mwsBound = GetBound("VMESS_WS.json");
- mwsBound.port = VMESS_WS_Port;
- mwsBound.settings.clients[0].id = parameters.UUID;
- mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
- baseBound.settings.fallbacks.Add(JToken.FromObject(new
- {
- dest = VMESS_WS_Port,
- path = parameters.VMESS_WS_Path,
- xver = 1,
- }));
- xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
- }
-
- if (parameters.Types.Contains(XrayType.VMESS_KCP))
- {
- var kcpBound = GetBound("VMESS_KCP.json");
- kcpBound.port = parameters.VMESS_KCP_Port;
- kcpBound.settings.clients[0].id = parameters.UUID;
- kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
- kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
- xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
- }
-
- if (parameters.Types.Contains(XrayType.Trojan_TCP))
- {
- var trojanTcpBound = GetBound("Trojan_TCP.json");
- trojanTcpBound.port = Trojan_TCP_Port;
- trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
- trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
- baseBound.settings.fallbacks[0] = JToken.FromObject(new
- {
- dest = Trojan_TCP_Port,
- xver = 1,
- });
- xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
- }
-
-
- if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
- {
- var ssBound = GetBound("Shadowsocks-AEAD.json");
- ssBound.port = parameters.ShadowSocksPort;
- ssBound.settings.clients[0].password = parameters.ShadowsocksPassword;
- ssBound.settings.clients[0].method = parameters.ShadowsocksMethod;
- xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
- }
-
- return JsonConvert.SerializeObject(
- xrayConfig,
- Formatting.Indented,
- new JsonSerializerSettings()
- {
- NullValueHandling = NullValueHandling.Ignore
- });
- }
-
- private static dynamic GetBound(string name)
- {
- return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
- }
-
- private static dynamic LoadJsonObj(string path)
- {
- if (File.Exists(path))
- {
- var jsonStr = File.ReadAllText(path, Encoding.UTF8);
- return JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
- }
- return null;
- }
-
- }
-
-}
diff --git a/ProxySU_Core/Models/Developers/XrayProject.cs b/ProxySU_Core/Models/Developers/XrayProject.cs
deleted file mode 100644
index f0678af..0000000
--- a/ProxySU_Core/Models/Developers/XrayProject.cs
+++ /dev/null
@@ -1,321 +0,0 @@
-using Renci.SshNet;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Windows;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using ProxySU_Core.Models;
-
-namespace ProxySU_Core.Models.Developers
-{
- public class XrayProject : Project
- {
-
- private const string ServerLogDir = @"Templates\xray\server\00_log";
- private const string ServerApiDir = @"Templates\xray\server\01_api";
- private const string ServerDnsDir = @"Templates\xray\server\02_dns";
- private const string ServerRoutingDir = @"Templates\xray\server\03_routing";
- private const string ServerPolicyDir = @"Templates\xray\server\04_policy";
- private const string ServerInboundsDir = @"Templates\xray\server\05_inbounds";
- private const string ServerOutboundsDir = @"Templates\xray\server\06_outbounds";
- private const string ServerTransportDir = @"Templates\xray\server\07_transport";
- private const string ServerStatsDir = @"Templates\xray\server\08_stats";
- private const string ServerReverseDir = @"Templates\xray\server\09_reverse";
- private const string CaddyFileDir = @"Templates\xray\caddy";
-
- public XrayProject(SshClient sshClient, XraySettings parameters, Action writeOutput) : base(sshClient, parameters, writeOutput)
- {
- }
-
-
- ///
- /// 安装Xray
- ///
- public override void Install()
- {
- try
- {
- EnsureRootAuth();
-
- if (FileExists("/usr/local/bin/xray"))
- {
- var btnResult = MessageBox.Show("已经安装Xray,是否需要重装?", "提示", MessageBoxButton.YesNo);
- if (btnResult == MessageBoxResult.No)
- {
- MessageBox.Show("安装终止", "提示");
- return;
- }
- }
-
- WriteOutput("检测安装系统环境...");
- EnsureSystemEnv();
- WriteOutput("检测安装系统环境完成");
-
- WriteOutput("配置服务器端口...");
- ConfigurePort();
- WriteOutput("端口配置完成");
-
- WriteOutput("安装必要的系统工具...");
- ConfigureSoftware();
- WriteOutput("系统工具安装完成");
-
- WriteOutput("检测IP6...");
- ConfigureIPv6();
- WriteOutput("检测IP6完成");
-
- WriteOutput("配置防火墙...");
- ConfigureFirewall();
- WriteOutput("防火墙配置完成");
-
- WriteOutput("同步系统和本地时间...");
- SyncTimeDiff();
- WriteOutput("时间同步完成");
-
- WriteOutput("检测域名是否绑定本机IP...");
- ValidateDomain();
- WriteOutput("域名检测完成");
-
- WriteOutput("安装Xray-Core...");
- InstallXrayWithCert();
- WriteOutput("Xray-Core安装完成");
-
- WriteOutput("安装Caddy...");
- InstallCaddy();
- WriteOutput("Caddy安装完成");
-
- WriteOutput("启动BBR");
- EnableBBR();
-
- UploadCaddyFile();
- WriteOutput("************");
- WriteOutput("安装完成,尽情享用吧......");
- WriteOutput("************");
- }
- catch (Exception ex)
- {
- var errorLog = "安装终止," + ex.Message;
- WriteOutput(errorLog);
- MessageBox.Show(errorLog);
- }
- }
-
- public void UninstallProxy()
- {
- EnsureRootAuth();
- WriteOutput("卸载Caddy");
- UninstallCaddy();
- WriteOutput("卸载Xray");
- UninstallXray();
- WriteOutput("卸载证书");
- UninstallAcme();
- WriteOutput("关闭端口");
- ClosePort(Parameters.ShadowSocksPort, Parameters.VMESS_KCP_Port);
-
- WriteOutput("************ 卸载完成 ************");
- }
-
- ///
- /// 更新xray内核
- ///
- public void UpdateXrayCore()
- {
- EnsureRootAuth();
- EnsureSystemEnv();
- RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
- RunCmd("systemctl restart xray");
- WriteOutput("************ 更新xray内核完成 ************");
- }
-
- ///
- /// 更新xray配置
- ///
- public void UpdateXraySettings()
- {
- EnsureRootAuth();
- EnsureSystemEnv();
- ConfigureFirewall();
- var configJson = XrayConfigBuilder.BuildXrayConfig(Parameters);
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
- RunCmd("rm -rf /usr/local/etc/xray/config.json");
- UploadFile(stream, "/usr/local/etc/xray/config.json");
- ConfigurePort();
- UploadCaddyFile(string.IsNullOrEmpty(Parameters.MaskDomain));
- RunCmd("systemctl restart xray");
- WriteOutput("************ 更新Xray配置成功,更新配置不包含域名,如果域名更换请重新安装。 ************");
- }
-
- ///
- /// 重装Caddy
- ///
- public void DoUninstallCaddy()
- {
- EnsureRootAuth();
- UninstallCaddy();
- WriteOutput("************ 卸载Caddy完成 ************");
- }
-
- ///
- /// 安装证书
- ///
- public void InstallCertToXray()
- {
- EnsureRootAuth();
- EnsureSystemEnv();
- InstallCert(
- dirPath: "/usr/local/etc/xray/ssl",
- certName: "xray_ssl.crt",
- keyName: "xray_ssl.key");
-
- RunCmd("systemctl restart xray");
- WriteOutput("************ 安装证书完成 ************");
- }
-
- ///
- /// 上传证书
- ///
- ///
- ///
- public void UploadCert(Stream stream)
- {
- EnsureRootAuth();
- EnsureSystemEnv();
-
- // 转移旧文件
- var oldFileName = $"ssl_{DateTime.Now.Ticks}";
- RunCmd($"mv /usr/local/etc/xray/ssl /usr/local/etc/xray/{oldFileName}");
-
- // 上传新文件
- RunCmd("mkdir /usr/local/etc/xray/ssl");
- UploadFile(stream, "/usr/local/etc/xray/ssl/ssl.zip");
- RunCmd("unzip /usr/local/etc/xray/ssl/ssl.zip -d /usr/local/etc/xray/ssl");
-
- // 改名
- var crtFiles = RunCmd("find /usr/local/etc/xray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- if (crtFiles.Length > 0)
- {
- RunCmd($"mv {crtFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.crt");
- }
- else
- {
- WriteOutput("************ 上传证书失败,请联系开发者 ************");
- RunCmd("rm -rf /usr/local/etc/xray/ssl");
- RunCmd($"mv /usr/local/etc/xray/ssl{oldFileName} /usr/local/etc/xray/ssl");
- WriteOutput("操作已回滚");
- return;
- }
-
- var keyFiles = RunCmd("find /usr/local/etc/xray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- if (keyFiles.Length > 0)
- {
- RunCmd($"mv {keyFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.key");
- }
- else
- {
- WriteOutput("************ 上传证书失败,请联系开发者 ************");
- RunCmd("rm -rf /usr/local/etc/xray/ssl");
- RunCmd($"mv /usr/local/etc/xray/ssl{oldFileName} /usr/local/etc/xray/ssl");
- WriteOutput("操作已回滚");
- return;
- }
-
- RunCmd("systemctl restart xray");
- WriteOutput("************ 上传证书完成 ************");
- }
-
- ///
- /// 上传静态网站
- ///
- ///
- 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("************ 上传网站模板完成 ************");
- }
-
-
- private void UploadCaddyFile(bool useCustomWeb = false)
- {
- var configJson = XrayConfigBuilder.BuildCaddyConfig(Parameters, useCustomWeb);
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
- if (FileExists("/etc/caddy/Caddyfile"))
- {
- RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
- }
- UploadFile(stream, "/etc/caddy/Caddyfile");
- RunCmd("systemctl restart caddy");
- }
-
-
-
- private void UninstallXray()
- {
- RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
- }
-
- private void UninstallAcme()
- {
- RunCmd("acme.sh --uninstall");
- RunCmd("rm -r ~/.acme.sh");
- }
-
- private void InstallXrayWithCert()
- {
- RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
-
- if (!FileExists("/usr/local/bin/xray"))
- {
- WriteOutput("Xray-Core安装失败,请联系开发者");
- throw new Exception("Xray-Core安装失败,请联系开发者");
- }
-
- RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service");
- RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service");
- RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service");
- RunCmd($"systemctl daemon-reload");
-
- if (FileExists("/usr/local/etc/xray/config.json"))
- {
- RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
- }
-
- WriteOutput("安装TLS证书");
- InstallCertToXray();
- WriteOutput("TLS证书安装完成");
-
-
- var configJson = XrayConfigBuilder.BuildXrayConfig(Parameters);
- var stream = new MemoryStream(Encoding.UTF8.GetBytes(configJson));
- UploadFile(stream, "/usr/local/etc/xray/config.json");
- RunCmd("systemctl restart xray");
- }
-
- private int GetRandomPort()
- {
- var random = new Random();
- return random.Next(10001, 60000);
- }
-
- private dynamic LoadJsonObj(string path)
- {
- if (File.Exists(path))
- {
- var jsonStr = File.ReadAllText(path, Encoding.UTF8);
- return JsonConvert.DeserializeObject(jsonStr);
- }
- return null;
- }
-
- }
-}
diff --git a/ProxySU_Core/Models/Developers/XraySettings.cs b/ProxySU_Core/Models/Developers/XraySettings.cs
deleted file mode 100644
index 0b6e274..0000000
--- a/ProxySU_Core/Models/Developers/XraySettings.cs
+++ /dev/null
@@ -1,220 +0,0 @@
-using Newtonsoft.Json;
-using ProxySU_Core.Common;
-using ProxySU_Core.Models.Developers;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
-
-namespace ProxySU_Core.Models
-{
- public class XraySettings : IParameters
- {
-
- public XraySettings()
- {
- var guid = Guid.NewGuid().ToString();
- Port = 443;
- VLESS_KCP_Port = 2001;
- VLESS_gRPC_Port = 2002;
- VMESS_KCP_Port = 3001;
- ShadowSocksPort = 4001;
-
- UUID = guid;
- Types = new List();
-
- VLESS_WS_Path = "/vlessws";
- VLESS_H2_Path = "/vlessh2";
- VLESS_KCP_Type = "none";
- VLESS_KCP_Seed = guid;
- VLESS_gRPC_ServiceName = "xray_gRPC";
-
- VMESS_WS_Path = "/vmessws";
- VMESS_TCP_Path = "/vmesstcp";
- VMESS_H2_Path = "/vmessh2";
- VMESS_KCP_Seed = guid;
- VMESS_KCP_Type = "none";
-
- TrojanPassword = guid;
- Trojan_WS_Path = "/trojanws";
-
- ShadowsocksPassword = guid;
- ShadowsocksMethod = "aes-128-gcm";
- }
-
- ///
- /// 访问端口
- ///
- public int Port { get; set; }
-
-
- ///
- /// UUID
- ///
- public string UUID { get; set; }
-
- #region vless
-
-
- ///
- /// vless ws路径
- ///
- public string VLESS_WS_Path { get; set; }
-
- ///
- /// vless http2 path
- ///
- public string VLESS_H2_Path { get; set; }
-
- ///
- /// vless kcp seed
- ///
- public string VLESS_KCP_Seed { get; set; }
-
- ///
- /// vless kcp type
- ///
- public string VLESS_KCP_Type { get; set; }
-
- ///
- /// vless kcp端口
- ///
- public int VLESS_KCP_Port { get; set; }
-
- ///
- /// grpc service name
- ///
- public string VLESS_gRPC_ServiceName { get; set; }
-
- ///
- /// grpc port
- ///
- public int VLESS_gRPC_Port { get; set; }
-
- #endregion
-
- #region vmess
- ///
- /// vmess ws路径
- ///
- public string VMESS_WS_Path { get; set; }
-
- ///
- /// vmess tcp路径
- ///
- public string VMESS_TCP_Path { get; set; }
-
- ///
- /// vmess http2 path
- ///
- public string VMESS_H2_Path { get; set; }
-
- ///
- /// vmess kcp seed
- ///
- public string VMESS_KCP_Seed { get; set; }
-
- ///
- /// vmess kcp type
- ///
- public string VMESS_KCP_Type { get; set; }
-
- ///
- /// vmess kcp端口
- ///
- public int VMESS_KCP_Port { get; set; }
- #endregion
-
- #region Trojan
- ///
- /// trojan密码
- ///
- public string TrojanPassword { get; set; }
-
- ///
- /// trojan ws path
- ///
- public string Trojan_WS_Path { get; set; }
- #endregion
-
- #region ShadowsocksAEAD
- ///
- /// ss password
- ///
- public string ShadowsocksPassword { get; set; }
-
- ///
- /// ss method
- ///
- public string ShadowsocksMethod { get; set; }
-
- ///
- /// ss端口
- ///
- public int ShadowSocksPort { get; set; }
- #endregion
-
-
- ///
- /// 域名
- ///
- public string Domain { get; set; }
-
- ///
- /// 伪装域名
- ///
- public string MaskDomain { get; set; }
-
- ///
- /// 安装类型
- ///
- public List Types { get; set; }
-
- public List FreePorts
- {
- get
- {
- return new List
- {
- VLESS_gRPC_Port,
- VLESS_KCP_Port,
- VMESS_KCP_Port,
- ShadowSocksPort,
- };
- }
- }
-
- public string GetPath(XrayType type)
- {
- switch (type)
- {
- case XrayType.VLESS_WS:
- return VLESS_WS_Path;
- case XrayType.VLESS_H2:
- return VLESS_H2_Path;
-
- case XrayType.VMESS_TCP:
- return VMESS_TCP_Path;
- case XrayType.VMESS_WS:
- return VMESS_WS_Path;
- case XrayType.Trojan_WS:
- return Trojan_WS_Path;
-
- // no path
- case XrayType.VLESS_TCP_XTLS:
- case XrayType.VLESS_TCP:
- case XrayType.VLESS_KCP:
- case XrayType.VMESS_KCP:
- case XrayType.Trojan_TCP:
- return string.Empty;
- default:
- return string.Empty;
- }
- }
-
- }
-
-
-}
diff --git a/ProxySU_Core/Models/Host.cs b/ProxySU_Core/Models/Host.cs
deleted file mode 100644
index c4d3fc8..0000000
--- a/ProxySU_Core/Models/Host.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Models
-{
- public class Host
- {
-
-
- public Host()
- {
- Proxy = new LocalProxy();
- }
-
-
- public string Tag { get; set; }
-
- public string Address { get; set; }
-
- public string UserName { get; set; }
-
- public string Password { get; set; }
-
- public int Port { get; set; } = 22;
-
- public string PrivateKeyPath { get; set; }
-
- public LocalProxy Proxy { get; set; }
-
- public LoginSecretType SecretType { get; set; }
- }
-}
diff --git a/ProxySU_Core/Models/LocalProxy.cs b/ProxySU_Core/Models/LocalProxy.cs
deleted file mode 100644
index 7e71c8b..0000000
--- a/ProxySU_Core/Models/LocalProxy.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ProxySU_Core.Models
-{
- public class LocalProxy
- {
- public string Address { get; set; } = "127.0.0.1";
-
- public int Port { get; set; } = 1080;
-
- public LocalProxyType Type { get; set; }
-
- public string UserName { get; set; }
-
- public string Password { get; set; }
-
- }
-}
diff --git a/ProxySU_Core/Models/LocalProxyType.cs b/ProxySU_Core/Models/LocalProxyType.cs
deleted file mode 100644
index c74da49..0000000
--- a/ProxySU_Core/Models/LocalProxyType.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ProxySU_Core.Models
-{
- public enum LocalProxyType
- {
- None = 0,
- //
- // 摘要:
- // A SOCKS4 proxy server.
- Socks4 = 1,
- //
- // 摘要:
- // A SOCKS5 proxy server.
- Socks5 = 2,
- //
- // 摘要:
- // A HTTP proxy server.
- Http = 3
- }
-}
diff --git a/ProxySU_Core/Models/LoginSecretType.cs b/ProxySU_Core/Models/LoginSecretType.cs
deleted file mode 100644
index 66c2602..0000000
--- a/ProxySU_Core/Models/LoginSecretType.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ProxySU_Core.Models
-{
- public enum LoginSecretType
- {
- Password = 0,
- PrivateKey = 1
- }
-}
diff --git a/ProxySU_Core/Models/Record.cs b/ProxySU_Core/Models/Record.cs
deleted file mode 100644
index 091ac2f..0000000
--- a/ProxySU_Core/Models/Record.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ProxySU_Core.Models
-{
- public class Record
- {
- public Record()
- {
-
- }
-
- public Record(Host host)
- {
- this.Host = host;
- }
-
- public Host Host { get; set; } = new Host();
-
- public XraySettings Settings { get; set; } = new XraySettings();
- }
-}
diff --git a/ProxySU_Core/Models/ShareLink.cs b/ProxySU_Core/Models/ShareLink.cs
deleted file mode 100644
index 8c606a4..0000000
--- a/ProxySU_Core/Models/ShareLink.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-using Newtonsoft.Json;
-using ProxySU_Core.Common;
-using ProxySU_Core.Models.Developers;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
-
-namespace ProxySU_Core.Models
-{
- public class ShareLink
- {
- public static string Build(XrayType xrayType, XraySettings settings)
- {
-
- switch (xrayType)
- {
- case XrayType.VLESS_TCP:
- case XrayType.VLESS_TCP_XTLS:
- case XrayType.VLESS_WS:
- case XrayType.VLESS_KCP:
- case XrayType.VLESS_gRPC:
- case XrayType.Trojan_TCP:
- return BuildVlessShareLink(xrayType, settings);
- case XrayType.VMESS_TCP:
- case XrayType.VMESS_WS:
- case XrayType.VMESS_KCP:
- return BuildVmessShareLink(xrayType, settings);
- case XrayType.ShadowsocksAEAD:
- return BuildShadowSocksShareLink(settings);
- default:
- return string.Empty;
- }
- }
-
- private static string BuildShadowSocksShareLink(XraySettings settings)
- {
- var _method = settings.ShadowsocksMethod;
- var _password = settings.ShadowsocksPassword;
- var _server = settings.Domain;
- var _port = settings.ShadowSocksPort;
-
- var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
- return "ss://" + base64URL + "#ShadowSocks";
- }
-
- private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
- {
- var vmess = new Vmess
- {
- v = "2",
- add = settings.Domain,
- port = settings.Port.ToString(),
- id = settings.UUID,
- aid = "0",
- net = "",
- type = "none",
- host = settings.Domain,
- path = "",
- tls = "tls",
- ps = "",
- };
-
- switch (xrayType)
- {
- case XrayType.VMESS_TCP:
- vmess.ps = "vmess-tcp-tls";
- vmess.net = "tcp";
- vmess.type = "http";
- vmess.path = settings.VMESS_TCP_Path;
- break;
- case XrayType.VMESS_WS:
- vmess.ps = "vmess-ws-tls";
- vmess.net = "ws";
- vmess.type = "none";
- vmess.path = settings.VMESS_WS_Path;
- break;
- case XrayType.VMESS_KCP:
- vmess.ps = "vmess-mKCP";
- vmess.port = settings.VMESS_KCP_Port.ToString();
- vmess.net = "kcp";
- vmess.type = settings.VMESS_KCP_Type;
- vmess.path = settings.VMESS_KCP_Seed;
- vmess.tls = "";
- break;
- default:
- return string.Empty;
- }
-
- var base64Url = Base64.Encode(JsonConvert.SerializeObject(vmess));
- return $"vmess://" + base64Url;
- }
-
- private static string BuildVlessShareLink(XrayType xrayType, XraySettings settings)
- {
- var _protocol = string.Empty;
- var _uuid = settings.UUID;
- var _domain = settings.Domain;
- var _port = settings.Port;
- var _type = string.Empty;
- var _encryption = "none";
- var _security = "tls";
- var _path = "/";
- var _host = settings.Domain;
- var _descriptiveText = string.Empty;
- var _headerType = "none";
- var _seed = string.Empty;
-
- switch (xrayType)
- {
- case XrayType.VLESS_TCP:
- _protocol = "vless";
- _type = "tcp";
- _descriptiveText = "vless-tcp-tls";
- break;
- case XrayType.VLESS_TCP_XTLS:
- _protocol = "vless";
- _type = "tcp";
- _security = "xtls";
- _descriptiveText = "vless-tcp-xtls";
- break;
- case XrayType.VLESS_WS:
- _protocol = "vless";
- _type = "ws";
- _path = settings.VLESS_WS_Path;
- _descriptiveText = "vless-ws-tls";
- break;
- case XrayType.VLESS_KCP:
- _protocol = "vless";
- _type = "kcp";
- _headerType = settings.VLESS_KCP_Type;
- _seed = settings.VLESS_KCP_Seed;
- _port = settings.VLESS_KCP_Port;
- _security = "none";
- _descriptiveText = "vless-mKCP";
- break;
- case XrayType.VLESS_gRPC:
- _protocol = "vless";
- _type = "grpc";
- _path = settings.VLESS_gRPC_ServiceName;
- _descriptiveText = "vless-gRPC";
- break;
- case XrayType.Trojan_TCP:
- _protocol = "trojan";
- _uuid = settings.TrojanPassword;
- _descriptiveText = "trojan-tcp";
- break;
- default:
- throw new Exception("暂未实现的协议");
- }
-
-
- string parametersURL = string.Empty;
- if (xrayType != XrayType.Trojan_TCP)
- {
- // 4.3 传输层相关段
- parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}";
-
- // kcp
- if (xrayType == XrayType.VLESS_KCP)
- {
- parametersURL += $"&seed={_seed}";
- }
-
- // 4.4 TLS 相关段
- if (xrayType == XrayType.VLESS_TCP_XTLS)
- {
- parametersURL += "&flow=xtls-rprx-direct";
- }
- }
-
-
- return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
- }
-
- }
-
-
-
- class Vmess
- {
- public string v { get; set; }
- public string ps { get; set; }
- public string add { get; set; }
- public string port { get; set; }
- public string id { get; set; }
- public string aid { get; set; }
- public string net { get; set; }
- public string type { get; set; }
- public string host { get; set; }
- public string path { get; set; }
- public string tls { get; set; }
- }
-}
diff --git a/ProxySU_Core/Models/XrayType.cs b/ProxySU_Core/Models/XrayType.cs
deleted file mode 100644
index 6611113..0000000
--- a/ProxySU_Core/Models/XrayType.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.Models
-{
- public enum XrayType
- {
- // 入口
- VLESS_TCP_XTLS = 100,
-
- // VLESS 101开头
- VLESS_TCP = 101,
- VLESS_WS = 102,
- VLESS_H2 = 103,
- VLESS_KCP = 104,
- VLESS_gRPC = 110,
-
- // VMESS 201开头
- VMESS_TCP = 201,
- VMESS_WS = 202,
- VMESS_H2 = 203,
- VMESS_KCP = 204,
-
- // Trojan 301开头
- Trojan_TCP = 301,
- Trojan_WS = 302,
-
- // SS
- ShadowsocksAEAD = 401
- }
-}
diff --git a/ProxySU_Core/Properties/AssemblyInfo.cs b/ProxySU_Core/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2107e9b..0000000
--- a/ProxySU_Core/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 有关程序集的一般信息由以下
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("ProxySU_Core")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ProxySU_Core")]
-[assembly: AssemblyCopyright("Copyright © 2021")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 会使此程序集中的类型
-//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
-//请将此类型的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-//若要开始生成可本地化的应用程序,请设置
-//.csproj 文件中的 CultureYouAreCodingWith
-//例如,如果您在源文件中使用的是美国英语,
-//使用的是美国英语,请将 设置为 en-US。 然后取消
-//对以下 NeutralResourceLanguage 特性的注释。 更新
-//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //主题特定资源词典所处位置
- //(未在页面中找到资源时使用,
- //或应用程序资源字典中找到时使用)
- ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
- //(未在页面中找到资源时使用,
- //、应用程序或任何主题专用资源字典中找到时使用)
-)]
-
-
-// 程序集的版本信息由下列四个值组成:
-//
-// 主版本
-// 次版本
-// 生成号
-// 修订号
-//
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
-//通过使用 "*",如下所示:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.1.3.0")]
-[assembly: AssemblyFileVersion("3.1.3.0")]
diff --git a/ProxySU_Core/Properties/Resources.Designer.cs b/ProxySU_Core/Properties/Resources.Designer.cs
deleted file mode 100644
index e7f1775..0000000
--- a/ProxySU_Core/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 此代码由工具生成。
-// 运行时版本:4.0.30319.42000
-//
-// 对此文件的更改可能会导致不正确的行为,并且如果
-// 重新生成代码,这些更改将会丢失。
-//
-//------------------------------------------------------------------------------
-
-namespace ProxySU_Core.Properties {
- using System;
-
-
- ///
- /// 一个强类型的资源类,用于查找本地化的字符串等。
- ///
- // 此类是由 StronglyTypedResourceBuilder
- // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
- // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
- // (以 /str 作为命令选项),或重新生成 VS 项目。
- [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 {
-
- 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() {
- }
-
- ///
- /// 返回此类使用的缓存的 ResourceManager 实例。
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- 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 {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/ProxySU_Core/Properties/Resources.resx b/ProxySU_Core/Properties/Resources.resx
deleted file mode 100644
index af7dbeb..0000000
--- a/ProxySU_Core/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/Properties/Settings.Designer.cs b/ProxySU_Core/Properties/Settings.Designer.cs
deleted file mode 100644
index a45c35e..0000000
--- a/ProxySU_Core/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 此代码由工具生成。
-// 运行时版本:4.0.30319.42000
-//
-// 对此文件的更改可能会导致不正确的行为,并且如果
-// 重新生成代码,这些更改将会丢失。
-//
-//------------------------------------------------------------------------------
-
-namespace ProxySU_Core.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [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 {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/ProxySU_Core/Properties/Settings.settings b/ProxySU_Core/Properties/Settings.settings
deleted file mode 100644
index 033d7a5..0000000
--- a/ProxySU_Core/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/ProxySU.ico b/ProxySU_Core/ProxySU.ico
deleted file mode 100644
index 9d7a128..0000000
Binary files a/ProxySU_Core/ProxySU.ico and /dev/null differ
diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj
deleted file mode 100644
index aeca57f..0000000
--- a/ProxySU_Core/ProxySU_Core.csproj
+++ /dev/null
@@ -1,463 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {B066015C-D347-4493-92F1-6556D3863996}
- WinExe
- ProxySU_Core
- ProxySU_Core
- v4.7.2
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
- true
-
-
- false
- C:\Users\huife\Desktop\publish_new\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 1
- 1.0.0.%2a
- false
- true
- true
-
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- D529B8E43BC86188988D830C545B400612900BB3
-
-
- ProxySU_Core_TemporaryKey.pfx
-
-
- true
-
-
- false
-
-
- ProxySU.ico
-
-
-
- ..\packages\ControlzEx.5.0.0\lib\net452\ControlzEx.dll
-
-
- ..\packages\MahApps.Metro.2.4.5\lib\net46\MahApps.Metro.dll
-
-
- ..\packages\MaterialDesignColors.2.0.1\lib\net452\MaterialDesignColors.dll
-
-
- ..\packages\MaterialDesignThemes.MahApps.0.1.7\lib\net452\MaterialDesignThemes.MahApps.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
-
-
- ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\QRCoder.1.4.1\lib\net40\QRCoder.dll
-
-
- ..\packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ClientInfoWindow.xaml
-
-
- ShadowSocksControl.xaml
-
-
- Trojan_TCP_Control.xaml
-
-
- VLESS_gRPC_Control.xaml
-
-
- VLESS_KCP_Control.xaml
-
-
- VLESS_TCP_TLS_Control.xaml
-
-
- VLESS_WS_TLS_Control.xaml
-
-
- VLESS_XTLS_Control.xaml
-
-
- VMESS_KCP_Control.xaml
-
-
- VMESS_TCP_TLS_Control.xaml
-
-
- VMESS_WS_TLS_Control.xaml
-
-
- MainWindow.xaml
-
-
- RecordEditorWindow.xaml
-
-
- ServerInfoControl.xaml
-
-
- XrayEditorControl.xaml
-
-
- TerminalWindow.xaml
-
-
- TextBoxWindow.xaml
-
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
- 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/ProxySU_Core/Resources/Languages/en.xaml b/ProxySU_Core/Resources/Languages/en.xaml
deleted file mode 100644
index dc9d5ab..0000000
--- a/ProxySU_Core/Resources/Languages/en.xaml
+++ /dev/null
@@ -1,122 +0,0 @@
-
- Deployment
- Readme
-
- Language(语言)
- Chinese
- English
- Hosts
- Add Host
- Export Config
- Export Sub
- Random
-
-
-
- Selection
- Remark
- Host
- Port
- Proxy
- Actions
- Cnsole
- Config
- Edit
- Delete
-
-
- Actions
- Connect
- Edit
- Edit Xray
- Delete
- Install
- Save
- Save as
- Info
- Warning
- Error
-
-
-
- Server Editor
- Connection
- User
- Password
- Tag
- Host
- Port
- Method
- Password Login
- KeyLogin
- Key
- Upload
- Proxy
- Method
- None
- Http
- Socks5
- Host
- Port
- User
- Password
- Please enter host
- Please enter port
- Please enter proxy host
- Please enter proxy port
-
-
- VLESS over TCP With XTLS
Preferred
- VLESS over TCP with TLS
XTLS is Preferred
- VLESS over WS with TLS
Support CDN
- VLESS mKCP
low delay
- VMESS over WS with TLS
Support CDN
- VMESS mKCP
low delay
- ShadowSocks
Support CDN
- Trojan over TCP with TLS
Trojan
-
- Address
- GuiseHost
- UUID
- VLESS WS Path
- VLESS KCP Seed
- VLESS KCP Type
- VLESS KCP Port
- VMESS WS Path
- VMESS KCP Seed
- VMESS KCP Type
- VMESS KCP Port
- SS Pwd
- SS Method
- Trojan Pwd
- xray Port
- default port is 443
-
-
- Console
- xray/settings
- Install
- UpdateSettings
- UpdateXray
- UninstallXray
-
- cert/web
- UpdateCert
- UploadSelfCert
- UploadWebite
- UninstallCaddy
-
- Install: Finally output "please enjoy" to indicate completion, go to [Configuration] or [Config] to view the node
- Update Settings: After modifying the node configuration information, there is no need to reinstall, this function can update the configuration
- Update Cert: The certificate is automatically updated by default, but it is not guaranteed to be updated successfully. If it fails, please use [Update Cert] to update manually
- Upload website: Disguise the website, the correct static webpage must have an index.html file (please check), and then upload the website compressed package.
- The following is a static web page connection provided by netizens, please check whether there is an index.html file by yourself
-
-
-
-
- View Settings
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/Resources/Languages/zh_cn.xaml b/ProxySU_Core/Resources/Languages/zh_cn.xaml
deleted file mode 100644
index dc13120..0000000
--- a/ProxySU_Core/Resources/Languages/zh_cn.xaml
+++ /dev/null
@@ -1,120 +0,0 @@
-
- 应用布署
- 说明文档
-
- 语言(Language)
- 中文
- 英文
- 主机列表
- 添加主机
- 导出配置
- 导出订阅
- 随机
-
-
- 选择
- 别名
- 主机
- 端口
- 代理
- 操作
- 控制台
- 查看配置
- 编辑
- 删除
-
-
- 连接
- 安装
- 编辑
- 编辑模板
- 删除
- 保存
- 另存为
- 消息
- 提示
- 错误
-
-
- 服务器管理
- 连接
- 用户名
- 密码
- 别名
- 主机
- 端口
- 登陆方式
- 密码登陆
- 密钥登陆
- 密钥
- 上传
- 代理
- 类型
- 无
- 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,不建议修改
-
-
-
-
- 控制台
- 内核/配置
- 一键安装
- 更新配置
- 更新xray内核
- 卸载代理
-
- 证书/网站
- 续签证书
- 上传自有证书
- 上传网站
- 卸载Caddy
-
- 一键安装: 最后输出 “请尽情享用” 表示完成,到[查看配置]或[导出配置]查看节点
- 更新配置: 修改节点配置信息后,不需要重新安装,这个功能就可以更新配置了
- 续签证书: 证书默认是自动续签,但不保证都能续签成功,如果失败请用[续签证书]手动续签
- 上传网站: 伪装网站,正确的静态网页要有index.html文件(请检查),然后将网站压缩包上传。
- 如下是网友提供的静态网页连接,请自行检查是否有index.html文件
-
-
-
- 查看配置信息
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/Resources/ProxySU.ico b/ProxySU_Core/Resources/ProxySU.ico
deleted file mode 100644
index 9d7a128..0000000
Binary files a/ProxySU_Core/Resources/ProxySU.ico and /dev/null differ
diff --git a/ProxySU_Core/Resources/Styles/MaterialDesignThemes.Overrides.xaml b/ProxySU_Core/Resources/Styles/MaterialDesignThemes.Overrides.xaml
deleted file mode 100644
index 5909ff8..0000000
--- a/ProxySU_Core/Resources/Styles/MaterialDesignThemes.Overrides.xaml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/trojan-go/base.caddyfile b/ProxySU_Core/Templates/trojan-go/base.caddyfile
deleted file mode 100644
index 7975d73..0000000
--- a/ProxySU_Core/Templates/trojan-go/base.caddyfile
+++ /dev/null
@@ -1,9 +0,0 @@
-:##port## {
- root * /usr/share/caddy
- file_server
- ##reverse_proxy##
-}
-
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/trojan-go/trojan-go.json b/ProxySU_Core/Templates/trojan-go/trojan-go.json
deleted file mode 100644
index acb0207..0000000
--- a/ProxySU_Core/Templates/trojan-go/trojan-go.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "run_type": "server",
- "local_addr": "0.0.0.0",
- "local_port": 443,
- "remote_addr": "127.0.0.1",
- "remote_port": 80,
- "password": [
- ""
- ],
- "ssl": {
- "cert": "/usr/local/etc/trojan-go/trojan-go.crt",
- "key": "/usr/local/etc/trojan-go/trojan-go.key",
- "sni": ""
- }
-
-}
diff --git a/ProxySU_Core/Templates/xray/base.json b/ProxySU_Core/Templates/xray/base.json
deleted file mode 100644
index 84a9d1f..0000000
--- a/ProxySU_Core/Templates/xray/base.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "log": {},
- "api": {},
- "dns": {},
- "routing": {},
- "policy": {},
- "inbounds": [],
- "outbounds": [],
- "transport": {},
- "stats": {},
- "reverse": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/caddy/base.caddyfile b/ProxySU_Core/Templates/xray/caddy/base.caddyfile
deleted file mode 100644
index 7975d73..0000000
--- a/ProxySU_Core/Templates/xray/caddy/base.caddyfile
+++ /dev/null
@@ -1,9 +0,0 @@
-:##port## {
- root * /usr/share/caddy
- file_server
- ##reverse_proxy##
-}
-
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/00_log/00_log.json b/ProxySU_Core/Templates/xray/client/00_log/00_log.json
deleted file mode 100644
index 6a4cf00..0000000
--- a/ProxySU_Core/Templates/xray/client/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/01_api/01_api.json b/ProxySU_Core/Templates/xray/client/01_api/01_api.json
deleted file mode 100644
index aa1982b..0000000
--- a/ProxySU_Core/Templates/xray/client/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/02_dns/02_dns.json b/ProxySU_Core/Templates/xray/client/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/ProxySU_Core/Templates/xray/client/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/03_routing/03_routing.json b/ProxySU_Core/Templates/xray/client/03_routing/03_routing.json
deleted file mode 100644
index a187d31..0000000
--- a/ProxySU_Core/Templates/xray/client/03_routing/03_routing.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "routing": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/04_policy/04_policy.json b/ProxySU_Core/Templates/xray/client/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/ProxySU_Core/Templates/xray/client/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/05_inbounds/05_inbounds.json b/ProxySU_Core/Templates/xray/client/05_inbounds/05_inbounds.json
deleted file mode 100644
index c402972..0000000
--- a/ProxySU_Core/Templates/xray/client/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "inbounds": [
- {
- "protocol": "http",
- "port": 1081
- },
- {
- "port": 1080,
- "protocol": "socks",
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "settings": {
- "udp": true,
- "auth": "noauth"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/06_outbounds/06_outbounds.json b/ProxySU_Core/Templates/xray/client/06_outbounds/06_outbounds.json
deleted file mode 100644
index 20e2beb..0000000
--- a/ProxySU_Core/Templates/xray/client/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "outbounds": []
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_HTTP2_TLS.json b/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_HTTP2_TLS.json
deleted file mode 100644
index 8718383..0000000
--- a/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_HTTP2_TLS.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": "",
- "port": 443,
- "users": [
- {
- "id": "",
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "host": [
- ""
- ],
- "path": null
- }
- }
- }
- ]
-}
diff --git a/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_TCP_TLS_WS.json b/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_TCP_TLS_WS.json
deleted file mode 100644
index 7a3c871..0000000
--- a/ProxySU_Core/Templates/xray/client/06_outbounds/VLESS_TCP_TLS_WS.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": "",
- "port": 443,
- "users": [
- {
- "id": "",
- "encryption": "none",
- "level": 0
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "tlsSettings": {
- "serverName": ""
- },
- "wsSettings": {
- "path": ""
- }
- }
- }
- ]
-}
diff --git a/ProxySU_Core/Templates/xray/client/07_transport/07_transport.json b/ProxySU_Core/Templates/xray/client/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/ProxySU_Core/Templates/xray/client/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/08_stats/08_stats.json b/ProxySU_Core/Templates/xray/client/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0..0000000
--- a/ProxySU_Core/Templates/xray/client/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/client/09_reverse/09_reverse.json b/ProxySU_Core/Templates/xray/client/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/ProxySU_Core/Templates/xray/client/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/00_log/00_log.json b/ProxySU_Core/Templates/xray/server/00_log/00_log.json
deleted file mode 100644
index 40c2cd5..0000000
--- a/ProxySU_Core/Templates/xray/server/00_log/00_log.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "log": {
- "access": "none",
- "loglevel": "none"
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/01_api/01_api.json b/ProxySU_Core/Templates/xray/server/01_api/01_api.json
deleted file mode 100644
index 34c6b17..0000000
--- a/ProxySU_Core/Templates/xray/server/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/02_dns/02_dns.json b/ProxySU_Core/Templates/xray/server/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/ProxySU_Core/Templates/xray/server/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/03_routing/03_routing.json b/ProxySU_Core/Templates/xray/server/03_routing/03_routing.json
deleted file mode 100644
index 0aa4964..0000000
--- a/ProxySU_Core/Templates/xray/server/03_routing/03_routing.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/04_policy/04_policy.json b/ProxySU_Core/Templates/xray/server/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/ProxySU_Core/Templates/xray/server/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/05_inbounds.json b/ProxySU_Core/Templates/xray/server/05_inbounds/05_inbounds.json
deleted file mode 100644
index 24465ae..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "inbounds": []
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/Shadowsocks-AEAD.json b/ProxySU_Core/Templates/xray/server/05_inbounds/Shadowsocks-AEAD.json
deleted file mode 100644
index e7179e5..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/Shadowsocks-AEAD.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "port": 12345,
- "protocol": "shadowsocks",
- "settings": {
- "clients": [
- {
- "password": "",
- "method": "aes-128-gcm"
- }
- ],
- "network": "tcp,udp"
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json b/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json
deleted file mode 100644
index 8ea5ad9..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": ""
- }
- ],
- "fallbacks": [
- {
- "dest": 8080
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_WS.json b/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_WS.json
deleted file mode 100644
index 51d725c..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_WS.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "port": 1320,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": ""
- }
- ],
- "fallbacks": [
- {
- "dest": 80
- }
- ]
- },
-
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/trojanws"
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_HTTP2.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_HTTP2.json
deleted file mode 100644
index a99e848..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_HTTP2.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "decryption": "none",
- "clients": [
- {
- "id": ""
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": ""
- }
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_KCP.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_KCP.json
deleted file mode 100644
index a619549..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_KCP.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "port": 3456,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": "none"
- },
- "seed": null
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_TCP_XTLS.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_TCP_XTLS.json
deleted file mode 100644
index eab8363..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_TCP_XTLS.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "",
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": []
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "allowInsecure": false,
- "minVersion": "1.2",
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_WS.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_WS.json
deleted file mode 100644
index 0abf2e8..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_WS.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/websocket"
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json
deleted file mode 100644
index 319888d..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "port": 2002,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "grpc",
- "grpcSettings": {
- "serviceName": "",
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_HTTP2.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_HTTP2.json
deleted file mode 100644
index 9957e76..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_HTTP2.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": ""
- }
- }
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_KCP.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_KCP.json
deleted file mode 100644
index 0c3ea2b..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_KCP.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "port": 3456,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ]
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": "none"
- },
- "seed": null
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_TCP.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_TCP.json
deleted file mode 100644
index b14181e..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_TCP.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "port": 443,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp"
- ]
- }
- }
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_WS.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_WS.json
deleted file mode 100644
index 2e863a4..0000000
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VMESS_WS.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/vmessws"
- }
- }
-}
diff --git a/ProxySU_Core/Templates/xray/server/06_outbounds/06_outbounds.json b/ProxySU_Core/Templates/xray/server/06_outbounds/06_outbounds.json
deleted file mode 100644
index 467a4e1..0000000
--- a/ProxySU_Core/Templates/xray/server/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "block"
- }
- ]
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/07_transport/07_transport.json b/ProxySU_Core/Templates/xray/server/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/ProxySU_Core/Templates/xray/server/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/08_stats/08_stats.json b/ProxySU_Core/Templates/xray/server/08_stats/08_stats.json
deleted file mode 100644
index b406e15..0000000
--- a/ProxySU_Core/Templates/xray/server/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Templates/xray/server/09_reverse/09_reverse.json b/ProxySU_Core/Templates/xray/server/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/ProxySU_Core/Templates/xray/server/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/ProxySU_Core/Tools/DateTimeUtils.cs b/ProxySU_Core/Tools/DateTimeUtils.cs
deleted file mode 100644
index 32cb7b5..0000000
--- a/ProxySU_Core/Tools/DateTimeUtils.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace ProxySU_Core.Tools
-{
- public static class DateTimeUtils
- {
- ///
- /// 从国家授时中心获取标准GMT时间,读取https://www.tsa.cn
- /// GMT时间与UTC时间没有差别,可以UTC=GMT
- ///
- /// 返回网络时间
- public static DateTime GetUTCTime()
- {
- DateTime time;
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
- request.Method = "HEAD";
- request.AllowAutoRedirect = false;
- HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
- string cc = reponse.GetResponseHeader("date");
- reponse.Close();
-
- bool s = GMTStrParse(cc, out time);
- return time;
- }
- catch
- {
- return new DateTime(1970, 1, 1, 0, 0, 0, 0);
- }
- }
-
- public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串,这里转成datetime
- {
- CultureInfo enUS = new CultureInfo("en-US");
- bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
- return s;
- }
-
- //设置系统时间的API函数
- [DllImport("kernel32.dll")]
- private static extern bool SetLocalTime(ref SYSTEMTIME time);
-
- [StructLayout(LayoutKind.Sequential)]
- private struct SYSTEMTIME
- {
- public short year;
- public short month;
- public short dayOfWeek;
- public short day;
- public short hour;
- public short minute;
- public short second;
- public short milliseconds;
- }
-
- ///
- /// 设置系统时间
- ///
- /// 需要设置的时间
- /// 返回系统时间设置状态,true为成功,false为失败
- public static bool SetDate(DateTime dt)
- {
- SYSTEMTIME st;
-
- st.year = (short)dt.Year;
- st.month = (short)dt.Month;
- st.dayOfWeek = (short)dt.DayOfWeek;
- st.day = (short)dt.Day;
- st.hour = (short)dt.Hour;
- st.minute = (short)dt.Minute;
- st.second = (short)dt.Second;
- st.milliseconds = (short)dt.Millisecond;
- bool rt = SetLocalTime(ref st);
- return rt;
- }
- }
-}
diff --git a/ProxySU_Core/Tools/Extensions.cs b/ProxySU_Core/Tools/Extensions.cs
deleted file mode 100644
index 1c4af48..0000000
--- a/ProxySU_Core/Tools/Extensions.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace System
-{
- public static class Extensions
- {
- // Deep clone
- public static T DeepClone(this T obj)
- {
- if (obj == null)
- throw new ArgumentNullException("Object cannot be null");
- return (T)Process(obj);
- }
-
- static object Process(object obj)
- {
- if (obj == null)
- return null;
- Type type = obj.GetType();
- if (type.IsValueType || type == typeof(string))
- {
- return obj;
- }
- else if (type.IsArray)
- {
- Type elementType = Type.GetType(
- type.FullName.Replace("[]", string.Empty));
- var array = obj as Array;
- Array copied = Array.CreateInstance(elementType, array.Length);
- for (int i = 0; i < array.Length; i++)
- {
- copied.SetValue(Process(array.GetValue(i)), i);
- }
- return Convert.ChangeType(copied, obj.GetType());
- }
- else if (type.IsClass)
- {
- object toret = Activator.CreateInstance(obj.GetType());
- FieldInfo[] fields = type.GetFields(BindingFlags.Public |
- BindingFlags.NonPublic | BindingFlags.Instance);
- foreach (FieldInfo field in fields)
- {
- object fieldValue = field.GetValue(obj);
- if (fieldValue == null)
- continue;
- field.SetValue(toret, Process(fieldValue));
- }
- return toret;
- }
- else
- throw new ArgumentException("Unknown type");
- }
-
- }
-}
diff --git a/ProxySU_Core/ViewModels/BaseCommand.cs b/ProxySU_Core/ViewModels/BaseCommand.cs
deleted file mode 100644
index 21860cd..0000000
--- a/ProxySU_Core/ViewModels/BaseCommand.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Input;
-
-namespace ProxySU_Core.ViewModels
-{
- public class BaseCommand : ICommand
- {
- private readonly Action _execution;
- private readonly Func _canExecute;
-
- public BaseCommand(Action execution, Func canExecute = null)
- {
- _execution = execution;
- _canExecute = canExecute;
- }
-
-
-
- public event EventHandler CanExecuteChanged;
-
- public bool CanExecute(object parameter)
- {
- if (_canExecute == null)
- {
- return true;
- }
-
- return _canExecute(parameter);
- }
-
- public void Execute(object parameter)
- {
- if (_execution != null && CanExecute(parameter))
- {
- _execution.Invoke(parameter);
- }
- }
- }
-}
diff --git a/ProxySU_Core/ViewModels/BaseModel.cs b/ProxySU_Core/ViewModels/BaseModel.cs
deleted file mode 100644
index 5255ebb..0000000
--- a/ProxySU_Core/ViewModels/BaseModel.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.ViewModels
-{
- public class BaseViewModel2 : INotifyPropertyChanged
- {
-
- protected bool SetProperty(ref T backingStore, T value,
- string propertyName = "",
- Action onChanged = null)
- {
- if (EqualityComparer.Default.Equals(backingStore, value))
- return false;
-
- backingStore = value;
- onChanged?.Invoke();
- OnPropertyChanged(propertyName);
- return true;
- }
-
- #region INotifyPropertyChanged
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName = "")
- {
- var changed = PropertyChanged;
- if (changed == null)
- return;
-
- changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- #endregion
- }
-}
diff --git a/ProxySU_Core/ViewModels/BaseViewModel.cs b/ProxySU_Core/ViewModels/BaseViewModel.cs
deleted file mode 100644
index 1aa2f1c..0000000
--- a/ProxySU_Core/ViewModels/BaseViewModel.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Text;
-
-namespace ProxySU_Core.ViewModels
-{
- public abstract class BaseViewModel : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
-
- public void Notify(string propertyName)
- {
- if (PropertyChanged != null)
- {
- PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
-}
diff --git a/ProxySU_Core/ViewModels/HostViewModel.cs b/ProxySU_Core/ViewModels/HostViewModel.cs
deleted file mode 100644
index 04ceb62..0000000
--- a/ProxySU_Core/ViewModels/HostViewModel.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-using Microsoft.Win32;
-using Newtonsoft.Json;
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Windows;
-using System.Windows.Input;
-
-namespace ProxySU_Core.ViewModels
-{
- public class HostViewModel : BaseViewModel
- {
- public Host host;
-
- private readonly ICommand _selectKeyCommand;
-
-
- public HostViewModel(Host host)
- {
- _selectKeyCommand = new BaseCommand(obj => OpenFileDialog(obj));
- this.host = host;
- }
-
-
- public string Tag
- {
- get => host.Tag;
- set
- {
- host.Tag = value;
- Notify("Tag");
- }
- }
-
- public string Address
- {
- get => host.Address;
- set
- {
- host.Address = value;
- Notify("Address");
- }
- }
-
- public string UserName
- {
- get => host.UserName;
- set => host.UserName = value;
- }
-
- public string Password
- {
- get => host.Password;
- set => host.Password = value;
- }
-
- public int Port
- {
- get => host.Port;
- set => host.Port = value;
- }
-
- public string PrivateKeyPath
- {
- get => host.PrivateKeyPath;
- set => host.PrivateKeyPath = value;
- }
-
- public LocalProxy Proxy
- {
- get => host.Proxy;
- set
- {
- host.Proxy = value;
- Notify("Proxy");
- }
- }
-
- public LoginSecretType SecretType
- {
- get => host.SecretType;
- set
- {
- host.SecretType = value;
- Notify("SecretType");
- Notify("KeyUploaderVisiblity");
- Notify("PasswordVisiblity");
- }
- }
-
- [JsonIgnore]
- public Visibility PasswordVisiblity
- {
- get
- {
- if (SecretType == LoginSecretType.Password)
- {
- return Visibility.Visible;
- }
- return Visibility.Collapsed;
- }
- }
-
- [JsonIgnore]
- public Visibility KeyUploaderVisiblity
- {
- get
- {
- if (SecretType == LoginSecretType.PrivateKey)
- {
- return Visibility.Visible;
- }
- return Visibility.Collapsed;
- }
- }
-
-
- [JsonIgnore]
- public ICommand SelectKeyCommand
- {
- get
- {
- return _selectKeyCommand;
- }
- }
-
-
- private void OpenFileDialog(object obj)
- {
- var fileDialog = new OpenFileDialog();
- fileDialog.FileOk += OnFileOk;
- fileDialog.ShowDialog();
- }
-
- private void OnFileOk(object sender, CancelEventArgs e)
- {
- var file = sender as OpenFileDialog;
- PrivateKeyPath = file.FileName;
- }
- }
-
-
-}
diff --git a/ProxySU_Core/ViewModels/IdValueViewModel.cs b/ProxySU_Core/ViewModels/IdValueViewModel.cs
deleted file mode 100644
index d7b8fbf..0000000
--- a/ProxySU_Core/ViewModels/IdValueViewModel.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.ViewModels
-{
- public class IdValueViewModel
- {
- public IdValueViewModel(int id, string value)
- {
- Id = id;
- Value = value;
- }
-
- public int Id { get; set; }
-
- public string Value { get; set; }
- }
-}
diff --git a/ProxySU_Core/ViewModels/RecordViewModel.cs b/ProxySU_Core/ViewModels/RecordViewModel.cs
deleted file mode 100644
index e2270be..0000000
--- a/ProxySU_Core/ViewModels/RecordViewModel.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProxySU_Core.ViewModels
-{
- public class RecordViewModel : BaseViewModel
- {
- public Record record;
- private bool _isChecked;
-
- public RecordViewModel(Record record)
- {
- this.record = record;
- this._isChecked = false;
- }
-
- public bool IsChecked
- {
- get => _isChecked;
- set
- {
- _isChecked = value;
- Notify("IsChecked");
- }
- }
-
- public Host Host
- {
- get => record.Host;
- set
- {
- record.Host = value;
- Notify("Host");
- }
- }
-
- public XraySettings Settings
- {
- get => record.Settings;
- set
- {
- record.Settings = value;
- Notify("Settings");
- }
- }
-
- public void Notify()
- {
- Notify("Host");
- Notify("Settings");
- }
- }
-}
diff --git a/ProxySU_Core/ViewModels/Terminal.cs b/ProxySU_Core/ViewModels/Terminal.cs
deleted file mode 100644
index 1f2a92a..0000000
--- a/ProxySU_Core/ViewModels/Terminal.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
-
-namespace ProxySU_Core.ViewModels
-{
- public class Terminal : BaseViewModel
- {
- private bool hasConnected;
-
- public Terminal(Host host)
- {
- Host = host;
- HasConnected = false;
- }
-
- public bool HasConnected
- {
- get
- {
- return hasConnected;
- }
- set
- {
- hasConnected = value;
- Notify("HasConnected");
- }
- }
-
- public Host Host { get; set; }
-
- public string CommandText { get; set; }
-
- public string OutputText { get; set; }
- }
-}
diff --git a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
deleted file mode 100644
index 78826a8..0000000
--- a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
+++ /dev/null
@@ -1,399 +0,0 @@
-using Newtonsoft.Json;
-using ProxySU_Core.Common;
-using ProxySU_Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-
-namespace ProxySU_Core.ViewModels
-{
- public partial class XraySettingsViewModel : BaseViewModel
- {
- public XraySettings settings;
- private readonly ICommand _randomUuid;
-
- public XraySettingsViewModel(XraySettings parameters)
- {
- _randomUuid = new BaseCommand((obj) => GetUuid());
- this.settings = parameters;
- Notify("VMESS_KCP_Type");
- }
-
- public ICommand RandomUuid
- {
- get
- {
- return _randomUuid;
- }
- }
-
-
- public int Port
- {
- get => settings.Port;
- set
- {
- settings.Port = value;
- Notify("Port");
- }
- }
-
- public int VLESS_KCP_Port
- {
- get => settings.VLESS_KCP_Port;
- set
- {
- settings.VLESS_KCP_Port = value;
- Notify("VLESS_KCP_Port");
- }
- }
-
- public int VMESS_KCP_Port
- {
- get => settings.VMESS_KCP_Port;
- set
- {
- settings.VMESS_KCP_Port = value;
- Notify("VMESS_KCP_Port");
- }
- }
-
- public int ShadowSocksPort
- {
- get => settings.ShadowSocksPort;
- set
- {
- settings.VMESS_KCP_Port = value;
- Notify("ShadowSocksPort");
- }
- }
-
-
- public string UUID
- {
- get => settings.UUID;
- set
- {
- settings.UUID = value;
- Notify("UUID");
- }
- }
-
- public string Domain
- {
- get => settings.Domain;
- set
- {
- settings.Domain = value;
- Notify("Domain");
- }
- }
-
- public string MaskDomain
- {
- get => settings.MaskDomain;
- set
- {
- settings.MaskDomain = value;
- Notify("MaskDomain");
- }
- }
-
- public string TrojanPassword
- {
- get => settings.TrojanPassword;
- set => settings.TrojanPassword = value;
- }
- public bool Checked_Trojan_TCP
- {
- get
- {
- return settings.Types.Contains(XrayType.Trojan_TCP);
- }
- set
- {
- if (value == true)
- {
- if (!settings.Types.Contains(XrayType.Trojan_TCP))
- settings.Types.Add(XrayType.Trojan_TCP);
- }
- else
- {
- settings.Types.Remove(XrayType.Trojan_TCP);
- }
- Notify("Checked_Trojan_TCP");
- }
- }
- public string Trojan_TCP_ShareLink
- {
- get => ShareLink.Build(XrayType.Trojan_TCP, settings);
- }
-
- private List _ssMethods = new List { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" };
- public List ShadowSocksMethods => _ssMethods;
- public bool CheckedShadowSocks
- {
-
- get => settings.Types.Contains(XrayType.ShadowsocksAEAD);
- set
- {
- CheckBoxChanged(value, XrayType.ShadowsocksAEAD);
- Notify("CheckedShadowSocks");
- }
- }
- public string ShadowSocksPassword
- {
- get => settings.ShadowsocksPassword;
- set => settings.ShadowsocksPassword = value;
- }
- public string ShadowSocksMethod
- {
- get => settings.ShadowsocksMethod;
- set
- {
- var namespaceStr = typeof(ComboBoxItem).FullName + ":";
- var trimValue = value.Replace(namespaceStr, "");
- trimValue = trimValue.Trim();
- settings.ShadowsocksMethod = trimValue;
- Notify("ShadowSocksMethod");
- }
- }
- public string ShadowSocksShareLink
- {
- get => ShareLink.Build(XrayType.ShadowsocksAEAD, settings);
- }
-
-
- private void CheckBoxChanged(bool value, XrayType type)
- {
- if (value == true)
- {
- if (!settings.Types.Contains(type))
- {
- settings.Types.Add(type);
- }
- }
- else
- {
- settings.Types.RemoveAll(x => x == type);
- }
- }
-
-
-
- private void GetUuid()
- {
- UUID = Guid.NewGuid().ToString();
- Notify("UUID");
- }
-
- }
-
- ///
- /// VMESS
- ///
- public partial class XraySettingsViewModel
- {
- // vmess tcp
- public bool Checked_VMESS_TCP
- {
- get => settings.Types.Contains(XrayType.VMESS_TCP);
- set
- {
- CheckBoxChanged(value, XrayType.VMESS_TCP);
- Notify("Checked_VMESS_TCP");
- }
- }
- public string VMESS_TCP_Path
- {
- get => settings.VMESS_TCP_Path;
- set => settings.VMESS_TCP_Path = value;
- }
- public string VMESS_TCP_ShareLink
- {
- get => ShareLink.Build(XrayType.VMESS_TCP, settings);
- }
-
- // vmess ws
- public bool Checked_VMESS_WS
- {
- get => settings.Types.Contains(XrayType.VMESS_WS);
- set
- {
- CheckBoxChanged(value, XrayType.VMESS_WS);
- Notify("Checked_VMESS_WS");
- }
- }
- public string VMESS_WS_Path
- {
- get => settings.VMESS_WS_Path;
- set => settings.VMESS_WS_Path = value;
- }
- public string VMESS_WS_ShareLink
- {
- get => ShareLink.Build(XrayType.VMESS_WS, settings);
- }
-
- // vmess kcp
- public string VMESS_KCP_Seed
- {
- get => settings.VMESS_KCP_Seed;
- set => settings.VMESS_KCP_Seed = value;
- }
- public string VMESS_KCP_Type
- {
- get => settings.VMESS_KCP_Type;
- set
- {
- var namespaceStr = typeof(ComboBoxItem).FullName + ":";
- var trimValue = value.Replace(namespaceStr, "");
- trimValue = trimValue.Trim();
- settings.VMESS_KCP_Type = trimValue;
- Notify("VMESS_KCP_Type");
- }
- }
- public bool Checked_VMESS_KCP
- {
- get => settings.Types.Contains(XrayType.VMESS_KCP);
- set
- {
- CheckBoxChanged(value, XrayType.VMESS_KCP);
- Notify("Checked_VMESS_KCP");
- }
- }
- public string VMESS_KCP_ShareLink
- {
- get => ShareLink.Build(XrayType.VMESS_KCP, settings);
- }
-
-
- private List _kcpTypes = new List { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard", };
- public List KcpTypes => _kcpTypes;
- }
-
- ///
- /// VLESS
- ///
- public partial class XraySettingsViewModel
- {
-
- // vless xtls
- public bool Checked_VLESS_TCP_XTLS
- {
- get => settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
- set
- {
- CheckBoxChanged(value, XrayType.VLESS_TCP_XTLS);
- Notify("Checked_VLESS_TCP_XTLS");
- }
- }
- public string VLESS_TCP_XTLS_ShareLink
- {
- get => ShareLink.Build(XrayType.VLESS_TCP_XTLS, settings);
- }
-
- // vless tcp
- public bool Checked_VLESS_TCP
- {
- get => settings.Types.Contains(XrayType.VLESS_TCP);
- set
- {
- CheckBoxChanged(value, XrayType.VLESS_TCP);
- Notify("Checked_VLESS_TCP");
- }
- }
- public string VLESS_TCP_ShareLink
- {
- get => ShareLink.Build(XrayType.VLESS_TCP, settings);
- }
-
-
- // vless ws
- public string VLESS_WS_Path
- {
- get => settings.VLESS_WS_Path;
- set => settings.VLESS_WS_Path = value;
- }
- public bool Checked_VLESS_WS
- {
- get
- {
- return settings.Types.Contains(XrayType.VLESS_WS);
- }
- set
- {
- CheckBoxChanged(value, XrayType.VLESS_WS);
- Notify("Checked_VLESS_WS");
- }
- }
- public string VLESS_WS_ShareLink
- {
- get => ShareLink.Build(XrayType.VLESS_WS, settings);
- }
-
- // vless kcp
- public string VLESS_KCP_Seed
- {
- get => settings.VLESS_KCP_Seed;
- set => settings.VLESS_KCP_Seed = value;
- }
- public string VLESS_KCP_Type
- {
- get => settings.VLESS_KCP_Type;
- set
- {
- var namespaceStr = typeof(ComboBoxItem).FullName + ":";
- var trimValue = value.Replace(namespaceStr, "");
- trimValue = trimValue.Trim();
- settings.VLESS_KCP_Type = trimValue;
- Notify("VLESS_KCP_Type");
- }
- }
- public bool Checked_VLESS_KCP
- {
- get => settings.Types.Contains(XrayType.VLESS_KCP);
- set
- {
- CheckBoxChanged(value, XrayType.VLESS_KCP);
- Notify("Checked_VLESS_KCP");
- }
- }
- public string VLESS_KCP_ShareLink
- {
- get => ShareLink.Build(XrayType.VLESS_KCP, settings);
- }
-
- // vless grpc
- public string VLESS_gRPC_ServiceName
- {
- get => settings.VLESS_gRPC_ServiceName;
- set => settings.VLESS_gRPC_ServiceName = value;
- }
- public int VLESS_gRPC_Port
- {
- get => settings.VLESS_gRPC_Port;
- set => settings.VLESS_gRPC_Port = value;
- }
- public bool Checked_VLESS_gRPC
- {
- get => settings.Types.Contains(XrayType.VLESS_gRPC);
- set
- {
- CheckBoxChanged(value, XrayType.VLESS_gRPC);
- Notify("Checked_VLESS_gRPC");
- }
- }
- public string VLESS_gRPC_ShareLink
- {
- get => ShareLink.Build(XrayType.VLESS_gRPC, settings);
- }
- }
-
-}
diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml
deleted file mode 100644
index d95b8cb..0000000
--- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs
deleted file mode 100644
index 518fa9f..0000000
--- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using Microsoft.Win32;
-using ProxySU_Core.Models;
-using ProxySU_Core.ViewModels;
-using QRCoder;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.IO;
-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.Controls
-{
- ///
- /// ClientInfoWindow.xaml 的交互逻辑
- ///
- public partial class ClientInfoWindow
- {
- public XraySettingsViewModel Settings { get; set; }
-
- public ClientInfoWindow(Record record)
- {
- InitializeComponent();
- ResizeMode = ResizeMode.NoResize;
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
-
- 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/Views/ClientInfo/ShadowSocksControl.xaml b/ProxySU_Core/Views/ClientInfo/ShadowSocksControl.xaml
deleted file mode 100644
index 1580a51..0000000
--- a/ProxySU_Core/Views/ClientInfo/ShadowSocksControl.xaml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/ShadowSocksControl.xaml.cs b/ProxySU_Core/Views/ClientInfo/ShadowSocksControl.xaml.cs
deleted file mode 100644
index f4d3175..0000000
--- a/ProxySU_Core/Views/ClientInfo/ShadowSocksControl.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// ShadowSocksClientInfoControl.xaml 的交互逻辑
- ///
- public partial class ShadowSocksControl : UserControl
- {
- public ShadowSocksControl()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml b/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml
deleted file mode 100644
index 822d0f4..0000000
--- a/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml.cs
deleted file mode 100644
index 3701ab9..0000000
--- a/ProxySU_Core/Views/ClientInfo/Trojan_TCP_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// Trojan_TCP_Control.xaml 的交互逻辑
- ///
- public partial class Trojan_TCP_Control : UserControl
- {
- public Trojan_TCP_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml b/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml
deleted file mode 100644
index d0c331c..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml.cs
deleted file mode 100644
index 414c4b1..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_KCP_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VLESS_KCP_Control.xaml 的交互逻辑
- ///
- public partial class VLESS_KCP_Control : UserControl
- {
- public VLESS_KCP_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml b/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml
deleted file mode 100644
index 8b7eeec..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml.cs
deleted file mode 100644
index c147188..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_TCP_TLS_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VLESS_TCP_TLS_Control.xaml 的交互逻辑
- ///
- public partial class VLESS_TCP_TLS_Control : UserControl
- {
- public VLESS_TCP_TLS_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml b/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml
deleted file mode 100644
index 257ef57..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml.cs
deleted file mode 100644
index 7e3f8a9..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_WS_TLS_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VLESS_WS_TLS_Control.xaml 的交互逻辑
- ///
- public partial class VLESS_WS_TLS_Control : UserControl
- {
- public VLESS_WS_TLS_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml b/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml
deleted file mode 100644
index f601d8f..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml.cs
deleted file mode 100644
index 185f6a1..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_XTLS_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VLESS_XTLS_Control.xaml 的交互逻辑
- ///
- public partial class VLESS_XTLS_Control : UserControl
- {
- public VLESS_XTLS_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml b/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml
deleted file mode 100644
index 9e731e5..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml.cs
deleted file mode 100644
index 2b346ae..0000000
--- a/ProxySU_Core/Views/ClientInfo/VLESS_gRPC_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VLESS_gRPC_Control.xaml 的交互逻辑
- ///
- public partial class VLESS_gRPC_Control : UserControl
- {
- public VLESS_gRPC_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml b/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml
deleted file mode 100644
index 461765e..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml.cs
deleted file mode 100644
index 0dccb5a..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_KCP_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VMESS_KCP_Control.xaml 的交互逻辑
- ///
- public partial class VMESS_KCP_Control : UserControl
- {
- public VMESS_KCP_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml b/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml
deleted file mode 100644
index a651729..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml.cs
deleted file mode 100644
index 12714fa..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_TCP_TLS_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VMESS_TCP_TLS_Control.xaml 的交互逻辑
- ///
- public partial class VMESS_TCP_TLS_Control : UserControl
- {
- public VMESS_TCP_TLS_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml b/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml
deleted file mode 100644
index 37b9882..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml.cs b/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml.cs
deleted file mode 100644
index f8502d9..0000000
--- a/ProxySU_Core/Views/ClientInfo/VMESS_WS_TLS_Control.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySuper.WPF.Controls
-{
- ///
- /// VMESS_WS_TLS_Control.xaml 的交互逻辑
- ///
- public partial class VMESS_WS_TLS_Control : UserControl
- {
- public VMESS_WS_TLS_Control()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/MainWindow.xaml b/ProxySU_Core/Views/MainWindow.xaml
deleted file mode 100644
index a047a62..0000000
--- a/ProxySU_Core/Views/MainWindow.xaml
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
-
- github
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/MainWindow.xaml.cs b/ProxySU_Core/Views/MainWindow.xaml.cs
deleted file mode 100644
index 1137066..0000000
--- a/ProxySU_Core/Views/MainWindow.xaml.cs
+++ /dev/null
@@ -1,220 +0,0 @@
-using MahApps.Metro.Controls.Dialogs;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
-using ProxySU_Core.Common;
-using ProxySU_Core.Models;
-using ProxySU_Core.ViewModels;
-using ProxySU_Core.Views;
-using ProxySuper.WPF.Controls;
-using ProxySU_Core.Views.RecordEditor;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-
-
-namespace ProxySU_Core
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow
- {
- private const string RecordPath = @"Data\Record.json";
- private const string SettingsPath = @"Data\AppSettings.json";
-
- private const string ZH_CN = "zh_cn";
- private const string EN = "en";
-
- public ObservableCollection Records { get; set; }
-
- public MainWindow()
- {
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
- InitializeComponent();
-
- Records = new ObservableCollection();
- LoadRecords();
-
- DataContext = this;
- }
-
- protected override void OnClosed(EventArgs e)
- {
- base.OnClosed(e);
- this.SaveRecord();
- }
-
- private void LoadRecords()
- {
- if (File.Exists(RecordPath))
- {
- var recordsJson = File.ReadAllText(RecordPath, Encoding.UTF8);
- if (!string.IsNullOrEmpty(recordsJson))
- {
- var records = JsonConvert.DeserializeObject>(recordsJson);
- records.ForEach(item =>
- {
- Records.Add(new RecordViewModel(item));
- });
- }
- }
- }
-
- private void SaveRecord()
- {
- var recordList = Records.Select(x => x.record);
- var json = JsonConvert.SerializeObject(recordList,
- Formatting.Indented,
- new JsonSerializerSettings
- {
- ContractResolver = new CamelCasePropertyNamesContractResolver()
- });
- if (!Directory.Exists("Data"))
- {
- Directory.CreateDirectory("Data");
- }
- File.WriteAllText(RecordPath, json, Encoding.UTF8);
- }
-
- private void LaunchGitHubSite(object sender, RoutedEventArgs e)
- {
- System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU");
- }
-
- private void LaunchCoffeeSite(object sender, RoutedEventArgs e)
- {
- System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU");
- }
-
-
- private void ChangeLanguage(object sender, SelectionChangedEventArgs e)
- {
- var selection = cmbLanguage.SelectedValue as ComboBoxItem;
-
- if (selection.Name == ZH_CN)
- {
- ChangeLanguage(ZH_CN);
-
- }
- else if (selection.Name == EN)
- {
- ChangeLanguage(EN);
- }
-
- }
-
- private void ChangeLanguage(string culture)
- {
- ResourceDictionary resource = new ResourceDictionary();
-
- if (string.Equals(culture, ZH_CN, StringComparison.OrdinalIgnoreCase))
- {
- resource.Source = new Uri(@"Resources\Languages\zh_cn.xaml", UriKind.Relative);
- }
-
- else if (string.Equals(culture, EN, StringComparison.OrdinalIgnoreCase))
- {
- resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative);
- }
-
- Application.Current.Resources.MergedDictionaries[0] = resource;
- }
-
- private void ExportXraySettings(object sender, RoutedEventArgs e)
- {
- StringBuilder sb = new StringBuilder();
- foreach (var record in Records.Where(x => x.IsChecked))
- {
- record.Settings.Types.ForEach(type =>
- {
- var link = ShareLink.Build(type, record.Settings);
- sb.AppendLine(link);
- });
- }
- var tbx = new TextBoxWindow("分享链接", sb.ToString());
- tbx.ShowDialog();
- }
-
- private void ExportXraySub(object sender, RoutedEventArgs e)
- {
- StringBuilder sb = new StringBuilder();
- foreach (var record in Records.Where(x => x.IsChecked))
- {
- record.Settings.Types.ForEach(type =>
- {
- var link = ShareLink.Build(type, record.Settings);
- sb.AppendLine(link);
- });
- }
- var result = Base64.Encode(sb.ToString());
- var tbx = new TextBoxWindow("订阅内容", result);
- tbx.ShowDialog();
- }
-
- private void AddHost(object sender, RoutedEventArgs e)
- {
- var newRecord = new Record();
- var hostWindow = new RecordEditorWindow(newRecord);
- var result = hostWindow.ShowDialog();
- if (result == true)
- {
- Records.Add(new RecordViewModel(newRecord));
- SaveRecord();
- }
- }
-
- private void EditHost(object sender, RoutedEventArgs e)
- {
- if (DataGrid.SelectedItem is RecordViewModel project)
- {
- var hostWindow = new RecordEditorWindow(project.record);
- var result = hostWindow.ShowDialog();
- if (result == true)
- {
- project.Notify();
- SaveRecord();
- }
- }
- }
-
- private void DeleteHost(object sender, RoutedEventArgs e)
- {
- if (DataGrid.SelectedItem is RecordViewModel project)
- {
- var result = MessageBox.Show($"您确认删除主机{project.Host.Tag}吗?", "提示", MessageBoxButton.OKCancel);
- if (result == MessageBoxResult.OK)
- {
- Records.Remove(project);
- SaveRecord();
- }
- }
- }
-
- private void ShowClientInfo(object sender, RoutedEventArgs e)
- {
- if (DataGrid.SelectedItem is RecordViewModel project)
- {
- var dialog = new ClientInfoWindow(project.record);
- dialog.ShowDialog();
- }
- }
-
-
- private void Connect(object sender, RoutedEventArgs e)
- {
- var project = DataGrid.SelectedItem as RecordViewModel;
- if (project == null)
- {
- DialogManager.ShowMessageAsync(this, "提示", "请选择一个服务器");
- }
-
- TerminalWindow terminalWindow = new TerminalWindow(project.record);
- terminalWindow.Show();
- }
- }
-}
diff --git a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml
deleted file mode 100644
index 5ba61f3..0000000
--- a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Trojan-Go 未完成(Not Implemented)
-
-
- Naive Proxy 未完成(Not Implemented)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml.cs b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml.cs
deleted file mode 100644
index 09d0524..0000000
--- a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using ProxySU_Core.Models;
-using ProxySU_Core.ViewModels;
-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 ProxySU_Core.Views.RecordEditor
-{
- ///
- /// RecordEditorWindow.xaml 的交互逻辑
- ///
- public partial class RecordEditorWindow
- {
- public Record Record { get; set; }
-
- public HostViewModel Host { get; set; }
-
- public XraySettingsViewModel Settings { get; set; }
-
- public EventHandler OnSaved;
-
- public RecordEditorWindow(Record record)
- {
- InitializeComponent();
- ResizeMode = ResizeMode.NoResize;
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
-
- this.Record = record;
- Host = new HostViewModel(record.Host.DeepClone());
- Settings = new XraySettingsViewModel(record.Settings.DeepClone());
- this.DataContext = this;
- }
-
- public void Save(object sender, RoutedEventArgs e)
- {
- Record.Host = Host.host;
- Record.Settings = Settings.settings;
- DialogResult = true;
- Close();
- }
-
- }
-}
diff --git a/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml b/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml
deleted file mode 100644
index 6833e93..0000000
--- a/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml.cs b/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml.cs
deleted file mode 100644
index ac95ae5..0000000
--- a/ProxySU_Core/Views/RecordEditor/ServerInfoControl.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySU_Core.Views.RecordEditor
-{
- ///
- /// ServerInfoControl.xaml 的交互逻辑
- ///
- public partial class ServerInfoControl : UserControl
- {
- public ServerInfoControl()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml
deleted file mode 100644
index ce10fe6..0000000
--- a/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml
+++ /dev/null
@@ -1,295 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml.cs b/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml.cs
deleted file mode 100644
index c1879a7..0000000
--- a/ProxySU_Core/Views/RecordEditor/XrayEditorControl.xaml.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-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.Navigation;
-using System.Windows.Shapes;
-
-namespace ProxySU_Core.Views.RecordEditor
-{
- ///
- /// XrayEditorControl.xaml 的交互逻辑
- ///
- public partial class XrayEditorControl : UserControl
- {
- public XrayEditorControl()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml b/ProxySU_Core/Views/TerminalWindow.xaml
deleted file mode 100644
index 8827e7f..0000000
--- a/ProxySU_Core/Views/TerminalWindow.xaml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Themezy
-
-
- One Page Love
-
-
- HTML5 UP
-
-
- template mo
-
-
-
-
-
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml.cs b/ProxySU_Core/Views/TerminalWindow.xaml.cs
deleted file mode 100644
index d279ab2..0000000
--- a/ProxySU_Core/Views/TerminalWindow.xaml.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-using MahApps.Metro.Controls.Dialogs;
-using Microsoft.Win32;
-using ProxySU_Core.Models;
-using ProxySU_Core.Models.Developers;
-using ProxySU_Core.ViewModels;
-using ProxySU_Core.Views;
-using Renci.SshNet;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-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 ProxySU_Core
-{
- ///
- /// TerminalWindow.xaml 的交互逻辑
- ///
- public partial class TerminalWindow
- {
- private Record Record { get; set; }
- private readonly Terminal _vm;
- private SshClient _sshClient;
-
- XrayProject project;
-
- public TerminalWindow(Record record)
- {
- InitializeComponent();
- ResizeMode = ResizeMode.NoResize;
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
-
- this.Record = record;
- _vm = new Terminal(record.Host);
- DataContext = _vm;
-
- Task.Factory.StartNew(() =>
- {
- try
- {
- OpenConnect(_vm.Host);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- });
- }
-
- protected override void OnClosed(EventArgs e)
- {
- base.OnClosed(e);
- _vm.HasConnected = false;
-
- if (_sshClient != null)
- _sshClient.Disconnect();
-
- if (_sshClient != null)
- _sshClient.Dispose();
- }
-
- 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);
- }
-
- }
-
- private void OpenConnect(Host host)
- {
-
- WriteOutput("正在登陆服务器 ...");
- var conneInfo = CreateConnectionInfo(host);
- _sshClient = new SshClient(conneInfo);
- try
- {
- _sshClient.Connect();
- }
- catch (Exception ex)
- {
- WriteOutput("登陆失败!");
- WriteOutput(ex.Message);
- return;
- }
- WriteOutput("登陆服务器成功!");
-
- _vm.HasConnected = true;
- project = new XrayProject(_sshClient, Record.Settings, WriteOutput);
- }
-
- private void WriteOutput(string outShell)
- {
- if (!outShell.EndsWith("\n"))
- {
- outShell += "\n";
- }
- Dispatcher.Invoke(() =>
- {
- OutputTextBox.AppendText(outShell);
- OutputTextBox.ScrollToEnd();
- });
- }
-
- private void Install(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.Install();
- });
- }
-
- private void UpdateXrayCore(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.UpdateXrayCore();
- });
- }
-
- private void UpdateXraySettings(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.UpdateXraySettings();
- });
- }
-
- private void InstallCert(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.InstallCertToXray();
- });
- }
-
- private void UninstallXray(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.UninstallProxy();
- });
- }
-
- private void UploadCert(object sender, RoutedEventArgs e)
- {
- var fileDialog = new OpenFileDialog();
- fileDialog.Filter = "压缩文件|*.zip";
- fileDialog.FileOk += DoUploadCert;
- fileDialog.ShowDialog();
- }
-
- private void UploadWeb(object sender, RoutedEventArgs e)
- {
- var fileDialog = new OpenFileDialog();
- fileDialog.Filter = "压缩文件|*.zip";
- fileDialog.FileOk += DoUploadWeb;
- fileDialog.ShowDialog();
- }
-
- private void UninstallCaddy(object sender, RoutedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- project.DoUninstallCaddy();
- });
- }
-
- private void DoUploadWeb(object sender, CancelEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- var file = sender as OpenFileDialog;
- using (var stream = file.OpenFile())
- {
- project.UploadWeb(stream);
- }
- });
- }
-
- private void DoUploadCert(object sender, CancelEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- var file = sender as OpenFileDialog;
- using (var stream = file.OpenFile())
- {
- project.UploadCert(stream);
- }
- });
- }
-
- private void OpenLink(object sender, RoutedEventArgs e)
- {
- Hyperlink link = sender as Hyperlink;
- Process.Start(new ProcessStartInfo(link.NavigateUri.AbsoluteUri));
- }
-
- }
-}
diff --git a/ProxySU_Core/Views/TextBoxWindow.xaml b/ProxySU_Core/Views/TextBoxWindow.xaml
deleted file mode 100644
index 1e10a5a..0000000
--- a/ProxySU_Core/Views/TextBoxWindow.xaml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
diff --git a/ProxySU_Core/Views/TextBoxWindow.xaml.cs b/ProxySU_Core/Views/TextBoxWindow.xaml.cs
deleted file mode 100644
index af105e2..0000000
--- a/ProxySU_Core/Views/TextBoxWindow.xaml.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-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 ProxySU_Core.Views
-{
- ///
- /// TextBoxWindow.xaml 的交互逻辑
- ///
- public partial class TextBoxWindow
- {
- public string Message { get; set; }
-
- public TextBoxWindow(string title, string message)
- {
- InitializeComponent();
- this.Title = title;
- this.Message = message;
-
- this.DataContext = this;
- }
- }
-}
diff --git a/ProxySU_Core/packages.config b/ProxySU_Core/packages.config
deleted file mode 100644
index 15ab180..0000000
--- a/ProxySU_Core/packages.config
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/TemplateConfg/naive/naive_client_config.json b/TemplateConfg/naive/naive_client_config.json
deleted file mode 100644
index 3592f59..0000000
--- a/TemplateConfg/naive/naive_client_config.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-"listen": "socks://127.0.0.1:1080",
-"proxy": "",
-"log": ""
-}
\ No newline at end of file
diff --git a/TemplateConfg/naive/naive_server.caddyfile b/TemplateConfg/naive/naive_server.caddyfile
deleted file mode 100644
index 188ba33..0000000
--- a/TemplateConfg/naive/naive_server.caddyfile
+++ /dev/null
@@ -1,14 +0,0 @@
-:443, ##domain##
-route {
- forward_proxy {
- ##basicauth##
- #basic_auth ##user## ##pass##
- hide_ip
- hide_via
- probe_resistance
- }
- file_server { root /usr/share/caddy }
-}
-##reverse_Proxy1##
-##reverse_Proxy2##
-##reverse_Proxy3##
\ No newline at end of file
diff --git a/TemplateConfg/naive/naive_server_config.json b/TemplateConfg/naive/naive_server_config.json
deleted file mode 100644
index a53b05d..0000000
--- a/TemplateConfg/naive/naive_server_config.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "apps": {
- "http": {
- "servers": {
- "srv0": {
- "listen": [
- ":443"
- ],
- "routes": [
- {
- "handle": [
- {
- "handler": "forward_proxy",
- "hide_ip": true,
- "hide_via": true,
- "auth_user": "",
- "auth_pass": "",
- "probe_resistance": {
- "domain": ""
- }
- }
- ]
- },
- {
- "match": [
- {
- "host": [
- ""
- ]
- }
- ],
- "handle": [
- {
- "handler": "file_server",
- "root": "/usr/share/caddy"
- }
- ],
- "terminal": true
- }
- ],
- "tls_connection_policies": [
- {
- "match": {
- "sni": [
- ""
- ]
- }
- }
- ]
- }
- }
- },
- "tls": {
- "automation": {
- "policies": [
- {
- "subjects": [
- ""
- ],
- "issuer": {
- "email": "",
- "module": "acme"
- }
- }
- ]
- }
- }
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/WebSocketTLSWeb.caddyfile b/TemplateConfg/ss/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index 7c97b69..0000000
--- a/TemplateConfg/ss/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @v2ray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @v2ray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile b/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile
deleted file mode 100644
index 4ace8e0..0000000
--- a/TemplateConfg/ss/ss_obfs_http_web_config.caddyfile
+++ /dev/null
@@ -1,7 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
diff --git a/TemplateConfg/ss/ss_server_config.json b/TemplateConfg/ss/ss_server_config.json
deleted file mode 100644
index cd115b4..0000000
--- a/TemplateConfg/ss/ss_server_config.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "server": "",
- "server_port": null,
- "password": "",
- "timeout": 300,
- "user": "nobody",
- "method": "",
- "fast_open": false,
- "nameserver": "1.0.0.1",
- "mode": "tcp",
- "plugin": "",
- "plugin_opts": ""
-}
\ No newline at end of file
diff --git a/TemplateConfg/ss/ss_tls_caddy_config.caddyfile b/TemplateConfg/ss/ss_tls_caddy_config.caddyfile
deleted file mode 100644
index d243b83..0000000
--- a/TemplateConfg/ss/ss_tls_caddy_config.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-https://##domain##:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/ssr/ssr_tls.caddyfile b/TemplateConfg/ssr/ssr_tls.caddyfile
deleted file mode 100644
index d243b83..0000000
--- a/TemplateConfg/ssr/ssr_tls.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-https://##domain##:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan-go/trojan-go.caddyfile b/TemplateConfg/trojan-go/trojan-go.caddyfile
deleted file mode 100644
index 0e9f3d2..0000000
--- a/TemplateConfg/trojan-go/trojan-go.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan-go/trojan-go_all_config.json b/TemplateConfg/trojan-go/trojan-go_all_config.json
deleted file mode 100644
index 0ca920c..0000000
--- a/TemplateConfg/trojan-go/trojan-go_all_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "run_type": "",
- "local_addr": "",
- "local_port": "",
- "remote_addr": "",
- "remote_port": "",
- "password": [
- ""
- ],
- "disable_http_check": true,
- "ssl": {
- "sni": "",
- "cert": "",
- "key": ""
- },
- "websocket": {
- "enabled": false,
- "path": "",
- "host": ""
- },
- "mux": {
- "enabled": false,
- "concurrency": 8,
- "idle_timeout": 60
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan/trojan.caddyfile b/TemplateConfg/trojan/trojan.caddyfile
deleted file mode 100644
index 0e9f3d2..0000000
--- a/TemplateConfg/trojan/trojan.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/trojan/trojan_client_config.json b/TemplateConfg/trojan/trojan_client_config.json
deleted file mode 100644
index cbe244f..0000000
--- a/TemplateConfg/trojan/trojan_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "run_type": "client",
- "local_addr": "127.0.0.1",
- "local_port": 1080,
- "remote_addr": null,
- "remote_port": 443,
- "password": [
- ""
- ],
- "log_level": 1,
- "ssl": {
- "verify": true,
- "verify_hostname": true,
- "cert": "",
- "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA",
- "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
- "sni": "",
- "alpn": [
- "h2",
- "http/1.1"
- ],
- "reuse_session": true,
- "session_ticket": false,
- "curves": ""
- },
- "tcp": {
- "no_delay": true,
- "keep_alive": true,
- "reuse_port": false,
- "fast_open": false,
- "fast_open_qlen": 20
- }
-}
diff --git a/TemplateConfg/trojan/trojan_server_config.json b/TemplateConfg/trojan/trojan_server_config.json
deleted file mode 100644
index ba5a6fa..0000000
--- a/TemplateConfg/trojan/trojan_server_config.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "run_type": "server",
- "local_addr": "::",
- "local_port": 443,
- "remote_addr": "127.0.0.1",
- "remote_port": 8800,
- "password": [
- ""
- ],
- "log_level": 1,
- "ssl": {
- "cert": "/usr/local/etc/trojan/trojan_ssl.crt",
- "key": "/usr/local/etc/trojan/trojan_ssl.key",
- "key_password": "",
- "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
- "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
- "prefer_server_cipher": true,
- "alpn": [
- "http/1.1"
- ],
- "alpn_port_override": {
- "h2": 81
- },
- "reuse_session": true,
- "session_ticket": false,
- "session_timeout": 600,
- "plain_http_response": "",
- "curves": "",
- "dhparam": ""
- },
- "tcp": {
- "prefer_ipv4": false,
- "no_delay": true,
- "keep_alive": true,
- "reuse_port": false,
- "fast_open": false,
- "fast_open_qlen": 20
- },
- "mysql": {
- "enabled": false,
- "server_addr": "127.0.0.1",
- "server_port": 3306,
- "database": "trojan",
- "username": "trojan",
- "password": "",
- "key": "",
- "cert": "",
- "ca": ""
- }
-}
diff --git a/TemplateConfg/v2ray/base.json b/TemplateConfg/v2ray/base.json
deleted file mode 100644
index 84a9d1f..0000000
--- a/TemplateConfg/v2ray/base.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "log": {},
- "api": {},
- "dns": {},
- "routing": {},
- "policy": {},
- "inbounds": [],
- "outbounds": [],
- "transport": {},
- "stats": {},
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/Http2Web.caddyfile b/TemplateConfg/v2ray/caddy/Http2Web.caddyfile
deleted file mode 100644
index 7e62dbc..0000000
--- a/TemplateConfg/v2ray/caddy/Http2Web.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
-
- reverse_proxy ##path## http://localhost:10000 {
- transport http {
- versions h2c 2
- }
- }
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile b/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index 7c97b69..0000000
--- a/TemplateConfg/v2ray/caddy/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @v2ray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @v2ray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile b/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile
deleted file mode 100644
index 0e9f3d2..0000000
--- a/TemplateConfg/v2ray/caddy/vlessTcpTlsWeb.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/00_log/00_log.json b/TemplateConfg/v2ray/client/00_log/00_log.json
deleted file mode 100644
index 6a4cf00..0000000
--- a/TemplateConfg/v2ray/client/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/01_api/01_api.json b/TemplateConfg/v2ray/client/01_api/01_api.json
deleted file mode 100644
index aa1982b..0000000
--- a/TemplateConfg/v2ray/client/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/02_dns/02_dns.json b/TemplateConfg/v2ray/client/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/TemplateConfg/v2ray/client/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/03_routing/03_routing.json b/TemplateConfg/v2ray/client/03_routing/03_routing.json
deleted file mode 100644
index a187d31..0000000
--- a/TemplateConfg/v2ray/client/03_routing/03_routing.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "routing": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/04_policy/04_policy.json b/TemplateConfg/v2ray/client/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/TemplateConfg/v2ray/client/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json b/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json
deleted file mode 100644
index dbce3dd..0000000
--- a/TemplateConfg/v2ray/client/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "inbounds": [
- {
- "protocol": "http",
- "port": 1081
- },
- {
- "port": 1080,
- "protocol": "socks",
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "settings": {
- "auth": "noauth"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json b/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json
deleted file mode 100644
index 20e2beb..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "outbounds": []
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json
deleted file mode 100644
index 849b04c..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/Http2Web_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json
deleted file mode 100644
index 7d7153e..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/Http2selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json
deleted file mode 100644
index a8eb804..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLSWeb_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
deleted file mode 100644
index ae02d4e..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json
deleted file mode 100644
index 32ed43c..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/WebSocket_TLS_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json
deleted file mode 100644
index c244f11..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/http2_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json
deleted file mode 100644
index 0e0aef2..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/mkcp_client_config.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json
deleted file mode 100644
index a863918..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/quic_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json
deleted file mode 100644
index cb6baab..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcpTLSselfSigned_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json
deleted file mode 100644
index 7b5f21a..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_TLS_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json
deleted file mode 100644
index bb64de1..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json
deleted file mode 100644
index 2f0ebf2..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/tcp_http_client_config.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "version": "1.1",
- "method": "GET",
- "path": [
- "/"
- ],
- "headers": {
- "Host": [
- "www.cloudflare.com",
- "www.amazon.com",
- "www.microsoft.com",
- "www.intel.com"
- ],
- "User-Agent": [
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
- ],
- "Accept-Encoding": [
- "gzip, deflate"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json b/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json
deleted file mode 100644
index 7eeeaa8..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/trojan_tcp_tls.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "trojan",
- "settings": {
- "servers": [
- {
- "address": null,
- "port": 443,
- "password": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "serverName": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 9b3f640..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json
deleted file mode 100644
index ec37bdc..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_mkcp_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
deleted file mode 100644
index 48bad1f..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json
deleted file mode 100644
index 8b4a9aa..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_tcp_xtls_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "flow": "xtls-rprx-direct",
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json
deleted file mode 100644
index a3782be..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vless_ws_tls_client_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json
deleted file mode 100644
index 126e25c..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/vmess_tcp_tls_client_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "path": [
- ""
- ]
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json b/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json
deleted file mode 100644
index 5fa0b2a..0000000
--- a/TemplateConfg/v2ray/client/06_outbounds/webSocket_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/07_transport/07_transport.json b/TemplateConfg/v2ray/client/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/TemplateConfg/v2ray/client/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/08_stats/08_stats.json b/TemplateConfg/v2ray/client/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0..0000000
--- a/TemplateConfg/v2ray/client/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/client/09_reverse/09_reverse.json b/TemplateConfg/v2ray/client/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/TemplateConfg/v2ray/client/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/00_log/00_log.json b/TemplateConfg/v2ray/server/00_log/00_log.json
deleted file mode 100644
index 6a4cf00..0000000
--- a/TemplateConfg/v2ray/server/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/01_api/01_api.json b/TemplateConfg/v2ray/server/01_api/01_api.json
deleted file mode 100644
index aa1982b..0000000
--- a/TemplateConfg/v2ray/server/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/02_dns/02_dns.json b/TemplateConfg/v2ray/server/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/TemplateConfg/v2ray/server/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/03_routing/03_routing.json b/TemplateConfg/v2ray/server/03_routing/03_routing.json
deleted file mode 100644
index 0aa4964..0000000
--- a/TemplateConfg/v2ray/server/03_routing/03_routing.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/04_policy/04_policy.json b/TemplateConfg/v2ray/server/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/TemplateConfg/v2ray/server/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json b/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json
deleted file mode 100644
index 2b9d236..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/00_padavan_router.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json b/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json
deleted file mode 100644
index 9a8d634..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "inbounds": []
-}
diff --git a/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json
deleted file mode 100644
index 077c799..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/Http2Web_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json
deleted file mode 100644
index 5f49a0f..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/Http2selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json
deleted file mode 100644
index 7c5f1a5..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLSWeb_server_config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
deleted file mode 100644
index cd4afba..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json
deleted file mode 100644
index f1e69f5..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/WebSocket_TLS_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json
deleted file mode 100644
index 818fb48..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/http2_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json
deleted file mode 100644
index bf8a13c..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json
deleted file mode 100644
index 9e28939..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/quic_server_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json
deleted file mode 100644
index 61e7ac8..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcpTLSselfSigned_server_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json
deleted file mode 100644
index 9686194..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_TLS_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json
deleted file mode 100644
index 11b896f..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_http_server_config.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "response": {
- "version": "1.1",
- "status": "200",
- "reason": "OK",
- "headers": {
- "Content-Type": [
- "application/octet-stream",
- "application/x-msdownload",
- "text/html",
- "application/x-shockwave-flash"
- ],
- "Transfer-Encoding": [
- "chunked"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json
deleted file mode 100644
index 25f5e52..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/tcp_server_config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 96bc51f..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json
deleted file mode 100644
index 4c7f4c2..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json
deleted file mode 100644
index 3dc0236..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_tls_server_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json
deleted file mode 100644
index 80ab7a8..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_tcp_xtls_server_config.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
deleted file mode 100644
index 4a5b0a6..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
+++ /dev/null
@@ -1,144 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 1310,
- "xver": 1
- },
- {
- "path": "/websocket",
- "dest": 1234,
- "xver": 1
- },
- {
- "path": "/vmesstcp",
- "dest": 2345,
- "xver": 1
- },
- {
- "path": "/vmessws",
- "dest": 3456,
- "xver": 1
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.crt",
- "keyFile": "/usr/local/etc/v2ray/ssl/v2ray_ssl.key"
- }
- ]
- }
- }
- },
- {
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": null
- }
- ],
- "fallbacks": [
- {
- "dest": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- },
- {
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/websocket"
- }
- }
- },
- {
- "port": 2345,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp"
- ]
- }
- }
- }
- }
- },
- {
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/vmessws"
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json
deleted file mode 100644
index fc398df..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/vless_ws_tls_server_config.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "path": ""
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json b/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json
deleted file mode 100644
index 42ffda2..0000000
--- a/TemplateConfg/v2ray/server/05_inbounds/webSocket_server_config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json b/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json
deleted file mode 100644
index 467a4e1..0000000
--- a/TemplateConfg/v2ray/server/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "block"
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/07_transport/07_transport.json b/TemplateConfg/v2ray/server/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/TemplateConfg/v2ray/server/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/08_stats/08_stats.json b/TemplateConfg/v2ray/server/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0..0000000
--- a/TemplateConfg/v2ray/server/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/v2ray/server/09_reverse/09_reverse.json b/TemplateConfg/v2ray/server/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/TemplateConfg/v2ray/server/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/base.json b/TemplateConfg/xray/base.json
deleted file mode 100644
index 84a9d1f..0000000
--- a/TemplateConfg/xray/base.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "log": {},
- "api": {},
- "dns": {},
- "routing": {},
- "policy": {},
- "inbounds": [],
- "outbounds": [],
- "transport": {},
- "stats": {},
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/Http2Web.caddyfile b/TemplateConfg/xray/caddy/Http2Web.caddyfile
deleted file mode 100644
index 7e62dbc..0000000
--- a/TemplateConfg/xray/caddy/Http2Web.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
-
- reverse_proxy ##path## http://localhost:10000 {
- transport http {
- versions h2c 2
- }
- }
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile b/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile
deleted file mode 100644
index bddb8f6..0000000
--- a/TemplateConfg/xray/caddy/WebSocketTLSWeb.caddyfile
+++ /dev/null
@@ -1,18 +0,0 @@
-##domain## {
- root * /usr/share/caddy
- file_server
- tls {
- protocols tls1.2 tls1.3
- ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- curves x25519
- }
- @xray_websocket {
- path ##path##
- header Connection *Upgrade*
- header Upgrade websocket
- }
- reverse_proxy @xray_websocket localhost:10000
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile b/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile
deleted file mode 100644
index 0e9f3d2..0000000
--- a/TemplateConfg/xray/caddy/vlessTcpTlsWeb.caddyfile
+++ /dev/null
@@ -1,10 +0,0 @@
-:8800 {
- root * /usr/share/caddy
- file_server
- ##reverse_Proxy1##
- ##reverse_Proxy2##
- ##reverse_Proxy3##
-}
-##domain##:80 {
- redir https://##domain##{uri}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/00_log/00_log.json b/TemplateConfg/xray/client/00_log/00_log.json
deleted file mode 100644
index 6a4cf00..0000000
--- a/TemplateConfg/xray/client/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/01_api/01_api.json b/TemplateConfg/xray/client/01_api/01_api.json
deleted file mode 100644
index aa1982b..0000000
--- a/TemplateConfg/xray/client/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/02_dns/02_dns.json b/TemplateConfg/xray/client/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/TemplateConfg/xray/client/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/03_routing/03_routing.json b/TemplateConfg/xray/client/03_routing/03_routing.json
deleted file mode 100644
index a187d31..0000000
--- a/TemplateConfg/xray/client/03_routing/03_routing.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "routing": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/04_policy/04_policy.json b/TemplateConfg/xray/client/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/TemplateConfg/xray/client/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/05_inbounds/05_inbounds.json b/TemplateConfg/xray/client/05_inbounds/05_inbounds.json
deleted file mode 100644
index dbce3dd..0000000
--- a/TemplateConfg/xray/client/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "inbounds": [
- {
- "protocol": "http",
- "port": 1081
- },
- {
- "port": 1080,
- "protocol": "socks",
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "settings": {
- "auth": "noauth"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/06_outbounds.json b/TemplateConfg/xray/client/06_outbounds/06_outbounds.json
deleted file mode 100644
index 20e2beb..0000000
--- a/TemplateConfg/xray/client/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "outbounds": []
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json b/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json
deleted file mode 100644
index 849b04c..0000000
--- a/TemplateConfg/xray/client/06_outbounds/Http2Web_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json
deleted file mode 100644
index 7d7153e..0000000
--- a/TemplateConfg/xray/client/06_outbounds/Http2selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "httpSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json
deleted file mode 100644
index a8eb804..0000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocketTLSWeb_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
deleted file mode 100644
index ae02d4e..0000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocketTLS_selfSigned_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- },
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json b/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json
deleted file mode 100644
index 32ed43c..0000000
--- a/TemplateConfg/xray/client/06_outbounds/WebSocket_TLS_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/http2_client_config.json b/TemplateConfg/xray/client/06_outbounds/http2_client_config.json
deleted file mode 100644
index c244f11..0000000
--- a/TemplateConfg/xray/client/06_outbounds/http2_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json
deleted file mode 100644
index 0e0aef2..0000000
--- a/TemplateConfg/xray/client/06_outbounds/mkcp_client_config.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/quic_client_config.json b/TemplateConfg/xray/client/06_outbounds/quic_client_config.json
deleted file mode 100644
index a863918..0000000
--- a/TemplateConfg/xray/client/06_outbounds/quic_client_config.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json
deleted file mode 100644
index cb6baab..0000000
--- a/TemplateConfg/xray/client/06_outbounds/tcpTLSselfSigned_client_config.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "allowInsecure": true
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json
deleted file mode 100644
index 7b5f21a..0000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_TLS_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json
deleted file mode 100644
index bb64de1..0000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json b/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json
deleted file mode 100644
index 2f0ebf2..0000000
--- a/TemplateConfg/xray/client/06_outbounds/tcp_http_client_config.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "version": "1.1",
- "method": "GET",
- "path": [
- "/"
- ],
- "headers": {
- "Host": [
- "www.cloudflare.com",
- "www.amazon.com",
- "www.microsoft.com",
- "www.intel.com"
- ],
- "User-Agent": [
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
- ],
- "Accept-Encoding": [
- "gzip, deflate"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json b/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json
deleted file mode 100644
index 7eeeaa8..0000000
--- a/TemplateConfg/xray/client/06_outbounds/trojan_tcp_tls.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "trojan",
- "settings": {
- "servers": [
- {
- "address": null,
- "port": 443,
- "password": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "serverName": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json b/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 9b3f640..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json
deleted file mode 100644
index ec37bdc..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_mkcp_client_config.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "kcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json b/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
deleted file mode 100644
index 48bad1f..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_tcp_tls_caddy_cilent_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json
deleted file mode 100644
index 8b4a9aa..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_tcp_xtls_client_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "flow": "xtls-rprx-direct",
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json
deleted file mode 100644
index a3782be..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vless_ws_tls_client_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "encryption": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json b/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json
deleted file mode 100644
index 126e25c..0000000
--- a/TemplateConfg/xray/client/06_outbounds/vmess_tcp_tls_client_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": 443,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "none"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tcpSettings": {
- "header": {
- "type": "http",
- "request": {
- "path": [
- ""
- ]
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json b/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json
deleted file mode 100644
index 5fa0b2a..0000000
--- a/TemplateConfg/xray/client/06_outbounds/webSocket_client_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "vmess",
- "settings": {
- "vnext": [
- {
- "address": null,
- "port": null,
- "users": [
- {
- "id": null,
- "alterId": 0,
- "security": "auto"
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/07_transport/07_transport.json b/TemplateConfg/xray/client/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/TemplateConfg/xray/client/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/08_stats/08_stats.json b/TemplateConfg/xray/client/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0..0000000
--- a/TemplateConfg/xray/client/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/client/09_reverse/09_reverse.json b/TemplateConfg/xray/client/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/TemplateConfg/xray/client/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/00_log/00_log.json b/TemplateConfg/xray/server/00_log/00_log.json
deleted file mode 100644
index 6a4cf00..0000000
--- a/TemplateConfg/xray/server/00_log/00_log.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "log": {
- "loglevel": "warning"
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/01_api/01_api.json b/TemplateConfg/xray/server/01_api/01_api.json
deleted file mode 100644
index aa1982b..0000000
--- a/TemplateConfg/xray/server/01_api/01_api.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "api": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/02_dns/02_dns.json b/TemplateConfg/xray/server/02_dns/02_dns.json
deleted file mode 100644
index 63472d2..0000000
--- a/TemplateConfg/xray/server/02_dns/02_dns.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "dns": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/03_routing/03_routing.json b/TemplateConfg/xray/server/03_routing/03_routing.json
deleted file mode 100644
index 0aa4964..0000000
--- a/TemplateConfg/xray/server/03_routing/03_routing.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "routing": {
- "domainStrategy": "AsIs",
- "rules": [
- {
- "type": "field",
- "ip": [
- "geoip:private"
- ],
- "outboundTag": "block"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/04_policy/04_policy.json b/TemplateConfg/xray/server/04_policy/04_policy.json
deleted file mode 100644
index 4beed61..0000000
--- a/TemplateConfg/xray/server/04_policy/04_policy.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "policy": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json b/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json
deleted file mode 100644
index 2b9d236..0000000
--- a/TemplateConfg/xray/server/05_inbounds/00_padavan_router.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/05_inbounds.json b/TemplateConfg/xray/server/05_inbounds/05_inbounds.json
deleted file mode 100644
index 9a8d634..0000000
--- a/TemplateConfg/xray/server/05_inbounds/05_inbounds.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "inbounds": []
-}
diff --git a/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json b/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json
deleted file mode 100644
index 077c799..0000000
--- a/TemplateConfg/xray/server/05_inbounds/Http2Web_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json
deleted file mode 100644
index 5f49a0f..0000000
--- a/TemplateConfg/xray/server/05_inbounds/Http2selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json
deleted file mode 100644
index 7c5f1a5..0000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocketTLSWeb_server_config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
deleted file mode 100644
index cd4afba..0000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocketTLS_selfSigned_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json b/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json
deleted file mode 100644
index 72b3a55..0000000
--- a/TemplateConfg/xray/server/05_inbounds/WebSocket_TLS_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "network": "ws",
- "wsSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/http2_server_config.json b/TemplateConfg/xray/server/05_inbounds/http2_server_config.json
deleted file mode 100644
index 79dec03..0000000
--- a/TemplateConfg/xray/server/05_inbounds/http2_server_config.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "h2",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "httpSettings": {
- "path": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json
deleted file mode 100644
index bf8a13c..0000000
--- a/TemplateConfg/xray/server/05_inbounds/mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/quic_server_config.json b/TemplateConfg/xray/server/05_inbounds/quic_server_config.json
deleted file mode 100644
index 9e28939..0000000
--- a/TemplateConfg/xray/server/05_inbounds/quic_server_config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "quic",
- "quicSettings": {
- "security": "chacha20-poly1305",
- "key": null,
- "header": {
- "type": null
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json
deleted file mode 100644
index 61e7ac8..0000000
--- a/TemplateConfg/xray/server/05_inbounds/tcpTLSselfSigned_server_config.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {}
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json
deleted file mode 100644
index d92148a..0000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_TLS_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- },
- "network": "tcp"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json
deleted file mode 100644
index 11b896f..0000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_http_server_config.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "tcpSettings": {
- "header": {
- "type": "http",
- "response": {
- "version": "1.1",
- "status": "200",
- "reason": "OK",
- "headers": {
- "Content-Type": [
- "application/octet-stream",
- "application/x-msdownload",
- "text/html",
- "application/x-shockwave-flash"
- ],
- "Transfer-Encoding": [
- "chunked"
- ],
- "Connection": [
- "keep-alive"
- ],
- "Pragma": "no-cache"
- }
- }
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json
deleted file mode 100644
index 25f5e52..0000000
--- a/TemplateConfg/xray/server/05_inbounds/tcp_server_config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json
deleted file mode 100644
index 96bc51f..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_http2_tls_server_config.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "h2",
- "security": "none",
- "httpSettings": {
- "path": null,
- "host": [
- ""
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json
deleted file mode 100644
index 4c7f4c2..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_mkcp_server_config.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "mkcp",
- "kcpSettings": {
- "uplinkCapacity": 100,
- "downlinkCapacity": 100,
- "congestion": true,
- "header": {
- "type": null
- },
- "seed": null
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json
deleted file mode 100644
index dc4e0e6..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_tcp_tls_server_config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "tls",
- "tlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json
deleted file mode 100644
index 040a74d..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_tcp_xtls_server_config.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 8800
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
deleted file mode 100644
index dcf7a4d..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_vmess_xtls_tcp_websocket_server_config.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "inbounds": [
- {
- "port": 443,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null,
- "flow": "xtls-rprx-direct"
- }
- ],
- "decryption": "none",
- "fallbacks": [
- {
- "dest": 1310,
- "xver": 1
- },
- {
- "path": "/websocket",
- "dest": 1234,
- "xver": 1
- },
- {
- "path": "/vmesstcp",
- "dest": 2345,
- "xver": 1
- },
- {
- "path": "/vmessws",
- "dest": 3456,
- "xver": 1
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "xtls",
- "xtlsSettings": {
- "alpn": [
- "http/1.1"
- ],
- "certificates": [
- {
- "certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
- "keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
- }
- ]
- }
- }
- },
- {
- "port": 1310,
- "listen": "127.0.0.1",
- "protocol": "trojan",
- "settings": {
- "clients": [
- {
- "password": null
- }
- ],
- "fallbacks": [
- {
- "dest": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true
- }
- }
- },
- {
- "port": 1234,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/websocket"
- }
- }
- },
- {
- "port": 2345,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "tcp",
- "security": "none",
- "tcpSettings": {
- "acceptProxyProtocol": true,
- "header": {
- "type": "http",
- "request": {
- "path": [
- "/vmesstcp"
- ]
- }
- }
- }
- }
- },
- {
- "port": 3456,
- "listen": "127.0.0.1",
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "acceptProxyProtocol": true,
- "path": "/vmessws"
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json b/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json
deleted file mode 100644
index fc398df..0000000
--- a/TemplateConfg/xray/server/05_inbounds/vless_ws_tls_server_config.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "inbounds": [
- {
- "port": 10000,
- "listen": "127.0.0.1",
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": ""
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "none",
- "wsSettings": {
- "path": ""
- }
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json b/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json
deleted file mode 100644
index 42ffda2..0000000
--- a/TemplateConfg/xray/server/05_inbounds/webSocket_server_config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "inbounds": [
- {
- "port": null,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": null,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/06_outbounds/06_outbounds.json b/TemplateConfg/xray/server/06_outbounds/06_outbounds.json
deleted file mode 100644
index 467a4e1..0000000
--- a/TemplateConfg/xray/server/06_outbounds/06_outbounds.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "outbounds": [
- {
- "protocol": "freedom",
- "tag": "direct"
- },
- {
- "protocol": "blackhole",
- "tag": "block"
- }
- ]
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/07_transport/07_transport.json b/TemplateConfg/xray/server/07_transport/07_transport.json
deleted file mode 100644
index 6269103..0000000
--- a/TemplateConfg/xray/server/07_transport/07_transport.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "transport": {}
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/08_stats/08_stats.json b/TemplateConfg/xray/server/08_stats/08_stats.json
deleted file mode 100644
index 02c9ed0..0000000
--- a/TemplateConfg/xray/server/08_stats/08_stats.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "stats": null
-}
\ No newline at end of file
diff --git a/TemplateConfg/xray/server/09_reverse/09_reverse.json b/TemplateConfg/xray/server/09_reverse/09_reverse.json
deleted file mode 100644
index 6fa38a4..0000000
--- a/TemplateConfg/xray/server/09_reverse/09_reverse.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "reverse": {}
-}
\ No newline at end of file
diff --git a/json.net/net40/Newtonsoft.Json.dll b/json.net/net40/Newtonsoft.Json.dll
deleted file mode 100644
index c2b16bb..0000000
Binary files a/json.net/net40/Newtonsoft.Json.dll and /dev/null differ
diff --git a/json.net/net40/Newtonsoft.Json.xml b/json.net/net40/Newtonsoft.Json.xml
deleted file mode 100644
index 0cbf62c..0000000
--- a/json.net/net40/Newtonsoft.Json.xml
+++ /dev/null
@@ -1,9646 +0,0 @@
-
-
-
- Newtonsoft.Json
-
-
-
-
- Represents a BSON Oid (object id).
-
-
-
-
- Gets or sets the value of the Oid.
-
- The value of the Oid.
-
-
-
- Initializes a new instance of the class.
-
- The Oid value.
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized BSON data.
-
-
-
-
- Gets or sets a value indicating whether binary data reading should be compatible with incorrect Json.NET 3.5 written binary.
-
-
- true if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the root object will be read as a JSON array.
-
-
- true if the root object will be read as a JSON array; otherwise, false .
-
-
-
-
- Gets or sets the used when reading values from BSON.
-
- The used when reading values from BSON.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
- if set to true the root object will be read as a JSON array.
- The used when reading values from BSON.
-
-
-
- Initializes a new instance of the class.
-
- The containing the BSON data to read.
- if set to true the root object will be read as a JSON array.
- The used when reading values from BSON.
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating BSON data.
-
-
-
-
- Gets or sets the used when writing values to BSON.
- When set to no conversion will occur.
-
- The used when writing values to BSON.
-
-
-
- Initializes a new instance of the class.
-
- The to write to.
-
-
-
- Initializes a new instance of the class.
-
- The to write to.
-
-
-
- Flushes whatever is in the buffer to the underlying and also flushes the underlying stream.
-
-
-
-
- Writes the end.
-
- The token.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes raw JSON where a value is expected and updates the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Closes this writer.
- If is set to true , the underlying is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value that represents a BSON object id.
-
- The Object ID value to write.
-
-
-
- Writes a BSON regex.
-
- The regex pattern.
- The regex options.
-
-
-
- Specifies how constructors are used when initializing objects during deserialization by the .
-
-
-
-
- First attempt to use the public default constructor, then fall back to a single parameterized constructor, then to the non-public default constructor.
-
-
-
-
- Json.NET will use a non-public default constructor before falling back to a parameterized constructor.
-
-
-
-
- Converts a binary value to and from a base 64 string value.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from JSON and BSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Creates a custom object.
-
- The object type to convert.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Creates an object which will then be populated by the serializer.
-
- Type of the object.
- The created object.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can write JSON.
-
-
- true if this can write JSON; otherwise, false .
-
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Provides a base class for converting a to and from JSON.
-
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a F# discriminated union type to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an Entity Framework to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can write JSON.
-
-
- true if this can write JSON; otherwise, false .
-
-
-
-
- Converts a to and from the ISO 8601 date format (e.g. "2008-04-12T12:53Z" ).
-
-
-
-
- Gets or sets the date time styles used when converting a date to and from JSON.
-
- The date time styles used when converting a date to and from JSON.
-
-
-
- Gets or sets the date time format used when converting a date to and from JSON.
-
- The date time format used when converting a date to and from JSON.
-
-
-
- Gets or sets the culture used when converting a date to and from JSON.
-
- The culture used when converting a date to and from JSON.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from a JavaScript Date constructor (e.g. new Date(52231943) ).
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from JSON and BSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts an to and from its name string value.
-
-
-
-
- Gets or sets a value indicating whether the written enum text should be camel case.
- The default value is false .
-
- true if the written enum text will be camel case; otherwise, false .
-
-
-
- Gets or sets the naming strategy used to resolve how enum text is written.
-
- The naming strategy used to resolve how enum text is written.
-
-
-
- Gets or sets a value indicating whether integer values are allowed when serializing and deserializing.
- The default value is true .
-
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- true if the written enum text will be camel case; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The naming strategy used to resolve how enum text is written.
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
-
- Initializes a new instance of the class.
-
- The of the used to write enum text.
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
- true if integers are allowed when serializing and deserializing; otherwise, false .
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts a to and from Unix epoch time
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Converts a to and from a string (e.g. "1.2.3.4" ).
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing property value of the JSON that is being converted.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Converts XML to and from JSON.
-
-
-
-
- Gets or sets the name of the root element to insert when deserializing to XML if the JSON structure has produced multiple root elements.
-
- The name of the deserialized root element.
-
-
-
- Gets or sets a value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- true if the array attribute is written to the XML; otherwise, false .
-
-
-
- Gets or sets a value indicating whether to write the root JSON object.
-
- true if the JSON root object is omitted; otherwise, false .
-
-
-
- Gets or sets a value indicating whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- true if special characters are encoded; otherwise, false .
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The calling serializer.
- The value.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Checks if the is a namespace attribute.
-
- Attribute name to test.
- The attribute name prefix if it has one, otherwise an empty string.
- true if attribute name is for a namespace attribute, otherwise false .
-
-
-
- Determines whether this instance can convert the specified value type.
-
- Type of the value.
-
- true if this instance can convert the specified value type; otherwise, false .
-
-
-
-
- Specifies how dates are formatted when writing JSON text.
-
-
-
-
- Dates are written in the ISO 8601 format, e.g. "2012-03-21T05:40Z" .
-
-
-
-
- Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/" .
-
-
-
-
- Specifies how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON text.
-
-
-
-
- Date formatted strings are not parsed to a date type and are read as strings.
-
-
-
-
- Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed to .
-
-
-
-
- Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed to .
-
-
-
-
- Specifies how to treat the time value when converting between string and .
-
-
-
-
- Treat as local time. If the object represents a Coordinated Universal Time (UTC), it is converted to the local time.
-
-
-
-
- Treat as a UTC. If the object represents a local time, it is converted to a UTC.
-
-
-
-
- Treat as a local time if a is being converted to a string.
- If a string is being converted to , convert to a local time if a time zone is specified.
-
-
-
-
- Time zone information should be preserved when converting.
-
-
-
-
- The default JSON name table implementation.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets a string containing the same characters as the specified range of characters in the given array.
-
- The character array containing the name to find.
- The zero-based index into the array specifying the first character of the name.
- The number of characters in the name.
- A string containing the same characters as the specified range of characters in the given array.
-
-
-
- Adds the specified string into name table.
-
- The string to add.
- This method is not thread-safe.
- The resolved string.
-
-
-
- Specifies default value handling options for the .
-
-
-
-
-
-
-
-
- Include members where the member value is the same as the member's default value when serializing objects.
- Included members are written to JSON. Has no effect when deserializing.
-
-
-
-
- Ignore members where the member value is the same as the member's default value when serializing objects
- so that it is not written to JSON.
- This option will ignore all default values (e.g. null for objects and nullable types; 0 for integers,
- decimals and floating point numbers; and false for booleans). The default value ignored can be changed by
- placing the on the property.
-
-
-
-
- Members with a default value but no JSON will be set to their default value when deserializing.
-
-
-
-
- Ignore members where the member value is the same as the member's default value when serializing objects
- and set members to their default value when deserializing.
-
-
-
-
- Specifies float format handling options when writing special floating point numbers, e.g. ,
- and with .
-
-
-
-
- Write special floating point values as strings in JSON, e.g. "NaN" , "Infinity" , "-Infinity" .
-
-
-
-
- Write special floating point values as symbols in JSON, e.g. NaN , Infinity , -Infinity .
- Note that this will produce non-valid JSON.
-
-
-
-
- Write special floating point values as the property's default value in JSON, e.g. 0.0 for a property, null for a of property.
-
-
-
-
- Specifies how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
-
-
-
-
- Floating point numbers are parsed to .
-
-
-
-
- Floating point numbers are parsed to .
-
-
-
-
- Specifies formatting options for the .
-
-
-
-
- No special formatting is applied. This is the default.
-
-
-
-
- Causes child objects to be indented according to the and settings.
-
-
-
-
- Provides an interface for using pooled arrays.
-
- The array type content.
-
-
-
- Rent an array from the pool. This array must be returned when it is no longer needed.
-
- The minimum required length of the array. The returned array may be longer.
- The rented array from the pool. This array must be returned when it is no longer needed.
-
-
-
- Return an array to the pool.
-
- The array that is being returned.
-
-
-
- Provides an interface to enable a class to return line and position information.
-
-
-
-
- Gets a value indicating whether the class can return line information.
-
-
- true if and can be provided; otherwise, false .
-
-
-
-
- Gets the current line number.
-
- The current line number or 0 if no line information is available (for example, when returns false ).
-
-
-
- Gets the current line position.
-
- The current line position or 0 if no line information is available (for example, when returns false ).
-
-
-
- Instructs the how to serialize the collection.
-
-
-
-
- Gets or sets a value indicating whether null items are allowed in the collection.
-
- true if null items are allowed in the collection; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with a flag indicating whether the array can contain null items.
-
- A flag indicating whether the array can contain null items.
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Instructs the to use the specified constructor when deserializing that object.
-
-
-
-
- Instructs the how to serialize the object.
-
-
-
-
- Gets or sets the id.
-
- The id.
-
-
-
- Gets or sets the title.
-
- The title.
-
-
-
- Gets or sets the description.
-
- The description.
-
-
-
- Gets or sets the collection's items converter.
-
- The collection's items converter.
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonContainer(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets a value that indicates whether to preserve object references.
-
-
- true to keep object reference; otherwise, false . The default is false .
-
-
-
-
- Gets or sets a value that indicates whether to preserve collection's items references.
-
-
- true to keep collection's items object references; otherwise, false . The default is false .
-
-
-
-
- Gets or sets the reference loop handling used when serializing the collection's items.
-
- The reference loop handling.
-
-
-
- Gets or sets the type name handling used when serializing the collection's items.
-
- The type name handling.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Provides methods for converting between .NET types and JSON types.
-
-
-
-
-
-
-
- Gets or sets a function that creates default .
- Default settings are automatically used by serialization methods on ,
- and and on .
- To serialize without using any default settings create a with
- .
-
-
-
-
- Represents JavaScript's boolean value true as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's boolean value false as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's null as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's undefined as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's positive infinity as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's negative infinity as a string. This field is read-only.
-
-
-
-
- Represents JavaScript's NaN as a string. This field is read-only.
-
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation using the specified.
-
- The value to convert.
- The format the date will be converted to.
- The time zone handling when the date is converted to a string.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation using the specified.
-
- The value to convert.
- The format the date will be converted to.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- The string delimiter character.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- The string delimiter character.
- The string escape handling.
- A JSON string representation of the .
-
-
-
- Converts the to its JSON string representation.
-
- The value to convert.
- A JSON string representation of the .
-
-
-
- Serializes the specified object to a JSON string.
-
- The object to serialize.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using formatting.
-
- The object to serialize.
- Indicates how the output should be formatted.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a collection of .
-
- The object to serialize.
- A collection of converters used while serializing.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using formatting and a collection of .
-
- The object to serialize.
- Indicates how the output should be formatted.
- A collection of converters used while serializing.
- A JSON string representation of the object.
-
-
-
- Serializes the specified object to a JSON string using .
-
- The object to serialize.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a type, formatting and .
-
- The object to serialize.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using formatting and .
-
- The object to serialize.
- Indicates how the output should be formatted.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- A JSON string representation of the object.
-
-
-
-
- Serializes the specified object to a JSON string using a type, formatting and .
-
- The object to serialize.
- Indicates how the output should be formatted.
- The used to serialize the object.
- If this is null , default serialization settings will be used.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
- A JSON string representation of the object.
-
-
-
-
- Deserializes the JSON to a .NET object.
-
- The JSON to deserialize.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to a .NET object using .
-
- The JSON to deserialize.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type.
-
- The JSON to deserialize.
- The of object being deserialized.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type.
-
- The type of the object to deserialize to.
- The JSON to deserialize.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the given anonymous type.
-
-
- The anonymous type to deserialize to. This can't be specified
- traditionally and must be inferred from the anonymous type passed
- as a parameter.
-
- The JSON to deserialize.
- The anonymous type object.
- The deserialized anonymous type from the JSON string.
-
-
-
- Deserializes the JSON to the given anonymous type using .
-
-
- The anonymous type to deserialize to. This can't be specified
- traditionally and must be inferred from the anonymous type passed
- as a parameter.
-
- The JSON to deserialize.
- The anonymous type object.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized anonymous type from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using a collection of .
-
- The type of the object to deserialize to.
- The JSON to deserialize.
- Converters to use while deserializing.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using .
-
- The type of the object to deserialize to.
- The object to deserialize.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using a collection of .
-
- The JSON to deserialize.
- The type of the object to deserialize.
- Converters to use while deserializing.
- The deserialized object from the JSON string.
-
-
-
- Deserializes the JSON to the specified .NET type using .
-
- The JSON to deserialize.
- The type of the object to deserialize to.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
- The deserialized object from the JSON string.
-
-
-
- Populates the object with values from the JSON string.
-
- The JSON to populate values from.
- The target object to populate values onto.
-
-
-
- Populates the object with values from the JSON string using .
-
- The JSON to populate values from.
- The target object to populate values onto.
-
- The used to deserialize the object.
- If this is null , default serialization settings will be used.
-
-
-
-
- Serializes the to a JSON string.
-
- The node to serialize.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting.
-
- The node to serialize.
- Indicates how the output should be formatted.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting and omits the root object if is true .
-
- The node to serialize.
- Indicates how the output should be formatted.
- Omits writing the root object.
- A JSON string of the .
-
-
-
- Deserializes the from a JSON string.
-
- The JSON string.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by .
-
- The JSON string.
- The name of the root element to append when deserializing.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by
- and writes a Json.NET array attribute for collections.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by ,
- writes a Json.NET array attribute for collections, and encodes special characters.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
-
- A value to indicate whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- The deserialized .
-
-
-
- Serializes the to a JSON string.
-
- The node to convert to JSON.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting.
-
- The node to convert to JSON.
- Indicates how the output should be formatted.
- A JSON string of the .
-
-
-
- Serializes the to a JSON string using formatting and omits the root object if is true .
-
- The node to serialize.
- Indicates how the output should be formatted.
- Omits writing the root object.
- A JSON string of the .
-
-
-
- Deserializes the from a JSON string.
-
- The JSON string.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by .
-
- The JSON string.
- The name of the root element to append when deserializing.
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by
- and writes a Json.NET array attribute for collections.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
- The deserialized .
-
-
-
- Deserializes the from a JSON string nested in a root element specified by ,
- writes a Json.NET array attribute for collections, and encodes special characters.
-
- The JSON string.
- The name of the root element to append when deserializing.
-
- A value to indicate whether to write the Json.NET array attribute.
- This attribute helps preserve arrays when converting the written XML back to JSON.
-
-
- A value to indicate whether to encode special characters when converting JSON to XML.
- If true , special characters like ':', '@', '?', '#' and '$' in JSON property names aren't used to specify
- XML namespaces, attributes or processing directives. Instead special characters are encoded and written
- as part of the XML element name.
-
- The deserialized .
-
-
-
- Converts an object to and from JSON.
-
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Gets a value indicating whether this can read JSON.
-
- true if this can read JSON; otherwise, false .
-
-
-
- Gets a value indicating whether this can write JSON.
-
- true if this can write JSON; otherwise, false .
-
-
-
- Converts an object to and from JSON.
-
- The object type to convert.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Writes the JSON representation of the object.
-
- The to write to.
- The value.
- The calling serializer.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read.
- The calling serializer.
- The object value.
-
-
-
- Reads the JSON representation of the object.
-
- The to read from.
- Type of the object.
- The existing value of object being read. If there is no existing value then null will be used.
- The existing value has a value.
- The calling serializer.
- The object value.
-
-
-
- Determines whether this instance can convert the specified object type.
-
- Type of the object.
-
- true if this instance can convert the specified object type; otherwise, false .
-
-
-
-
- Instructs the to use the specified when serializing the member or class.
-
-
-
-
- Gets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
-
-
-
-
- Initializes a new instance of the class.
-
- Type of the .
-
-
-
- Initializes a new instance of the class.
-
- Type of the .
- Parameter list to use when constructing the . Can be null .
-
-
-
- Represents a collection of .
-
-
-
-
- Instructs the how to serialize the collection.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- The exception thrown when an error occurs during JSON serialization or deserialization.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Instructs the to deserialize properties with no matching class member into the specified collection
- and write values during serialization.
-
-
-
-
- Gets or sets a value that indicates whether to write extension data when serializing the object.
-
-
- true to write extension data when serializing the object; otherwise, false . The default is true .
-
-
-
-
- Gets or sets a value that indicates whether to read extension data when deserializing the object.
-
-
- true to read extension data when deserializing the object; otherwise, false . The default is true .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Instructs the not to serialize the public field or public read/write property value.
-
-
-
-
- Base class for a table of atomized string objects.
-
-
-
-
- Gets a string containing the same characters as the specified range of characters in the given array.
-
- The character array containing the name to find.
- The zero-based index into the array specifying the first character of the name.
- The number of characters in the name.
- A string containing the same characters as the specified range of characters in the given array.
-
-
-
- Instructs the how to serialize the object.
-
-
-
-
- Gets or sets the member serialization.
-
- The member serialization.
-
-
-
- Gets or sets the missing member handling used when deserializing this object.
-
- The missing member handling.
-
-
-
- Gets or sets how the object's properties with null values are handled during serialization and deserialization.
-
- How the object's properties with null values are handled during serialization and deserialization.
-
-
-
- Gets or sets a value that indicates whether the object's properties are required.
-
-
- A value indicating whether the object's properties are required.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified member serialization.
-
- The member serialization.
-
-
-
- Initializes a new instance of the class with the specified container Id.
-
- The container Id.
-
-
-
- Instructs the to always serialize the member with the specified name.
-
-
-
-
- Gets or sets the type used when serializing the property's collection items.
-
- The collection's items type.
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonProperty(ItemConverterType = typeof(MyContainerConverter), ItemConverterParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the of the .
-
- The of the .
-
-
-
- The parameter list to use when constructing the described by .
- If null , the default constructor is used.
- When non-null , there must be a constructor defined in the that exactly matches the number,
- order, and type of these parameters.
-
-
-
- [JsonProperty(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
-
-
-
-
-
- Gets or sets the null value handling used when serializing this property.
-
- The null value handling.
-
-
-
- Gets or sets the default value handling used when serializing this property.
-
- The default value handling.
-
-
-
- Gets or sets the reference loop handling used when serializing this property.
-
- The reference loop handling.
-
-
-
- Gets or sets the object creation handling used when deserializing this property.
-
- The object creation handling.
-
-
-
- Gets or sets the type name handling used when serializing this property.
-
- The type name handling.
-
-
-
- Gets or sets whether this property's value is serialized as a reference.
-
- Whether this property's value is serialized as a reference.
-
-
-
- Gets or sets the order of serialization of a member.
-
- The numeric order of serialization.
-
-
-
- Gets or sets a value indicating whether this property is required.
-
-
- A value indicating whether this property is required.
-
-
-
-
- Gets or sets the name of the property.
-
- The name of the property.
-
-
-
- Gets or sets the reference loop handling used when serializing the property's collection items.
-
- The collection's items reference loop handling.
-
-
-
- Gets or sets the type name handling used when serializing the property's collection items.
-
- The collection's items type name handling.
-
-
-
- Gets or sets whether this property's collection items are serialized as a reference.
-
- Whether this property's collection items are serialized as a reference.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the specified name.
-
- Name of the property.
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
-
-
-
-
- Specifies the state of the reader.
-
-
-
-
- A read method has not been called.
-
-
-
-
- The end of the file has been reached successfully.
-
-
-
-
- Reader is at a property.
-
-
-
-
- Reader is at the start of an object.
-
-
-
-
- Reader is in an object.
-
-
-
-
- Reader is at the start of an array.
-
-
-
-
- Reader is in an array.
-
-
-
-
- The method has been called.
-
-
-
-
- Reader has just read a value.
-
-
-
-
- Reader is at the start of a constructor.
-
-
-
-
- Reader is in a constructor.
-
-
-
-
- An error occurred that prevents the read operation from continuing.
-
-
-
-
- The end of the file has been reached successfully.
-
-
-
-
- Gets the current reader state.
-
- The current reader state.
-
-
-
- Gets or sets a value indicating whether the source should be closed when this reader is closed.
-
-
- true to close the source when this reader is closed; otherwise false . The default is true .
-
-
-
-
- Gets or sets a value indicating whether multiple pieces of JSON content can
- be read from a continuous stream without erroring.
-
-
- true to support reading multiple pieces of JSON content; otherwise false .
- The default is false .
-
-
-
-
- Gets the quotation mark character used to enclose the value of a string.
-
-
-
-
- Gets or sets how time zones are handled when reading JSON.
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON.
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
-
-
-
-
- Gets or sets how custom date formatted strings are parsed when reading JSON.
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
-
-
-
-
- Gets the type of the current JSON token.
-
-
-
-
- Gets the text value of the current JSON token.
-
-
-
-
- Gets the .NET type for the current JSON token.
-
-
-
-
- Gets the depth of the current token in the JSON document.
-
- The depth of the current token in the JSON document.
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Gets or sets the culture used when reading JSON. Defaults to .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Reads the next JSON token from the source.
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a [].
-
- A [] or null if the next JSON token is null. This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the source as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Skips the children of the current token.
-
-
-
-
- Sets the current token.
-
- The new token.
-
-
-
- Sets the current token and value.
-
- The new token.
- The value.
-
-
-
- Sets the current token and value.
-
- The new token.
- The value.
- A flag indicating whether the position index inside an array should be updated.
-
-
-
- Sets the state based on current token type.
-
-
-
-
- Releases unmanaged and - optionally - managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Changes the reader's state to .
- If is set to true , the source is also closed.
-
-
-
-
- The exception thrown when an error occurs while reading JSON text.
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The line number indicating where the error occurred.
- The line position indicating where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Instructs the to always serialize the member, and to require that the member has a value.
-
-
-
-
- The exception thrown when an error occurs during JSON serialization or deserialization.
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path, line number, line position, and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The line number indicating where the error occurred.
- The line position indicating where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Serializes and deserializes objects into and from the JSON format.
- The enables you to control how objects are encoded into JSON.
-
-
-
-
- Occurs when the errors during serialization and deserialization.
-
-
-
-
- Gets or sets the used by the serializer when resolving references.
-
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
-
-
-
- Gets or sets the used by the serializer when writing trace messages.
-
- The trace writer.
-
-
-
- Gets or sets the equality comparer used by the serializer when comparing references.
-
- The equality comparer.
-
-
-
- Gets or sets how type name writing and reading is handled by the serializer.
- The default value is .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how object references are preserved by the serializer.
- The default value is .
-
-
-
-
- Gets or sets how reference loops (e.g. a class referencing itself) is handled.
- The default value is .
-
-
-
-
- Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.
- The default value is .
-
-
-
-
- Gets or sets how null values are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how default values are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how objects are created during deserialization.
- The default value is .
-
- The object creation handling.
-
-
-
- Gets or sets how constructors are used during deserialization.
- The default value is .
-
- The constructor handling.
-
-
-
- Gets or sets how metadata properties are used during deserialization.
- The default value is .
-
- The metadata properties handling.
-
-
-
- Gets a collection that will be used during serialization.
-
- Collection that will be used during serialization.
-
-
-
- Gets or sets the contract resolver used by the serializer when
- serializing .NET objects to JSON and vice versa.
-
-
-
-
- Gets or sets the used by the serializer when invoking serialization callback methods.
-
- The context.
-
-
-
- Indicates how JSON text output is formatted.
- The default value is .
-
-
-
-
- Gets or sets how dates are written to JSON text.
- The default value is .
-
-
-
-
- Gets or sets how time zones are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
- The default value is .
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written as JSON text.
- The default value is .
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
- The default value is .
-
-
-
-
- Gets or sets how and values are formatted when writing JSON text,
- and the expected date format when reading JSON text.
- The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK" .
-
-
-
-
- Gets or sets the culture used when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
- A null value means there is no maximum.
- The default value is null .
-
-
-
-
- Gets a value indicating whether there will be a check for additional JSON content after deserializing an object.
- The default value is false .
-
-
- true if there will be a check for additional JSON content after deserializing an object; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates a new instance.
- The will not use default settings
- from .
-
-
- A new instance.
- The will not use default settings
- from .
-
-
-
-
- Creates a new instance using the specified .
- The will not use default settings
- from .
-
- The settings to be applied to the .
-
- A new instance using the specified .
- The will not use default settings
- from .
-
-
-
-
- Creates a new instance.
- The will use default settings
- from .
-
-
- A new instance.
- The will use default settings
- from .
-
-
-
-
- Creates a new instance using the specified .
- The will use default settings
- from as well as the specified .
-
- The settings to be applied to the .
-
- A new instance using the specified .
- The will use default settings
- from as well as the specified .
-
-
-
-
- Populates the JSON values onto the target object.
-
- The that contains the JSON structure to read values from.
- The target object to populate values onto.
-
-
-
- Populates the JSON values onto the target object.
-
- The that contains the JSON structure to read values from.
- The target object to populate values onto.
-
-
-
- Deserializes the JSON structure contained by the specified .
-
- The that contains the JSON structure to deserialize.
- The being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The of object being deserialized.
- The instance of being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The type of the object to deserialize.
- The instance of being deserialized.
-
-
-
- Deserializes the JSON structure contained by the specified
- into an instance of the specified type.
-
- The containing the object.
- The of object being deserialized.
- The instance of being deserialized.
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
- The type of the value being serialized.
- This parameter is used when is to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
- The type of the value being serialized.
- This parameter is used when is Auto to write out the type name if the type of the value does not match.
- Specifying the type is optional.
-
-
-
-
- Serializes the specified and writes the JSON structure
- using the specified .
-
- The used to write the JSON structure.
- The to serialize.
-
-
-
- Specifies the settings on a object.
-
-
-
-
- Gets or sets how reference loops (e.g. a class referencing itself) are handled.
- The default value is .
-
- Reference loop handling.
-
-
-
- Gets or sets how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.
- The default value is .
-
- Missing member handling.
-
-
-
- Gets or sets how objects are created during deserialization.
- The default value is .
-
- The object creation handling.
-
-
-
- Gets or sets how null values are handled during serialization and deserialization.
- The default value is .
-
- Null value handling.
-
-
-
- Gets or sets how default values are handled during serialization and deserialization.
- The default value is .
-
- The default value handling.
-
-
-
- Gets or sets a collection that will be used during serialization.
-
- The converters.
-
-
-
- Gets or sets how object references are preserved by the serializer.
- The default value is .
-
- The preserve references handling.
-
-
-
- Gets or sets how type name writing and reading is handled by the serializer.
- The default value is .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
- The type name handling.
-
-
-
- Gets or sets how metadata properties are used during deserialization.
- The default value is .
-
- The metadata properties handling.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how a type name assembly is written and resolved by the serializer.
- The default value is .
-
- The type name assembly format.
-
-
-
- Gets or sets how constructors are used during deserialization.
- The default value is .
-
- The constructor handling.
-
-
-
- Gets or sets the contract resolver used by the serializer when
- serializing .NET objects to JSON and vice versa.
-
- The contract resolver.
-
-
-
- Gets or sets the equality comparer used by the serializer when comparing references.
-
- The equality comparer.
-
-
-
- Gets or sets the used by the serializer when resolving references.
-
- The reference resolver.
-
-
-
- Gets or sets a function that creates the used by the serializer when resolving references.
-
- A function that creates the used by the serializer when resolving references.
-
-
-
- Gets or sets the used by the serializer when writing trace messages.
-
- The trace writer.
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
- The binder.
-
-
-
- Gets or sets the used by the serializer when resolving type names.
-
- The binder.
-
-
-
- Gets or sets the error handler called during serialization and deserialization.
-
- The error handler called during serialization and deserialization.
-
-
-
- Gets or sets the used by the serializer when invoking serialization callback methods.
-
- The context.
-
-
-
- Gets or sets how and values are formatted when writing JSON text,
- and the expected date format when reading JSON text.
- The default value is "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK" .
-
-
-
-
- Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a .
- A null value means there is no maximum.
- The default value is null .
-
-
-
-
- Indicates how JSON text output is formatted.
- The default value is .
-
-
-
-
- Gets or sets how dates are written to JSON text.
- The default value is .
-
-
-
-
- Gets or sets how time zones are handled during serialization and deserialization.
- The default value is .
-
-
-
-
- Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z" , are parsed when reading JSON.
- The default value is .
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written as JSON.
- The default value is .
-
-
-
-
- Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
- The default value is .
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
- The default value is .
-
-
-
-
- Gets or sets the culture used when reading JSON.
- The default value is .
-
-
-
-
- Gets a value indicating whether there will be a check for additional content after deserializing an object.
- The default value is false .
-
-
- true if there will be a check for additional content after deserializing an object; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to JSON text data.
-
-
-
-
- Initializes a new instance of the class with the specified .
-
- The containing the JSON data to read.
-
-
-
- Gets or sets the reader's property name table.
-
-
-
-
- Gets or sets the reader's character buffer pool.
-
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a [].
-
- A [] or null if the next JSON token is null. This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Gets a value indicating whether the class can return line information.
-
-
- true if and can be provided; otherwise, false .
-
-
-
-
- Gets the current line number.
-
-
- The current line number or 0 if no line information is available (for example, returns false ).
-
-
-
-
- Gets the current line position.
-
-
- The current line position or 0 if no line information is available (for example, returns false ).
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets or sets the writer's character array pool.
-
-
-
-
- Gets or sets how many s to write for each level in the hierarchy when is set to .
-
-
-
-
- Gets or sets which character to use to quote attribute values.
-
-
-
-
- Gets or sets which character to use for indenting when is set to .
-
-
-
-
- Gets or sets a value indicating whether object names will be surrounded with quotes.
-
-
-
-
- Initializes a new instance of the class using the specified .
-
- The to write to.
-
-
-
- Flushes whatever is in the buffer to the underlying and also flushes the underlying .
-
-
-
-
- Closes this writer.
- If is set to true , the underlying is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the specified end token.
-
- The end token to write.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
- A flag to indicate whether the text should be escaped when it is written as a JSON property name.
-
-
-
- Writes indent characters.
-
-
-
-
- Writes the JSON value delimiter.
-
-
-
-
- Writes an indent space.
-
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the given white space.
-
- The string of white space characters.
-
-
-
- Specifies the type of JSON token.
-
-
-
-
- This is returned by the if a read method has not been called.
-
-
-
-
- An object start token.
-
-
-
-
- An array start token.
-
-
-
-
- A constructor start token.
-
-
-
-
- An object property name.
-
-
-
-
- A comment.
-
-
-
-
- Raw JSON.
-
-
-
-
- An integer.
-
-
-
-
- A float.
-
-
-
-
- A string.
-
-
-
-
- A boolean.
-
-
-
-
- A null token.
-
-
-
-
- An undefined token.
-
-
-
-
- An object end token.
-
-
-
-
- An array end token.
-
-
-
-
- A constructor end token.
-
-
-
-
- A Date.
-
-
-
-
- Byte data.
-
-
-
-
-
- Represents a reader that provides validation.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Sets an event handler for receiving schema validation errors.
-
-
-
-
- Gets the text value of the current JSON token.
-
-
-
-
-
- Gets the depth of the current token in the JSON document.
-
- The depth of the current token in the JSON document.
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Gets the quotation mark character used to enclose the value of a string.
-
-
-
-
-
- Gets the type of the current JSON token.
-
-
-
-
-
- Gets the .NET type for the current JSON token.
-
-
-
-
-
- Initializes a new instance of the class that
- validates the content returned from the given .
-
- The to read from while validating.
-
-
-
- Gets or sets the schema.
-
- The schema.
-
-
-
- Gets the used to construct this .
-
- The specified in the constructor.
-
-
-
- Changes the reader's state to .
- If is set to true , the underlying is also closed.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a [].
-
-
- A [] or null if the next JSON token is null.
-
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying as a .
-
- A . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of . This method will return null at the end of an array.
-
-
-
- Reads the next JSON token from the underlying as a of .
-
- A of .
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets or sets a value indicating whether the destination should be closed when this writer is closed.
-
-
- true to close the destination when this writer is closed; otherwise false . The default is true .
-
-
-
-
- Gets or sets a value indicating whether the JSON should be auto-completed when this writer is closed.
-
-
- true to auto-complete the JSON when this writer is closed; otherwise false . The default is true .
-
-
-
-
- Gets the top.
-
- The top.
-
-
-
- Gets the state of the writer.
-
-
-
-
- Gets the path of the writer.
-
-
-
-
- Gets or sets a value indicating how JSON text output should be formatted.
-
-
-
-
- Gets or sets how dates are written to JSON text.
-
-
-
-
- Gets or sets how time zones are handled when writing JSON text.
-
-
-
-
- Gets or sets how strings are escaped when writing JSON text.
-
-
-
-
- Gets or sets how special floating point numbers, e.g. ,
- and ,
- are written to JSON text.
-
-
-
-
- Gets or sets how and values are formatted when writing JSON text.
-
-
-
-
- Gets or sets the culture used when writing JSON. Defaults to .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Flushes whatever is in the buffer to the destination and also flushes the destination.
-
-
-
-
- Closes this writer.
- If is set to true , the destination is also closed.
- If is set to true , the JSON is auto-completed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the end of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the end of an array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the end constructor.
-
-
-
-
- Writes the property name of a name/value pair of a JSON object.
-
- The name of the property.
-
-
-
- Writes the property name of a name/value pair of a JSON object.
-
- The name of the property.
- A flag to indicate whether the text should be escaped when it is written as a JSON property name.
-
-
-
- Writes the end of the current JSON object or array.
-
-
-
-
- Writes the current token and its children.
-
- The to read the token from.
-
-
-
- Writes the current token.
-
- The to read the token from.
- A flag indicating whether the current token's children should be written.
-
-
-
- Writes the token and its value.
-
- The to write.
-
- The value to write.
- A value is only required for tokens that have an associated value, e.g. the property name for .
- null can be passed to the method for tokens that don't have a value, e.g. .
-
-
-
-
- Writes the token.
-
- The to write.
-
-
-
- Writes the specified end token.
-
- The end token to write.
-
-
-
- Writes indent characters.
-
-
-
-
- Writes the JSON value delimiter.
-
-
-
-
- Writes an indent space.
-
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON without changing the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes raw JSON where a value is expected and updates the writer's state.
-
- The raw JSON to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a of value.
-
- The of value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
- An error will raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes the given white space.
-
- The string of white space characters.
-
-
-
- Releases unmanaged and - optionally - managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Sets the state of the .
-
- The being written.
- The value being written.
-
-
-
- The exception thrown when an error occurs while writing JSON text.
-
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Initializes a new instance of the class
- with a specified error message, JSON path and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The path to the JSON where the error occurred.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Specifies how JSON comments are handled when loading JSON.
-
-
-
-
- Ignore comments.
-
-
-
-
- Load comments as a with type .
-
-
-
-
- Specifies how duplicate property names are handled when loading JSON.
-
-
-
-
- Replace the existing value when there is a duplicate property. The value of the last property in the JSON object will be used.
-
-
-
-
- Ignore the new value when there is a duplicate property. The value of the first property in the JSON object will be used.
-
-
-
-
- Throw a when a duplicate property is encountered.
-
-
-
-
- Contains the LINQ to JSON extension methods.
-
-
-
-
- Returns a collection of tokens that contains the ancestors of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains the ancestors of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains every token in the source collection, and the ancestors of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains every token in the source collection, the ancestors of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains the descendants of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains the descendants of every token in the source collection.
-
-
-
- Returns a collection of tokens that contains every token in the source collection, and the descendants of every token in the source collection.
-
- The type of the objects in source, constrained to .
- An of that contains the source collection.
- An of that contains every token in the source collection, and the descendants of every token in the source collection.
-
-
-
- Returns a collection of child properties of every object in the source collection.
-
- An of that contains the source collection.
- An of that contains the properties of every object in the source collection.
-
-
-
- Returns a collection of child values of every object in the source collection with the given key.
-
- An of that contains the source collection.
- The token key.
- An of that contains the values of every token in the source collection with the given key.
-
-
-
- Returns a collection of child values of every object in the source collection.
-
- An of that contains the source collection.
- An of that contains the values of every token in the source collection.
-
-
-
- Returns a collection of converted child values of every object in the source collection with the given key.
-
- The type to convert the values to.
- An of that contains the source collection.
- The token key.
- An that contains the converted values of every token in the source collection with the given key.
-
-
-
- Returns a collection of converted child values of every object in the source collection.
-
- The type to convert the values to.
- An of that contains the source collection.
- An that contains the converted values of every token in the source collection.
-
-
-
- Converts the value.
-
- The type to convert the value to.
- A cast as a of .
- A converted value.
-
-
-
- Converts the value.
-
- The source collection type.
- The type to convert the value to.
- A cast as a of .
- A converted value.
-
-
-
- Returns a collection of child tokens of every array in the source collection.
-
- The source collection type.
- An of that contains the source collection.
- An of that contains the values of every token in the source collection.
-
-
-
- Returns a collection of converted child tokens of every array in the source collection.
-
- An of that contains the source collection.
- The type to convert the values to.
- The source collection type.
- An that contains the converted values of every token in the source collection.
-
-
-
- Returns the input typed as .
-
- An of that contains the source collection.
- The input typed as .
-
-
-
- Returns the input typed as .
-
- The source collection type.
- An of that contains the source collection.
- The input typed as .
-
-
-
- Represents a collection of objects.
-
- The type of token.
-
-
-
- Gets the of with the specified key.
-
-
-
-
-
- Represents a JSON array.
-
-
-
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the array.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the array.
-
-
-
- Loads an from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads an from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
-
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
-
-
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the values of the specified object.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- The that will be used to read the object.
- A with the values of the specified object.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets or sets the at the specified index.
-
-
-
-
-
- Determines the index of a specific item in the .
-
- The object to locate in the .
-
- The index of if found in the list; otherwise, -1.
-
-
-
-
- Inserts an item to the at the specified index.
-
- The zero-based index at which should be inserted.
- The object to insert into the .
-
- is not a valid index in the .
-
-
-
-
- Removes the item at the specified index.
-
- The zero-based index of the item to remove.
-
- is not a valid index in the .
-
-
-
-
- Returns an enumerator that iterates through the collection.
-
-
- A of that can be used to iterate through the collection.
-
-
-
-
- Adds an item to the .
-
- The object to add to the .
-
-
-
- Removes all items from the .
-
-
-
-
- Determines whether the contains a specific value.
-
- The object to locate in the .
-
- true if is found in the ; otherwise, false .
-
-
-
-
- Copies the elements of the to an array, starting at a particular array index.
-
- The array.
- Index of the array.
-
-
-
- Gets a value indicating whether the is read-only.
-
- true if the is read-only; otherwise, false .
-
-
-
- Removes the first occurrence of a specific object from the .
-
- The object to remove from the .
-
- true if was successfully removed from the ; otherwise, false . This method also returns false if is not found in the original .
-
-
-
-
- Represents a JSON constructor.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets or sets the name of this constructor.
-
- The constructor name.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified name and content.
-
- The constructor name.
- The contents of the constructor.
-
-
-
- Initializes a new instance of the class with the specified name and content.
-
- The constructor name.
- The contents of the constructor.
-
-
-
- Initializes a new instance of the class with the specified name.
-
- The constructor name.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Represents a token that can contain other tokens.
-
-
-
-
- Occurs when the list changes or an item in the list changes.
-
-
-
-
- Occurs before an item is added to the collection.
-
-
-
-
- Occurs when the items list of the collection has changed, or the collection is reset.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Raises the event.
-
- The instance containing the event data.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Get the first child token of this token.
-
-
- A containing the first child token of the .
-
-
-
-
- Get the last child token of this token.
-
-
- A containing the last child token of the .
-
-
-
-
- Returns a collection of the child tokens of this token, in document order.
-
-
- An of containing the child tokens of this , in document order.
-
-
-
-
- Returns a collection of the child values of this token, in document order.
-
- The type to convert the values to.
-
- A containing the child values of this , in document order.
-
-
-
-
- Returns a collection of the descendant tokens for this token in document order.
-
- An of containing the descendant tokens of the .
-
-
-
- Returns a collection of the tokens that contain this token, and all descendant tokens of this token, in document order.
-
- An of containing this token, and all the descendant tokens of the .
-
-
-
- Adds the specified content as children of this .
-
- The content to be added.
-
-
-
- Adds the specified content as the first children of this .
-
- The content to be added.
-
-
-
- Creates a that can be used to add tokens to the .
-
- A that is ready to have content written to it.
-
-
-
- Replaces the child nodes of this token with the specified content.
-
- The content.
-
-
-
- Removes the child nodes from this token.
-
-
-
-
- Merge the specified content into this .
-
- The content to be merged.
-
-
-
- Merge the specified content into this using .
-
- The content to be merged.
- The used to merge the content.
-
-
-
- Gets the count of child JSON tokens.
-
- The count of child JSON tokens.
-
-
-
- Represents a collection of objects.
-
- The type of token.
-
-
-
- An empty collection of objects.
-
-
-
-
- Initializes a new instance of the struct.
-
- The enumerable.
-
-
-
- Returns an enumerator that can be used to iterate through the collection.
-
-
- A that can be used to iterate through the collection.
-
-
-
-
- Gets the of with the specified key.
-
-
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false .
-
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false .
-
-
-
-
- Returns a hash code for this instance.
-
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Represents a JSON object.
-
-
-
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Occurs when a property value changes.
-
-
-
-
- Occurs when a property value is changing.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the object.
-
-
-
- Initializes a new instance of the class with the specified content.
-
- The contents of the object.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets an of of this object's properties.
-
- An of of this object's properties.
-
-
-
- Gets a with the specified name.
-
- The property name.
- A with the specified name or null .
-
-
-
- Gets the with the specified name.
- The exact name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- The property name.
- One of the enumeration values that specifies how the strings will be compared.
- A matched with the specified name or null .
-
-
-
- Gets a of of this object's property values.
-
- A of of this object's property values.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets or sets the with the specified property name.
-
-
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
- is not valid JSON.
-
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
- is not valid JSON.
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
- is not valid JSON.
-
-
-
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
- is not valid JSON.
-
-
-
-
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the values of the specified object.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- The that will be used to read the object.
- A with the values of the specified object.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Gets the with the specified property name.
-
- Name of the property.
- The with the specified property name.
-
-
-
- Gets the with the specified property name.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- Name of the property.
- One of the enumeration values that specifies how the strings will be compared.
- The with the specified property name.
-
-
-
- Tries to get the with the specified property name.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- Name of the property.
- The value.
- One of the enumeration values that specifies how the strings will be compared.
- true if a value was successfully retrieved; otherwise, false .
-
-
-
- Adds the specified property name.
-
- Name of the property.
- The value.
-
-
-
- Determines whether the JSON object has the specified property name.
-
- Name of the property.
- true if the JSON object has the specified property name; otherwise, false .
-
-
-
- Removes the property with the specified name.
-
- Name of the property.
- true if item was successfully removed; otherwise, false .
-
-
-
- Tries to get the with the specified property name.
-
- Name of the property.
- The value.
- true if a value was successfully retrieved; otherwise, false .
-
-
-
- Returns an enumerator that can be used to iterate through the collection.
-
-
- A that can be used to iterate through the collection.
-
-
-
-
- Raises the event with the provided arguments.
-
- Name of the property.
-
-
-
- Raises the event with the provided arguments.
-
- Name of the property.
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Represents a JSON property.
-
-
-
-
- Gets the container's children tokens.
-
- The container's children tokens.
-
-
-
- Gets the property name.
-
- The property name.
-
-
-
- Gets or sets the property value.
-
- The property value.
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Initializes a new instance of the class.
-
- The property name.
- The property content.
-
-
-
- Initializes a new instance of the class.
-
- The property name.
- The property content.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- A that contains the JSON that was read from the specified .
-
-
-
- Loads a from a .
-
- A that will be read for the content of the .
- The used to load the JSON.
- If this is null , default load settings will be used.
- A that contains the JSON that was read from the specified .
-
-
-
- Represents a view of a .
-
-
-
-
- Initializes a new instance of the class.
-
- The name.
-
-
-
- When overridden in a derived class, returns whether resetting an object changes its value.
-
-
- true if resetting the component changes its value; otherwise, false .
-
- The component to test for reset capability.
-
-
-
- When overridden in a derived class, gets the current value of the property on a component.
-
-
- The value of a property for a given component.
-
- The component with the property for which to retrieve the value.
-
-
-
- When overridden in a derived class, resets the value for this property of the component to the default value.
-
- The component with the property value that is to be reset to the default value.
-
-
-
- When overridden in a derived class, sets the value of the component to a different value.
-
- The component with the property value that is to be set.
- The new value.
-
-
-
- When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted.
-
-
- true if the property should be persisted; otherwise, false .
-
- The component with the property to be examined for persistence.
-
-
-
- When overridden in a derived class, gets the type of the component this property is bound to.
-
-
- A that represents the type of component this property is bound to.
- When the or
-
- methods are invoked, the object specified might be an instance of this type.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether this property is read-only.
-
-
- true if the property is read-only; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets the type of the property.
-
-
- A that represents the type of the property.
-
-
-
-
- Gets the hash code for the name of the member.
-
-
-
- The hash code for the name of the member.
-
-
-
-
- Represents a raw JSON string.
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class.
-
- The raw json.
-
-
-
- Creates an instance of with the content of the reader's current token.
-
- The reader.
- An instance of with the content of the reader's current token.
-
-
-
- Specifies the settings used when loading JSON.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets how JSON comments are handled when loading JSON.
- The default value is .
-
- The JSON comment handling.
-
-
-
- Gets or sets how JSON line info is handled when loading JSON.
- The default value is .
-
- The JSON line info handling.
-
-
-
- Gets or sets how duplicate property names in JSON objects are handled when loading JSON.
- The default value is .
-
- The JSON duplicate property name handling.
-
-
-
- Specifies the settings used when merging JSON.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets the method used when merging JSON arrays.
-
- The method used when merging JSON arrays.
-
-
-
- Gets or sets how null value properties are merged.
-
- How null value properties are merged.
-
-
-
- Gets or sets the comparison used to match property names while merging.
- The exact property name will be searched for first and if no matching property is found then
- the will be used to match a property.
-
- The comparison used to match property names while merging.
-
-
-
- Represents an abstract JSON token.
-
-
-
-
- Gets a comparer that can compare two tokens for value equality.
-
- A that can compare two nodes for value equality.
-
-
-
- Gets or sets the parent.
-
- The parent.
-
-
-
- Gets the root of this .
-
- The root of this .
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Compares the values of two tokens, including the values of all descendant tokens.
-
- The first to compare.
- The second to compare.
- true if the tokens are equal; otherwise false .
-
-
-
- Gets the next sibling token of this node.
-
- The that contains the next sibling token.
-
-
-
- Gets the previous sibling token of this node.
-
- The that contains the previous sibling token.
-
-
-
- Gets the path of the JSON token.
-
-
-
-
- Adds the specified content immediately after this token.
-
- A content object that contains simple content or a collection of content objects to be added after this token.
-
-
-
- Adds the specified content immediately before this token.
-
- A content object that contains simple content or a collection of content objects to be added before this token.
-
-
-
- Returns a collection of the ancestor tokens of this token.
-
- A collection of the ancestor tokens of this token.
-
-
-
- Returns a collection of tokens that contain this token, and the ancestors of this token.
-
- A collection of tokens that contain this token, and the ancestors of this token.
-
-
-
- Returns a collection of the sibling tokens after this token, in document order.
-
- A collection of the sibling tokens after this tokens, in document order.
-
-
-
- Returns a collection of the sibling tokens before this token, in document order.
-
- A collection of the sibling tokens before this token, in document order.
-
-
-
- Gets the with the specified key.
-
- The with the specified key.
-
-
-
- Gets the with the specified key converted to the specified type.
-
- The type to convert the token to.
- The token key.
- The converted token value.
-
-
-
- Get the first child token of this token.
-
- A containing the first child token of the .
-
-
-
- Get the last child token of this token.
-
- A containing the last child token of the .
-
-
-
- Returns a collection of the child tokens of this token, in document order.
-
- An of containing the child tokens of this , in document order.
-
-
-
- Returns a collection of the child tokens of this token, in document order, filtered by the specified type.
-
- The type to filter the child tokens on.
- A containing the child tokens of this , in document order.
-
-
-
- Returns a collection of the child values of this token, in document order.
-
- The type to convert the values to.
- A containing the child values of this , in document order.
-
-
-
- Removes this token from its parent.
-
-
-
-
- Replaces this token with the specified token.
-
- The value.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of which will be used when writing the token.
-
-
-
- Returns the indented JSON for this token.
-
-
- ToString() returns a non-JSON string value for tokens with a type of .
- If you want the JSON for all token types then you should use .
-
-
- The indented JSON for this token.
-
-
-
-
- Returns the JSON for this token using the given formatting and converters.
-
- Indicates how the output should be formatted.
- A collection of s which will be used when writing the token.
- The JSON for this token using the given formatting and converters.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to [].
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to of .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an explicit conversion from to .
-
- The value.
- The result of the conversion.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from [] to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Performs an implicit conversion from of to .
-
- The value to create a from.
- The initialized with the specified value.
-
-
-
- Creates a for this token.
-
- A that can be used to read this token and its descendants.
-
-
-
- Creates a from an object.
-
- The object that will be used to create .
- A with the value of the specified object.
-
-
-
- Creates a from an object using the specified .
-
- The object that will be used to create .
- The that will be used when reading the object.
- A with the value of the specified object.
-
-
-
- Creates an instance of the specified .NET type from the .
-
- The object type that the token will be deserialized to.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the .
-
- The object type that the token will be deserialized to.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the using the specified .
-
- The object type that the token will be deserialized to.
- The that will be used when creating the object.
- The new object created from the JSON value.
-
-
-
- Creates an instance of the specified .NET type from the using the specified .
-
- The object type that the token will be deserialized to.
- The that will be used when creating the object.
- The new object created from the JSON value.
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Creates a from a .
-
- An positioned at the token to read into this .
- The used to load the JSON.
- If this is null , default load settings will be used.
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- A populated from the string that contains JSON.
-
-
-
- Load a from a string that contains JSON.
-
- A that contains JSON.
- The used to load the JSON.
- If this is null , default load settings will be used.
- A populated from the string that contains JSON.
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
- The used to load the JSON.
- If this is null , default load settings will be used.
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Creates a from a .
-
- A positioned at the token to read into this .
-
- A that contains the token and its descendant tokens
- that were read from the reader. The runtime type of the token is determined
- by the token type of the first token encountered in the reader.
-
-
-
-
- Selects a using a JSONPath expression. Selects the token that matches the object path.
-
-
- A that contains a JSONPath expression.
-
- A , or null .
-
-
-
- Selects a using a JSONPath expression. Selects the token that matches the object path.
-
-
- A that contains a JSONPath expression.
-
- A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
- A .
-
-
-
- Selects a collection of elements using a JSONPath expression.
-
-
- A that contains a JSONPath expression.
-
- An of that contains the selected elements.
-
-
-
- Selects a collection of elements using a JSONPath expression.
-
-
- A that contains a JSONPath expression.
-
- A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.
- An of that contains the selected elements.
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Creates a new instance of the . All child tokens are recursively cloned.
-
- A new instance of the .
-
-
-
- Adds an object to the annotation list of this .
-
- The annotation to add.
-
-
-
- Get the first annotation object of the specified type from this .
-
- The type of the annotation to retrieve.
- The first annotation object that matches the specified type, or null if no annotation is of the specified type.
-
-
-
- Gets the first annotation object of the specified type from this .
-
- The of the annotation to retrieve.
- The first annotation object that matches the specified type, or null if no annotation is of the specified type.
-
-
-
- Gets a collection of annotations of the specified type for this .
-
- The type of the annotations to retrieve.
- An that contains the annotations for this .
-
-
-
- Gets a collection of annotations of the specified type for this .
-
- The of the annotations to retrieve.
- An of that contains the annotations that match the specified type for this .
-
-
-
- Removes the annotations of the specified type from this .
-
- The type of annotations to remove.
-
-
-
- Removes the annotations of the specified type from this .
-
- The of annotations to remove.
-
-
-
- Compares tokens to determine whether they are equal.
-
-
-
-
- Determines whether the specified objects are equal.
-
- The first object of type to compare.
- The second object of type to compare.
-
- true if the specified objects are equal; otherwise, false .
-
-
-
-
- Returns a hash code for the specified object.
-
- The for which a hash code is to be returned.
- A hash code for the specified object.
- The type of is a reference type and is null .
-
-
-
- Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
-
-
-
-
- Gets the at the reader's current position.
-
-
-
-
- Initializes a new instance of the class.
-
- The token to read from.
-
-
-
- Initializes a new instance of the class.
-
- The token to read from.
- The initial path of the token. It is prepended to the returned .
-
-
-
- Reads the next JSON token from the underlying .
-
-
- true if the next token was read successfully; false if there are no more tokens to read.
-
-
-
-
- Gets the path of the current JSON token.
-
-
-
-
- Specifies the type of token.
-
-
-
-
- No token type has been set.
-
-
-
-
- A JSON object.
-
-
-
-
- A JSON array.
-
-
-
-
- A JSON constructor.
-
-
-
-
- A JSON object property.
-
-
-
-
- A comment.
-
-
-
-
- An integer value.
-
-
-
-
- A float value.
-
-
-
-
- A string value.
-
-
-
-
- A boolean value.
-
-
-
-
- A null value.
-
-
-
-
- An undefined value.
-
-
-
-
- A date value.
-
-
-
-
- A raw JSON value.
-
-
-
-
- A collection of bytes value.
-
-
-
-
- A Guid value.
-
-
-
-
- A Uri value.
-
-
-
-
- A TimeSpan value.
-
-
-
-
- Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
-
-
-
-
- Gets the at the writer's current position.
-
-
-
-
- Gets the token being written.
-
- The token being written.
-
-
-
- Initializes a new instance of the class writing to the given .
-
- The container being written to.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Flushes whatever is in the buffer to the underlying .
-
-
-
-
- Closes this writer.
- If is set to true , the JSON is auto-completed.
-
-
- Setting to true has no additional effect, since the underlying is a type that cannot be closed.
-
-
-
-
- Writes the beginning of a JSON object.
-
-
-
-
- Writes the beginning of a JSON array.
-
-
-
-
- Writes the start of a constructor with the given name.
-
- The name of the constructor.
-
-
-
- Writes the end.
-
- The token.
-
-
-
- Writes the property name of a name/value pair on a JSON object.
-
- The name of the property.
-
-
-
- Writes a value.
- An error will be raised if the value cannot be written as a single JSON token.
-
- The value to write.
-
-
-
- Writes a null value.
-
-
-
-
- Writes an undefined value.
-
-
-
-
- Writes raw JSON.
-
- The raw JSON to write.
-
-
-
- Writes a comment /*...*/ containing the specified text.
-
- Text to place inside the comment.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a [] value.
-
- The [] value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Writes a value.
-
- The value to write.
-
-
-
- Represents a value in JSON (string, integer, date, etc).
-
-
-
-
- Initializes a new instance of the class from another object.
-
- A object to copy from.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Initializes a new instance of the class with the given value.
-
- The value.
-
-
-
- Gets a value indicating whether this token has child tokens.
-
-
- true if this token has child values; otherwise, false .
-
-
-
-
- Creates a comment with the given value.
-
- The value.
- A comment with the given value.
-
-
-
- Creates a string with the given value.
-
- The value.
- A string with the given value.
-
-
-
- Creates a null value.
-
- A null value.
-
-
-
- Creates a undefined value.
-
- A undefined value.
-
-
-
- Gets the node type for this .
-
- The type.
-
-
-
- Gets or sets the underlying token value.
-
- The underlying token value.
-
-
-
- Writes this token to a .
-
- A into which this method will write.
- A collection of s which will be used when writing the token.
-
-
-
- Indicates whether the current object is equal to another object of the same type.
-
-
- true if the current object is equal to the parameter; otherwise, false .
-
- An object to compare with this object.
-
-
-
- Determines whether the specified is equal to the current .
-
- The to compare with the current .
-
- true if the specified is equal to the current ; otherwise, false .
-
-
-
-
- Serves as a hash function for a particular type.
-
-
- A hash code for the current .
-
-
-
-
- Returns a that represents this instance.
-
-
- ToString() returns a non-JSON string value for tokens with a type of .
- If you want the JSON for all token types then you should use .
-
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format.
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format provider.
-
- A that represents this instance.
-
-
-
-
- Returns a that represents this instance.
-
- The format.
- The format provider.
-
- A that represents this instance.
-
-
-
-
- Returns the responsible for binding operations performed on this object.
-
- The expression tree representation of the runtime value.
-
- The to bind this object.
-
-
-
-
- Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
-
- An object to compare with this instance.
-
- A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
- Value
- Meaning
- Less than zero
- This instance is less than .
- Zero
- This instance is equal to .
- Greater than zero
- This instance is greater than .
-
-
- is not of the same type as this instance.
-
-
-
-
- Specifies how line information is handled when loading JSON.
-
-
-
-
- Ignore line information.
-
-
-
-
- Load line information.
-
-
-
-
- Specifies how JSON arrays are merged together.
-
-
-
- Concatenate arrays.
-
-
- Union arrays, skipping items that already exist.
-
-
- Replace all array items.
-
-
- Merge array items together, matched by index.
-
-
-
- Specifies how null value properties are merged.
-
-
-
-
- The content's null value properties will be ignored during merging.
-
-
-
-
- The content's null value properties will be merged.
-
-
-
-
- Specifies the member serialization options for the .
-
-
-
-
- All public members are serialized by default. Members can be excluded using or .
- This is the default member serialization mode.
-
-
-
-
- Only members marked with or are serialized.
- This member serialization mode can also be set by marking the class with .
-
-
-
-
- All public and private fields are serialized. Members can be excluded using or .
- This member serialization mode can also be set by marking the class with
- and setting IgnoreSerializableAttribute on to false .
-
-
-
-
- Specifies metadata property handling options for the .
-
-
-
-
- Read metadata properties located at the start of a JSON object.
-
-
-
-
- Read metadata properties located anywhere in a JSON object. Note that this setting will impact performance.
-
-
-
-
- Do not try to read metadata properties.
-
-
-
-
- Specifies missing member handling options for the .
-
-
-
-
- Ignore a missing member and do not attempt to deserialize it.
-
-
-
-
- Throw a when a missing member is encountered during deserialization.
-
-
-
-
- Specifies null value handling options for the .
-
-
-
-
-
-
-
-
- Include null values when serializing and deserializing objects.
-
-
-
-
- Ignore null values when serializing and deserializing objects.
-
-
-
-
- Specifies how object creation is handled by the .
-
-
-
-
- Reuse existing objects, create new objects when needed.
-
-
-
-
- Only reuse existing objects.
-
-
-
-
- Always create new objects.
-
-
-
-
- Specifies reference handling options for the .
- Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement .
-
-
-
-
-
-
-
- Do not preserve references when serializing types.
-
-
-
-
- Preserve references when serializing into a JSON object structure.
-
-
-
-
- Preserve references when serializing into a JSON array structure.
-
-
-
-
- Preserve references when serializing.
-
-
-
-
- Specifies reference loop handling options for the .
-
-
-
-
- Throw a when a loop is encountered.
-
-
-
-
- Ignore loop references and do not serialize.
-
-
-
-
- Serialize loop references.
-
-
-
-
- Indicating whether a property is required.
-
-
-
-
- The property is not required. The default state.
-
-
-
-
- The property must be defined in JSON but can be a null value.
-
-
-
-
- The property must be defined in JSON and cannot be a null value.
-
-
-
-
- The property is not required but it cannot be a null value.
-
-
-
-
-
- Contains the JSON schema extension methods.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
-
- Determines whether the is valid.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
-
- true if the specified is valid; otherwise, false .
-
-
-
-
-
- Determines whether the is valid.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
- When this method returns, contains any error messages generated while validating.
-
- true if the specified is valid; otherwise, false .
-
-
-
-
-
- Validates the specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
-
-
-
-
- Validates the specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
- The source to test.
- The schema to test with.
- The validation event handler.
-
-
-
-
- An in-memory representation of a JSON Schema.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets the id.
-
-
-
-
- Gets or sets the title.
-
-
-
-
- Gets or sets whether the object is required.
-
-
-
-
- Gets or sets whether the object is read-only.
-
-
-
-
- Gets or sets whether the object is visible to users.
-
-
-
-
- Gets or sets whether the object is transient.
-
-
-
-
- Gets or sets the description of the object.
-
-
-
-
- Gets or sets the types of values allowed by the object.
-
- The type.
-
-
-
- Gets or sets the pattern.
-
- The pattern.
-
-
-
- Gets or sets the minimum length.
-
- The minimum length.
-
-
-
- Gets or sets the maximum length.
-
- The maximum length.
-
-
-
- Gets or sets a number that the value should be divisible by.
-
- A number that the value should be divisible by.
-
-
-
- Gets or sets the minimum.
-
- The minimum.
-
-
-
- Gets or sets the maximum.
-
- The maximum.
-
-
-
- Gets or sets a flag indicating whether the value can not equal the number defined by the minimum attribute ( ).
-
- A flag indicating whether the value can not equal the number defined by the minimum attribute ( ).
-
-
-
- Gets or sets a flag indicating whether the value can not equal the number defined by the maximum attribute ( ).
-
- A flag indicating whether the value can not equal the number defined by the maximum attribute ( ).
-
-
-
- Gets or sets the minimum number of items.
-
- The minimum number of items.
-
-
-
- Gets or sets the maximum number of items.
-
- The maximum number of items.
-
-
-
- Gets or sets the of items.
-
- The of items.
-
-
-
- Gets or sets a value indicating whether items in an array are validated using the instance at their array position from .
-
-
- true if items are validated using their array position; otherwise, false .
-
-
-
-
- Gets or sets the of additional items.
-
- The of additional items.
-
-
-
- Gets or sets a value indicating whether additional items are allowed.
-
-
- true if additional items are allowed; otherwise, false .
-
-
-
-
- Gets or sets whether the array items must be unique.
-
-
-
-
- Gets or sets the of properties.
-
- The of properties.
-
-
-
- Gets or sets the of additional properties.
-
- The of additional properties.
-
-
-
- Gets or sets the pattern properties.
-
- The pattern properties.
-
-
-
- Gets or sets a value indicating whether additional properties are allowed.
-
-
- true if additional properties are allowed; otherwise, false .
-
-
-
-
- Gets or sets the required property if this property is present.
-
- The required property if this property is present.
-
-
-
- Gets or sets the a collection of valid enum values allowed.
-
- A collection of valid enum values allowed.
-
-
-
- Gets or sets disallowed types.
-
- The disallowed types.
-
-
-
- Gets or sets the default value.
-
- The default value.
-
-
-
- Gets or sets the collection of that this schema extends.
-
- The collection of that this schema extends.
-
-
-
- Gets or sets the format.
-
- The format.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Reads a from the specified .
-
- The containing the JSON Schema to read.
- The object representing the JSON Schema.
-
-
-
- Reads a from the specified .
-
- The containing the JSON Schema to read.
- The to use when resolving schema references.
- The object representing the JSON Schema.
-
-
-
- Load a from a string that contains JSON Schema.
-
- A that contains JSON Schema.
- A populated from the string that contains JSON Schema.
-
-
-
- Load a from a string that contains JSON Schema using the specified .
-
- A that contains JSON Schema.
- The resolver.
- A populated from the string that contains JSON Schema.
-
-
-
- Writes this schema to a .
-
- A into which this method will write.
-
-
-
- Writes this schema to a using the specified .
-
- A into which this method will write.
- The resolver used.
-
-
-
- Returns a that represents the current .
-
-
- A that represents the current .
-
-
-
-
-
- Returns detailed information about the schema exception.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets the line number indicating where the error occurred.
-
- The line number indicating where the error occurred.
-
-
-
- Gets the line position indicating where the error occurred.
-
- The line position indicating where the error occurred.
-
-
-
- Gets the path to the JSON where the error occurred.
-
- The path to the JSON where the error occurred.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class
- with a specified error message.
-
- The error message that explains the reason for the exception.
-
-
-
- Initializes a new instance of the class
- with a specified error message and a reference to the inner exception that is the cause of this exception.
-
- The error message that explains the reason for the exception.
- The exception that is the cause of the current exception, or null if no inner exception is specified.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
-
- Generates a from a specified .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets how undefined schemas are handled by the serializer.
-
-
-
-
- Gets or sets the contract resolver.
-
- The contract resolver.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- The used to resolve schema references.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- Specify whether the generated root will be nullable.
- A generated from the specified type.
-
-
-
- Generate a from the specified type.
-
- The type to generate a from.
- The used to resolve schema references.
- Specify whether the generated root will be nullable.
- A generated from the specified type.
-
-
-
-
- Resolves from an id.
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets or sets the loaded schemas.
-
- The loaded schemas.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets a for the specified reference.
-
- The id.
- A for the specified reference.
-
-
-
-
- The value types allowed by the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- No type specified.
-
-
-
-
- String type.
-
-
-
-
- Float type.
-
-
-
-
- Integer type.
-
-
-
-
- Boolean type.
-
-
-
-
- Object type.
-
-
-
-
- Array type.
-
-
-
-
- Null type.
-
-
-
-
- Any type.
-
-
-
-
-
- Specifies undefined schema Id handling options for the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Do not infer a schema Id.
-
-
-
-
- Use the .NET type name as the schema Id.
-
-
-
-
- Use the assembly qualified .NET type name as the schema Id.
-
-
-
-
-
- Returns detailed information related to the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- Gets the associated with the validation error.
-
- The JsonSchemaException associated with the validation error.
-
-
-
- Gets the path of the JSON location where the validation error occurred.
-
- The path of the JSON location where the validation error occurred.
-
-
-
- Gets the text description corresponding to the validation error.
-
- The text description.
-
-
-
-
- Represents the callback method that will handle JSON schema validation events and the .
-
-
- JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
-
-
-
-
-
- A camel case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Resolves member mappings for a type, camel casing property names.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Used by to resolve a for a given .
-
-
-
-
- Gets a value indicating whether members are being get and set using dynamic code generation.
- This value is determined by the runtime permissions available.
-
-
- true if using dynamic code generation; otherwise, false .
-
-
-
-
- Gets or sets the default members search flags.
-
- The default members search flags.
-
-
-
- Gets or sets a value indicating whether compiler generated members should be serialized.
-
-
- true if serialized compiler generated members; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types.
-
-
- true if the interface will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore the attribute when serializing and deserializing types.
-
-
- true if the attribute will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore IsSpecified members when serializing and deserializing types.
-
-
- true if the IsSpecified members will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether to ignore ShouldSerialize members when serializing and deserializing types.
-
-
- true if the ShouldSerialize members will be ignored when serializing and deserializing types; otherwise, false .
-
-
-
-
- Gets or sets the naming strategy used to resolve how property names and dictionary keys are serialized.
-
- The naming strategy used to resolve how property names and dictionary keys are serialized.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Gets the serializable members for the type.
-
- The type to get serializable members for.
- The serializable members for the type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates the constructor parameters.
-
- The constructor to create properties for.
- The type's member properties.
- Properties for the given .
-
-
-
- Creates a for the given .
-
- The matching member property.
- The constructor parameter.
- A created for the given .
-
-
-
- Resolves the default for the contract.
-
- Type of the object.
- The contract's default .
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates a for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Determines which contract type is created for the given type.
-
- Type of the object.
- A for the given type.
-
-
-
- Creates properties for the given .
-
- The type to create properties for.
- /// The member serialization mode for the type.
- Properties for the given .
-
-
-
- Creates the used by the serializer to get and set values from a member.
-
- The member.
- The used by the serializer to get and set values from a member.
-
-
-
- Creates a for the given .
-
- The member's parent .
- The member to create a for.
- A created for the given .
-
-
-
- Resolves the name of the property.
-
- Name of the property.
- Resolved name of the property.
-
-
-
- Resolves the name of the extension data. By default no changes are made to extension data names.
-
- Name of the extension data.
- Resolved name of the extension data.
-
-
-
- Resolves the key of the dictionary. By default is used to resolve dictionary keys.
-
- Key of the dictionary.
- Resolved key of the dictionary.
-
-
-
- Gets the resolved name of the property.
-
- Name of the property.
- Name of the property.
-
-
-
- The default naming strategy. Property names and dictionary keys are unchanged.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- The default serialization binder used when resolving and loading classes from type names.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- When overridden in a derived class, controls the binding of a serialized object to a type.
-
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
- The type of the object the formatter creates a new instance of.
-
-
-
-
- When overridden in a derived class, controls the binding of a serialized object to a type.
-
- The type of the object the formatter creates a new instance of.
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
-
-
- Represents a trace writer that writes to the application's instances.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Get and set values for a using dynamic methods.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Provides information surrounding an error.
-
-
-
-
- Gets the error.
-
- The error.
-
-
-
- Gets the original object that caused the error.
-
- The original object that caused the error.
-
-
-
- Gets the member that caused the error.
-
- The member that caused the error.
-
-
-
- Gets the path of the JSON location where the error occurred.
-
- The path of the JSON location where the error occurred.
-
-
-
- Gets or sets a value indicating whether this is handled.
-
- true if handled; otherwise, false .
-
-
-
- Provides data for the Error event.
-
-
-
-
- Gets the current object the error event is being raised against.
-
- The current object the error event is being raised against.
-
-
-
- Gets the error context.
-
- The error context.
-
-
-
- Initializes a new instance of the class.
-
- The current object.
- The error context.
-
-
-
- Get and set values for a using dynamic methods.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Provides methods to get attributes.
-
-
-
-
- Returns a collection of all of the attributes, or an empty collection if there are no attributes.
-
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Returns a collection of attributes, identified by type, or an empty collection if there are no attributes.
-
- The type of the attributes.
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Used by to resolve a for a given .
-
-
-
-
-
-
-
-
- Resolves the contract for a given type.
-
- The type to resolve a contract for.
- The contract for a given type.
-
-
-
- Used to resolve references when serializing and deserializing JSON by the .
-
-
-
-
- Resolves a reference to its object.
-
- The serialization context.
- The reference to resolve.
- The object that was resolved from the reference.
-
-
-
- Gets the reference for the specified object.
-
- The serialization context.
- The object to get a reference for.
- The reference to the object.
-
-
-
- Determines whether the specified object is referenced.
-
- The serialization context.
- The object to test for a reference.
-
- true if the specified object is referenced; otherwise, false .
-
-
-
-
- Adds a reference to the specified object.
-
- The serialization context.
- The reference.
- The object to reference.
-
-
-
- Allows users to control class loading and mandate what class to load.
-
-
-
-
- When implemented, controls the binding of a serialized object to a type.
-
- Specifies the name of the serialized object.
- Specifies the name of the serialized object
- The type of the object the formatter creates a new instance of.
-
-
-
- When implemented, controls the binding of a serialized object to a type.
-
- The type of the object the formatter creates a new instance of.
- Specifies the name of the serialized object.
- Specifies the name of the serialized object.
-
-
-
- Represents a trace writer.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Provides methods to get and set values.
-
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the of the collection items.
-
- The of the collection items.
-
-
-
- Gets a value indicating whether the collection type is a multidimensional array.
-
- true if the collection type is a multidimensional array; otherwise, false .
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
-
- The function used to create the object.
-
-
-
- Gets a value indicating whether the creator has a parameter with the collection values.
-
- true if the creator has a parameter with the collection values; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the default collection items .
-
- The converter.
-
-
-
- Gets or sets a value indicating whether the collection items preserve object references.
-
- true if collection items preserve object references; otherwise, false .
-
-
-
- Gets or sets the collection item reference loop handling.
-
- The reference loop handling.
-
-
-
- Gets or sets the collection item type name handling.
-
- The type name handling.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Handles serialization callback events.
-
- The object that raised the callback event.
- The streaming context.
-
-
-
- Handles serialization error callback events.
-
- The object that raised the callback event.
- The streaming context.
- The error context.
-
-
-
- Sets extension data for an object during deserialization.
-
- The object to set extension data on.
- The extension data key.
- The extension data value.
-
-
-
- Gets extension data for an object during serialization.
-
- The object to set extension data on.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the underlying type for the contract.
-
- The underlying type for the contract.
-
-
-
- Gets or sets the type created during deserialization.
-
- The type created during deserialization.
-
-
-
- Gets or sets whether this type contract is serialized as a reference.
-
- Whether this type contract is serialized as a reference.
-
-
-
- Gets or sets the default for this contract.
-
- The converter.
-
-
-
- Gets the internally resolved for the contract's type.
- This converter is used as a fallback converter when no other converter is resolved.
- Setting will always override this converter.
-
-
-
-
- Gets or sets all methods called immediately after deserialization of the object.
-
- The methods called immediately after deserialization of the object.
-
-
-
- Gets or sets all methods called during deserialization of the object.
-
- The methods called during deserialization of the object.
-
-
-
- Gets or sets all methods called after serialization of the object graph.
-
- The methods called after serialization of the object graph.
-
-
-
- Gets or sets all methods called before serialization of the object.
-
- The methods called before serialization of the object.
-
-
-
- Gets or sets all method called when an error is thrown during the serialization of the object.
-
- The methods called when an error is thrown during the serialization of the object.
-
-
-
- Gets or sets the default creator method used to create the object.
-
- The default creator method used to create the object.
-
-
-
- Gets or sets a value indicating whether the default creator is non-public.
-
- true if the default object creator is non-public; otherwise, false .
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the dictionary key resolver.
-
- The dictionary key resolver.
-
-
-
- Gets the of the dictionary keys.
-
- The of the dictionary keys.
-
-
-
- Gets the of the dictionary values.
-
- The of the dictionary values.
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
-
- The function used to create the object.
-
-
-
- Gets a value indicating whether the creator has a parameter with the dictionary values.
-
- true if the creator has a parameter with the dictionary values; otherwise, false .
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets the object's properties.
-
- The object's properties.
-
-
-
- Gets or sets the property name resolver.
-
- The property name resolver.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the object constructor.
-
- The object constructor.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Gets or sets the object member serialization.
-
- The member object serialization.
-
-
-
- Gets or sets the missing member handling used when deserializing this object.
-
- The missing member handling.
-
-
-
- Gets or sets a value that indicates whether the object's properties are required.
-
-
- A value indicating whether the object's properties are required.
-
-
-
-
- Gets or sets how the object's properties with null values are handled during serialization and deserialization.
-
- How the object's properties with null values are handled during serialization and deserialization.
-
-
-
- Gets the object's properties.
-
- The object's properties.
-
-
-
- Gets a collection of instances that define the parameters used with .
-
-
-
-
- Gets or sets the function used to create the object. When set this function will override .
- This function is called with a collection of arguments which are defined by the collection.
-
- The function used to create the object.
-
-
-
- Gets or sets the extension data setter.
-
-
-
-
- Gets or sets the extension data getter.
-
-
-
-
- Gets or sets the extension data value type.
-
-
-
-
- Gets or sets the extension data name resolver.
-
- The extension data name resolver.
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Maps a JSON property to a .NET member or constructor parameter.
-
-
-
-
- Gets or sets the name of the property.
-
- The name of the property.
-
-
-
- Gets or sets the type that declared this property.
-
- The type that declared this property.
-
-
-
- Gets or sets the order of serialization of a member.
-
- The numeric order of serialization.
-
-
-
- Gets or sets the name of the underlying member or parameter.
-
- The name of the underlying member or parameter.
-
-
-
- Gets the that will get and set the during serialization.
-
- The that will get and set the during serialization.
-
-
-
- Gets or sets the for this property.
-
- The for this property.
-
-
-
- Gets or sets the type of the property.
-
- The type of the property.
-
-
-
- Gets or sets the for the property.
- If set this converter takes precedence over the contract converter for the property type.
-
- The converter.
-
-
-
- Gets or sets the member converter.
-
- The member converter.
-
-
-
- Gets or sets a value indicating whether this is ignored.
-
- true if ignored; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this is readable.
-
- true if readable; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this is writable.
-
- true if writable; otherwise, false .
-
-
-
- Gets or sets a value indicating whether this has a member attribute.
-
- true if has a member attribute; otherwise, false .
-
-
-
- Gets the default value.
-
- The default value.
-
-
-
- Gets or sets a value indicating whether this is required.
-
- A value indicating whether this is required.
-
-
-
- Gets a value indicating whether has a value specified.
-
-
-
-
- Gets or sets a value indicating whether this property preserves object references.
-
-
- true if this instance is reference; otherwise, false .
-
-
-
-
- Gets or sets the property null value handling.
-
- The null value handling.
-
-
-
- Gets or sets the property default value handling.
-
- The default value handling.
-
-
-
- Gets or sets the property reference loop handling.
-
- The reference loop handling.
-
-
-
- Gets or sets the property object creation handling.
-
- The object creation handling.
-
-
-
- Gets or sets or sets the type name handling.
-
- The type name handling.
-
-
-
- Gets or sets a predicate used to determine whether the property should be serialized.
-
- A predicate used to determine whether the property should be serialized.
-
-
-
- Gets or sets a predicate used to determine whether the property should be deserialized.
-
- A predicate used to determine whether the property should be deserialized.
-
-
-
- Gets or sets a predicate used to determine whether the property should be serialized.
-
- A predicate used to determine whether the property should be serialized.
-
-
-
- Gets or sets an action used to set whether the property has been deserialized.
-
- An action used to set whether the property has been deserialized.
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Gets or sets the converter used when serializing the property's collection items.
-
- The collection's items converter.
-
-
-
- Gets or sets whether this property's collection items are serialized as a reference.
-
- Whether this property's collection items are serialized as a reference.
-
-
-
- Gets or sets the type name handling used when serializing the property's collection items.
-
- The collection's items type name handling.
-
-
-
- Gets or sets the reference loop handling used when serializing the property's collection items.
-
- The collection's items reference loop handling.
-
-
-
- A collection of objects.
-
-
-
-
- Initializes a new instance of the class.
-
- The type.
-
-
-
- When implemented in a derived class, extracts the key from the specified element.
-
- The element from which to extract the key.
- The key for the specified element.
-
-
-
- Adds a object.
-
- The property to add to the collection.
-
-
-
- Gets the closest matching object.
- First attempts to get an exact case match of and then
- a case insensitive match.
-
- Name of the property.
- A matching property if found.
-
-
-
- Gets a property by property name.
-
- The name of the property to get.
- Type property name string comparison.
- A matching property if found.
-
-
-
- Contract details for a used by the .
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying type for the contract.
-
-
-
- Lookup and create an instance of the type described by the argument.
-
- The type to create.
- Optional arguments to pass to an initializing constructor of the JsonConverter.
- If null , the default constructor is used.
-
-
-
- A kebab case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Represents a trace writer that writes to memory. When the trace message limit is
- reached then old trace messages will be removed as new messages are added.
-
-
-
-
- Gets the that will be used to filter the trace messages passed to the writer.
- For example a filter level of will exclude messages and include ,
- and messages.
-
-
- The that will be used to filter the trace messages passed to the writer.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Writes the specified trace level, message and optional exception.
-
- The at which to write this trace.
- The trace message.
- The trace exception. This parameter is optional.
-
-
-
- Returns an enumeration of the most recent trace messages.
-
- An enumeration of the most recent trace messages.
-
-
-
- Returns a of the most recent trace messages.
-
-
- A of the most recent trace messages.
-
-
-
-
- A base class for resolving how property names and dictionary keys are serialized.
-
-
-
-
- A flag indicating whether dictionary keys should be processed.
- Defaults to false .
-
-
-
-
- A flag indicating whether extension data names should be processed.
- Defaults to false .
-
-
-
-
- A flag indicating whether explicitly specified property names,
- e.g. a property name customized with a , should be processed.
- Defaults to false .
-
-
-
-
- Gets the serialized name for a given property name.
-
- The initial property name.
- A flag indicating whether the property has had a name explicitly specified.
- The serialized property name.
-
-
-
- Gets the serialized name for a given extension data name.
-
- The initial extension data name.
- The serialized extension data name.
-
-
-
- Gets the serialized key for a given dictionary key.
-
- The initial dictionary key.
- The serialized dictionary key.
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Hash code calculation
-
-
-
-
-
- Object equality implementation
-
-
-
-
-
-
- Compare to another NamingStrategy
-
-
-
-
-
-
- Represents a method that constructs an object.
-
- The object type to create.
-
-
-
- When applied to a method, specifies that the method is called when an error occurs serializing an object.
-
-
-
-
- Provides methods to get attributes from a , , or .
-
-
-
-
- Initializes a new instance of the class.
-
- The instance to get attributes for. This parameter should be a , , or .
-
-
-
- Returns a collection of all of the attributes, or an empty collection if there are no attributes.
-
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Returns a collection of attributes, identified by type, or an empty collection if there are no attributes.
-
- The type of the attributes.
- When true , look up the hierarchy chain for the inherited custom attribute.
- A collection of s, or an empty collection.
-
-
-
- Get and set values for a using reflection.
-
-
-
-
- Initializes a new instance of the class.
-
- The member info.
-
-
-
- Sets the value.
-
- The target to set the value on.
- The value to set on the target.
-
-
-
- Gets the value.
-
- The target to get the value from.
- The value.
-
-
-
- A snake case naming strategy.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
-
-
- Initializes a new instance of the class.
-
-
- A flag indicating whether dictionary keys should be processed.
-
-
- A flag indicating whether explicitly specified property names should be processed,
- e.g. a property name customized with a .
-
-
- A flag indicating whether extension data names should be processed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Resolves the specified property name.
-
- The property name to resolve.
- The resolved property name.
-
-
-
- Specifies how strings are escaped when writing JSON text.
-
-
-
-
- Only control characters (e.g. newline) are escaped.
-
-
-
-
- All non-ASCII and control characters (e.g. newline) are escaped.
-
-
-
-
- HTML (<, >, &, ', ") and control characters (e.g. newline) are escaped.
-
-
-
-
- Indicates the method that will be used during deserialization for locating and loading assemblies.
-
-
-
-
- In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization. Specifically, the version numbers need not match as the LoadWithPartialName method of the class is used to load the assembly.
-
-
-
-
- In full mode, the assembly used during deserialization must match exactly the assembly used during serialization. The Load method of the class is used to load the assembly.
-
-
-
-
- Specifies type name handling options for the .
-
-
- should be used with caution when your application deserializes JSON from an external source.
- Incoming types should be validated with a custom
- when deserializing with a value other than .
-
-
-
-
- Do not include the .NET type name when serializing types.
-
-
-
-
- Include the .NET type name when serializing into a JSON object structure.
-
-
-
-
- Include the .NET type name when serializing into a JSON array structure.
-
-
-
-
- Always include the .NET type name when serializing.
-
-
-
-
- Include the .NET type name when the type of the object being serialized is not the same as its declared type.
- Note that this doesn't include the root serialized object by default. To include the root object's type name in JSON
- you must specify a root type object with
- or .
-
-
-
-
- Determines whether the collection is null or empty.
-
- The collection.
-
- true if the collection is null or empty; otherwise, false .
-
-
-
-
- Adds the elements of the specified collection to the specified generic .
-
- The list to add to.
- The collection of elements to add.
-
-
-
- Converts the value to the specified type. If the value is unable to be converted, the
- value is checked whether it assignable to the specified type.
-
- The value to convert.
- The culture to use when converting.
- The type to convert or cast the value to.
-
- The converted type. If conversion was unsuccessful, the initial value
- is returned if assignable to the target type.
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic that returns a result
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic, but uses one of the arguments for
- the result.
-
-
-
-
- Helper method for generating a MetaObject which calls a
- specific method on Dynamic, but uses one of the arguments for
- the result.
-
-
-
-
- Returns a Restrictions object which includes our current restrictions merged
- with a restriction limiting our type
-
-
-
-
- Helper class for serializing immutable collections.
- Note that this is used by all builds, even those that don't support immutable collections, in case the DLL is GACed
- https://github.com/JamesNK/Newtonsoft.Json/issues/652
-
-
-
-
- Gets the type of the typed collection's items.
-
- The type.
- The type of the typed collection's items.
-
-
-
- Gets the member's underlying type.
-
- The member.
- The underlying type of the member.
-
-
-
- Determines whether the property is an indexed property.
-
- The property.
-
- true if the property is an indexed property; otherwise, false .
-
-
-
-
- Gets the member's value on the object.
-
- The member.
- The target object.
- The member's value on the object.
-
-
-
- Sets the member's value on the target object.
-
- The member.
- The target.
- The value.
-
-
-
- Determines whether the specified MemberInfo can be read.
-
- The MemberInfo to determine whether can be read.
- /// if set to true then allow the member to be gotten non-publicly.
-
- true if the specified MemberInfo can be read; otherwise, false .
-
-
-
-
- Determines whether the specified MemberInfo can be set.
-
- The MemberInfo to determine whether can be set.
- if set to true then allow the member to be set non-publicly.
- if set to true then allow the member to be set if read-only.
-
- true if the specified MemberInfo can be set; otherwise, false .
-
-
-
-
- Builds a string. Unlike this class lets you reuse its internal buffer.
-
-
-
-
- Determines whether the string is all white space. Empty string will return false .
-
- The string to test whether it is all white space.
-
- true if the string is all white space; otherwise, false .
-
-
-
-
- Specifies the state of the .
-
-
-
-
- An exception has been thrown, which has left the in an invalid state.
- You may call the method to put the in the Closed state.
- Any other method calls result in an being thrown.
-
-
-
-
- The method has been called.
-
-
-
-
- An object is being written.
-
-
-
-
- An array is being written.
-
-
-
-
- A constructor is being written.
-
-
-
-
- A property is being written.
-
-
-
-
- A write method has not been called.
-
-
-
- Specifies that an output will not be null even if the corresponding type allows it.
-
-
- Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it.
-
-
- Initializes the attribute with the specified return value condition.
-
- The return value condition. If the method returns this value, the associated parameter will not be null.
-
-
-
- Gets the return value condition.
-
-
- Specifies that an output may be null even if the corresponding type disallows it.
-
-
- Specifies that null is allowed as an input even if the corresponding type disallows it.
-
-
-
- Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
-
-
-
-
- Initializes a new instance of the class.
-
-
- The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
- the associated parameter matches this value.
-
-
-
- Gets the condition parameter value.
-
-
-
diff --git a/json.net/net40/README.md b/json.net/net40/README.md
deleted file mode 100644
index 21c4c48..0000000
--- a/json.net/net40/README.md
+++ /dev/null
@@ -1 +0,0 @@
-forked from https://github.com/JamesNK/Newtonsoft.Json
\ No newline at end of file
diff --git a/qrcoder/net40/QRCoder.dll b/qrcoder/net40/QRCoder.dll
deleted file mode 100644
index ffe773e..0000000
Binary files a/qrcoder/net40/QRCoder.dll and /dev/null differ
diff --git a/qrcoder/net40/readme.md b/qrcoder/net40/readme.md
deleted file mode 100644
index 4cfdda3..0000000
--- a/qrcoder/net40/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-forked from https://github.com/codebude/QRCoder
diff --git a/ssh.net/net40/Renci.SshNet.dll b/ssh.net/net40/Renci.SshNet.dll
deleted file mode 100644
index dbfbb95..0000000
Binary files a/ssh.net/net40/Renci.SshNet.dll and /dev/null differ
diff --git a/ssh.net/net40/Renci.SshNet.xml b/ssh.net/net40/Renci.SshNet.xml
deleted file mode 100644
index a60b08d..0000000
--- a/ssh.net/net40/Renci.SshNet.xml
+++ /dev/null
@@ -1,21682 +0,0 @@
-
-
-
- Renci.SshNet
-
-
-
-
- Generates a array of the specified length, and fills it with a
- cryptographically strong random sequence of values.
-
- The length of the array generate.
-
-
-
- Fills an array of bytes with a cryptographically strong random sequence of values.
-
- The array to fill with cryptographically strong random bytes.
- is null .
-
- The length of the byte array determines how many random bytes are produced.
-
-
-
-
- Returns the Internet Protocol (IP) addresses for the specified host.
-
- The host name or IP address to resolve
-
- An array of type that holds the IP addresses for the host that
- is specified by the parameter.
-
- is null .
- An error is encountered when resolving .
-
-
-
- Returns an enumerable collection of file information that matches a search pattern.
-
-
- The search string to match against the names of files.
-
- An enumerable collection of files that matches .
-
- is null .
- is null .
- The path represented by does not exist or is not valid.
-
-
-
- Returns a value indicating whether the specified can be used
- to send data.
-
- The to check.
-
- true if can be written to; otherwise, false .
-
-
-
-
- Reads a byte from the specified .
-
- The to read from.
- Specifies the amount of time after which the call will time out.
-
- The byte read, or -1 if the socket was closed.
-
- The read operation timed out.
- The read failed.
-
-
-
- Sends a byte using the specified .
-
- The to write to.
- The value to send.
- The write failed.
-
-
-
- Receives data from a bound .
-
-
- The number of bytes to receive.
- Specifies the amount of time after which the call will time out.
-
- The bytes received.
-
-
- If no data is available for reading, the method will
- block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
- call will throw a .
- If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
- method will complete immediately and throw a .
-
-
-
-
- Receives data from a bound into a receive buffer.
-
-
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to receive.
- Specifies the amount of time after which the call will time out.
-
- The number of bytes received.
-
-
- If no data is available for reading, the method will
- block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
- call will throw a .
- If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
- method will complete immediately and throw a .
-
-
-
-
- Suspends the current thread for the specified number of milliseconds.
-
- The number of milliseconds for which the thread is suspended.
-
-
-
- Executes the specified action in a separate thread.
-
- The action to execute.
-
-
-
- Base class for all supported authentication methods
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the authentication method.
-
-
-
-
- Gets connection username.
-
-
-
-
- Gets list of allowed authentications.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Represents possible authentication methods results
-
-
-
-
- Authentication was successful.
-
-
-
-
- Authentication completed with partial success.
-
-
-
-
- Authentication failed.
-
-
-
-
- Serves as base class for client implementations, provides common client functionality.
-
-
-
-
- Holds value indicating whether the connection info is owned by this client.
-
-
-
-
- Gets the current session.
-
-
- The current session.
-
-
-
-
- Gets the factory for creating new services.
-
-
- The factory for creating new services.
-
-
-
-
- Gets the connection info.
-
-
- The connection info.
-
- The method was called after the client was disposed.
-
-
-
- Gets a value indicating whether this client is connected to the server.
-
-
- true if this client is connected; otherwise, false .
-
- The method was called after the client was disposed.
-
-
-
- Gets or sets the keep-alive interval.
-
-
- The keep-alive interval. Specify negative one (-1) milliseconds to disable the
- keep-alive. This is the default value.
-
- The method was called after the client was disposed.
-
-
-
- Occurs when an error occurred.
-
-
-
-
-
-
-
- Occurs when host key received.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Connects client to the server.
-
- The client is already connected.
- The method was called after the client was disposed.
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Disconnects client from the server.
-
- The method was called after the client was disposed.
-
-
-
- Sends a keep-alive message to the server.
-
-
- Use to configure the client to send a keep-alive at regular
- intervals.
-
- The method was called after the client was disposed.
-
-
-
- Called when client is connecting to the server.
-
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Called when client is disconnected from the server.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Check if the current instance is disposed.
-
- THe current instance is disposed.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Stops the keep-alive timer, and waits until all timer callbacks have been
- executed.
-
-
-
-
- Starts the keep-alive timer.
-
-
- When is negative one (-1) milliseconds, then
- the timer will not be started.
-
-
-
-
- Creates a with the specified due time and interval.
-
- The amount of time to delay before the keep-alive message is first sent. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately.
- The time interval between attempts to send a keep-alive message. Specify negative one (-1) milliseconds to disable periodic signaling.
-
- A with the specified due time and interval.
-
-
-
-
- Disposes the SSH session, and assigns null to .
-
-
-
-
- Returns a value indicating whether the SSH session is established.
-
-
- true if the SSH session is established; otherwise, false .
-
-
-
-
- Represents base class for SSH channel implementations.
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_CLOSE has been sent to the remote party.
-
-
- true when a SSH_MSG_CHANNEL_CLOSE message has been sent to the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether a SSH_MSG_CHANNEL_CLOSE has been received from the other
- party.
-
-
- true when a SSH_MSG_CHANNEL_CLOSE message has been received from the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_EOF has been received from the other party.
-
-
- true when a SSH_MSG_CHANNEL_EOF message has been received from the other party;
- otherwise, false .
-
-
-
-
- Holds a value indicating whether the SSH_MSG_CHANNEL_EOF has been sent to the remote party.
-
-
- true when a SSH_MSG_CHANNEL_EOF message has been sent to the remote party;
- otherwise, false .
-
-
-
-
- Occurs when an exception is thrown when processing channel messages.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the session.
-
-
- Thhe session.
-
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can receive using the channel.
-
-
- The maximum size of a packet.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Gets the size of the local window.
-
-
- The size of the local window.
-
-
-
-
- Gets the remote channel number.
-
-
- The remote channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can send using the channel.
-
-
- The maximum size of data that can be sent using a
- on the current channel.
-
- The channel has not been opened, or the open has not yet been confirmed.
-
-
-
- Gets the window size of the remote server.
-
-
- The size of the server window.
-
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
-
-
- Gets the connection info.
-
- The connection info.
-
-
-
- Gets the session semaphore to control number of session channels.
-
- The session semaphore.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- The payload to send.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- An array of containing the payload to send.
- The zero-based offset in at which to begin taking data from.
- The number of bytes of to send.
-
-
- When the size of the data to send exceeds the maximum packet size or the remote window
- size does not allow the full data to be sent, then this method will send the data in
- multiple chunks and will wait for the remote window size to be adjusted when it's zero.
-
-
- This is done to support SSH servers will a small window size that do not agressively
- increase their window size. We need to take into account that there may be SSH servers
- that only increase their window size when it has reached zero.
-
-
-
-
-
- Called when channel window need to be adjust.
-
- The bytes to add.
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Called when channel extended data is received.
-
- The data.
- The data type code.
-
-
-
- Called when channel has no more data to receive.
-
-
-
-
- Called when channel is closed by the server.
-
-
-
-
- Called when channel request received.
-
- Channel request information.
-
-
-
- Called when channel request was successful
-
-
-
-
- Called when channel request failed.
-
-
-
-
- Raises event.
-
- The exception.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Sends SSH message to the server.
-
- The message.
-
-
-
- Sends a SSH_MSG_CHANNEL_EOF message to the remote server.
-
- The channel is closed.
-
-
-
- Waits for the handle to be signaled or for an error to occurs.
-
- The wait handle.
-
-
-
- Closes the channel, waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when an occurs while processing a channel message.
-
- The .
-
- This method will in turn invoke , and
- raise the event.
-
-
-
-
- Determines the length of data that currently can be sent in a single message.
-
- The length of the message that must be sent.
-
- The actual data length that currently can be sent.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements "direct-tcpip" SSH channel.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Occurs as the forwarded port is being stopped.
-
-
-
-
- Binds channel to remote host.
-
-
-
-
- Closes the socket, hereby interrupting the blocking receive in .
-
-
-
-
- Shuts down the socket.
-
- One of the values that specifies the operation that will no longer be allowed.
-
-
-
- Closes the channel, waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Called when channel has no more data to receive.
-
-
-
-
- Called whenever an unhandled occurs in causing
- the message loop to be interrupted, or when an exception occurred processing a channel message.
-
-
-
-
- Called when the server wants to terminate the connection immmediately.
-
-
- The sender MUST NOT send or receive any data after this message, and
- the recipient MUST NOT accept any data after receiving this message.
-
-
-
-
- Implements "forwarded-tcpip" SSH channel.
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
- The remote channel number.
- The window size of the remote party.
- The maximum size of a data packet that we can send to the remote party.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Binds the channel to the specified endpoint.
-
- The endpoint to connect to.
- The forwarded port for which the channel is opened.
-
-
-
- Occurs as the forwarded port is being stopped.
-
-
-
-
- Shuts down the socket.
-
- One of the values that specifies the operation that will no longer be allowed.
-
-
-
- Closes the socket, hereby interrupting the blocking receive in .
-
-
-
-
- Closes the channel waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
-
-
-
-
- Called when channel data is received.
-
- The data.
-
-
-
- Implements Session SSH channel.
-
-
-
-
- Counts failed channel open attempts
-
-
-
-
- Holds a value indicating whether the session semaphore has been obtained by the current
- channel.
-
-
- 0 when the session semaphore has not been obtained or has already been released,
- and 1 when the session has been obtained and still needs to be released.
-
-
-
-
- Wait handle to signal when response was received to open the channel
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Gets the type of the channel.
-
-
- The type of the channel.
-
-
-
-
- Opens the channel.
-
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Called when channel failed to open.
-
- The reason code.
- The description.
- The language.
-
-
-
- Sends the pseudo terminal request.
-
- The environment variable.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode values.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the X11 forwarding request.
-
- if set to true the it is single connection.
- The protocol.
- The cookie.
- The screen number.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the environment variable request.
-
- Name of the variable.
- The variable value.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the shell request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- The command.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- Length of the break.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the subsystem request.
-
- The subsystem.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the window change request.
-
- The columns.
- The rows.
- The width.
- The height.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the local flow request.
-
- if set to true [client can do].
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the signal request.
-
- Name of the signal.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit status request.
-
- The exit status.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit signal request.
-
- Name of the signal.
- if set to true [core dumped].
- The error message.
- The language.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends eow@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends keepalive@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Called when channel request was successful
-
-
-
-
- Called when channel request failed.
-
-
-
-
- Sends the channel open message.
-
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
- When a session semaphore for this instance has not yet been obtained by this or any other thread,
- the thread will block until such a semaphore is available and send a
- to the remote host.
-
-
- Note that the session semaphore is released in any of the following cases:
-
- -
-
A is received for the channel being opened.
-
- -
-
The remote host does not respond to the within the configured .
-
- -
-
The remote host closes the channel.
-
- -
-
The is disposed.
-
- -
-
A socket error occurs sending a message to the remote host.
-
-
-
-
- If the session semaphore was already obtained for this instance (and not released), then this method
- immediately returns control to the caller. This should only happen when another thread has obtain the
- session semaphore and already sent the , but the remote host did not
- confirmed or rejected attempt to open the channel.
-
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases the session semaphore.
-
-
- When the session semaphore has already been released, or was never obtained by
- this instance, then this method does nothing.
-
-
-
-
- Lists channel types as defined by the protocol.
-
-
-
-
- session
-
-
-
-
- x11
-
-
-
-
- forwarded-tcpip
-
-
-
-
- direct-tcpip
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Called when channel is opened by the server.
-
- The remote channel number.
- Initial size of the window.
- Maximum size of the packet.
-
-
-
- Send message to open a channel.
-
- Message to send
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Called when channel failed to open.
-
- The reason code.
- The description.
- The language.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Represents SSH channel.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when an exception is thrown when processing channel messages.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Occurs when is received.
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the maximum size of a data packet that we can receive using the channel.
-
-
- The maximum size of a packet.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Gets the maximum size of a data packet that can be sent using the channel.
-
-
- The maximum size of data that can be sent using a
- on the current channel.
-
- The channel has not been opened, or the open has not yet been confirmed.
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- The payload to send.
-
-
-
- Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
-
- An array of containing the payload to send.
- The zero-based offset in at which to begin taking data from.
- The number of bytes of to send.
-
-
- When the size of the data to send exceeds the maximum packet size or the remote window
- size does not allow the full data to be sent, then this method will send the data in
- multiple chunks and will wait for the remote window size to be adjusted when it's zero.
-
-
- This is done to support SSH servers will a small window size that do not agressively
- increase their window size. We need to take into account that there may be SSH servers
- that only increase their window size when it has reached zero.
-
-
-
-
-
- Sends a SSH_MSG_CHANNEL_EOF message to the remote server.
-
- The channel is closed.
-
-
-
- A "direct-tcpip" SSH channel.
-
-
-
-
- Occurs when an exception is thrown while processing channel messages.
-
-
-
-
- Gets a value indicating whether this channel is open.
-
-
- true if this channel is open; otherwise, false .
-
-
-
-
- Gets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Opens a channel for a locally forwarded TCP/IP port.
-
- The name of the remote host to forward to.
- The port of the remote hosts to forward to.
- The forwarded port for which the channel is opened.
- The socket to receive requests from, and send responses from the remote host to.
-
-
-
- Binds the channel to the remote host.
-
-
-
-
- A "forwarded-tcpip" SSH channel.
-
-
-
-
- Occurs when an exception is thrown while processing channel messages.
-
-
-
-
- Binds the channel to the specified endpoint.
-
- The endpoint to connect to.
- The forwarded port for which the channel is opened.
-
-
-
- Session SSH channel.
-
-
-
-
- Opens the channel.
-
-
-
-
- Sends the pseudo terminal request.
-
- The environment variable.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode values.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the X11 forwarding request.
-
- if set to true the it is single connection.
- The protocol.
- The cookie.
- The screen number.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the environment variable request.
-
- Name of the variable.
- The variable value.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the shell request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- The command.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exec request.
-
- Length of the break.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the subsystem request.
-
- The subsystem.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the window change request.
-
- The columns.
- The rows.
- The width.
- The height.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the local flow request.
-
- if set to true [client can do].
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the signal request.
-
- Name of the signal.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit status request.
-
- The exit status.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends the exit signal request.
-
- Name of the signal.
- if set to true [core dumped].
- The error message.
- The language.
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends eow@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Sends keepalive@openssh.com request.
-
-
- true if request was successful; otherwise false .
-
-
-
-
- Initializes a new instance.
-
- The session.
- The local channel number.
- Size of the window.
- Size of the packet.
- The remote channel number.
- The window size of the remote party.
- The maximum size of a data packet that we can send to the remote party.
-
-
-
- Holds information about key size and cipher to use
-
-
-
-
- Gets the size of the key.
-
-
- The size of the key.
-
-
-
-
- Gets the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- Size of the key.
- The cipher.
-
-
-
- Initializes a new instance.
-
- The number of times an authentication attempt with any given can result in before it is disregarded.
- is less than one.
-
-
-
- Gets the number of times an authentication attempt with any given can
- result in before it is disregarded.
-
-
- The number of times an authentication attempt with any given can result
- in before it is disregarded.
-
-
-
-
- Attempts to authentication for a given using the
- of the specified .
-
- A to use for authenticating.
- The for which to perform authentication.
-
-
-
- Records if a given has been tried, and how many times this resulted
- in .
-
-
- When there's no entry for a given , then it was never tried.
-
-
-
-
- Holds the list of authentications methods that failed.
-
-
-
-
- Records a authentication attempt for the specified
- .
-
- An for which to record the result of an authentication attempt.
-
-
-
- Records a authentication attempt for the specified
- .
-
- An for which to record the result of an authentication attempt.
-
-
-
- Returns the number of times an authentication attempt with the specified
- has resulted in .
-
- An .
-
- The number of times an authentication attempt with the specified
- has resulted in .
-
-
-
-
- Returns a list of supported authentication methods that match one of the specified allowed authentication
- methods.
-
- A list of allowed authentication methods.
-
- A list of supported authentication methods that match one of the specified allowed authentication methods.
-
-
- The authentication methods are returned in the order in which they were specified in the list that was
- used to initialize the current instance.
-
-
-
-
- Returns the authentication methods from the specified list that have not yet failed.
-
- A list of authentication methods.
-
- The authentication methods from that have not yet failed.
-
-
-
- This method first returns the authentication methods that have not yet been executed, and only then
- returns those for which an authentication attempt resulted in a .
-
-
- Any that has failed is skipped.
-
-
-
-
-
- Provides additional information for asynchronous command execution
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets or sets the bytes received. If SFTP only file bytes are counted.
-
- Total bytes received.
-
-
-
- Gets or sets the bytes sent by SFTP.
-
- Total bytes sent.
-
-
-
- Gets a user-defined object that qualifies or contains information about an asynchronous operation.
-
- A user-defined object that qualifies or contains information about an asynchronous operation.
-
-
-
- Gets a that is used to wait for an asynchronous operation to complete.
-
- A that is used to wait for an asynchronous operation to complete.
-
-
-
- Gets a value that indicates whether the asynchronous operation completed synchronously.
-
- true if the asynchronous operation completed synchronously; otherwise, false.
-
-
-
- Gets a value that indicates whether the asynchronous operation has completed.
-
- true if the operation is complete; otherwise, false.
-
-
-
- Gets a value indicating whether was already called for this
- .
-
-
- true if was already called for this ;
- otherwise, false .
-
-
-
-
- Base class to encapsulates the results of an asynchronous operation.
-
-
-
-
- Gets or sets a value indicating whether has been called on the current
- .
-
-
- true if has been called on the current ;
- otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Marks asynchronous operation as completed.
-
- The exception.
- if set to true [completed synchronously].
-
-
-
- Waits until the asynchronous operation completes, and then returns.
-
-
-
-
- Gets a user-defined object that qualifies or contains information about an asynchronous operation.
-
- A user-defined object that qualifies or contains information about an asynchronous operation.
-
-
-
- Gets a value that indicates whether the asynchronous operation completed synchronously.
-
- true if the asynchronous operation completed synchronously; otherwise, false.
-
-
-
- Gets a that is used to wait for an asynchronous operation to complete.
-
- A that is used to wait for an asynchronous operation to complete.
-
-
-
- Gets a value that indicates whether the asynchronous operation has completed.
-
-
- true if the operation is complete; otherwise, false .
-
-
-
- Base class to encapsulates the results of an asynchronous operation that returns result.
-
- The type of the result.
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Marks asynchronous operation as completed.
-
- The result.
- if set to true [completed synchronously].
-
-
-
- Waits until the asynchronous operation completes, and then returns the value generated by the asynchronous operation.
-
-
- The invocation result.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets banner message.
-
-
-
-
- Gets banner language.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- Banner message.
- Banner language.
-
-
-
- Base class for authentication events.
-
-
-
-
- Gets the username.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
-
-
-
- Provides data for event.
-
-
-
-
- Gets or sets the new password.
-
-
- The new password.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
-
-
-
- Provides prompt information when is raised
-
-
-
-
- Gets the prompt sequence id.
-
-
-
-
- Gets or sets a value indicating whether the user input should be echoed as characters are typed.
-
-
- true if the user input should be echoed as characters are typed; otherwise, false .
-
-
-
-
- Gets server information request.
-
-
-
-
- Gets or sets server information response.
-
-
- The response.
-
-
-
-
- Initializes a new instance of the class.
-
- The sequence id.
- if set to true the user input should be echoed.
- The request.
-
-
-
- Provides data for event.
-
-
-
-
- Gets prompt language.
-
-
-
-
- Gets prompt instruction.
-
-
-
-
- Gets server information request prompts.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The instruction.
- The language.
- The information request prompts.
-
-
-
- Represents an arbitrarily large signed integer.
-
-
-
-
- Gets number of bits used by the number.
-
-
- The number of the bit used.
-
-
-
-
- Mods the inverse.
-
- The bi.
- The modulus.
-
- Modulus inverted number.
-
-
-
-
- Returns positive remainder that results from division with two specified values.
-
- The value to be divided.
- The value to divide by.
-
- Positive remainder that results from the division.
-
-
-
-
- Generates a new, random of the specified length.
-
- The number of bits for the new number.
- A random number of the specified length.
-
-
-
- Initializes a new instance of the structure using a 32-bit signed integer value.
-
- A 32-bit signed integer.
-
-
-
- Initializes a new instance of the structure using an unsigned 32-bit integer value.
-
- An unsigned 32-bit integer value.
-
-
-
- Initializes a new instance of the structure using a 64-bit signed integer value.
-
- A 64-bit signed integer.
-
-
-
- Initializes a new instance of the structure with an unsigned 64-bit integer value.
-
- An unsigned 64-bit integer.
-
-
-
- Initializes a new instance of the structure using a double-precision floating-point value.
-
- A double-precision floating-point value.
-
-
-
- Initializes a new instance of the structure using a single-precision floating-point value.
-
- A single-precision floating-point value.
-
-
-
- Initializes a new instance of the structure using a value.
-
- A decimal number.
-
-
-
- Initializes a new instance of the structure using the values in a byte array.
-
- An array of values in little-endian order.
- is null .
-
-
-
- Indicates whether the value of the current object is an even number.
-
-
- true if the value of the BigInteger object is an even number; otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is .
-
-
- true if the value of the object is ;
- otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is a power of two.
-
-
- true if the value of the object is a power of two;
- otherwise, false .
-
-
-
-
- Indicates whether the value of the current object is .
-
-
- true if the value of the object is ;
- otherwise, false .
-
-
-
-
- Gets a number that indicates the sign (negative, positive, or zero) of the current object.
-
-
- A number that indicates the sign of the object.
-
-
-
-
- Gets a value that represents the number negative one (-1).
-
-
- An integer whose value is negative one (-1).
-
-
-
-
- Gets a value that represents the number one (1).
-
-
- An object whose value is one (1).
-
-
-
-
- Gets a value that represents the number 0 (zero).
-
-
- An integer whose value is 0 (zero).
-
-
-
-
- Defines an explicit conversion of a object to a 32-bit signed integer value.
-
- The value to convert to a 32-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned 32-bit integer value.
-
- The value to convert to an unsigned 32-bit integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a 16-bit signed integer value.
-
- The value to convert to a 16-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
-
-
-
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned byte value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a signed 8-bit value.
-
- The value to convert to a signed 8-bit value.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a 64-bit signed integer value.
-
- The value to convert to a 64-bit signed integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to an unsigned 64-bit integer value.
-
- The value to convert to an unsigned 64-bit integer.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a single-precision floating-point value.
-
- The value to convert to a single-precision floating-point value.
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 32-bit integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 32-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 16-bit integer to a BigInteger value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 16-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of an unsigned byte to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
-
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a signed 64-bit integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an implicit conversion of a 64-bit unsigned integer to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a value to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Defines an explicit conversion of a object to a value.
-
- The value to convert to a .
-
- An object that contains the value of the parameter.
-
-
-
-
- Adds the values of two specified objects.
-
- The first value to add.
- The second value to add.
-
- The sum of and .
-
-
-
-
- Subtracts a value from another value.
-
- The value to subtract from (the minuend).
- The value to subtract (the subtrahend).
-
- The result of subtracting from .
-
-
-
-
- Multiplies two specified values.
-
- The first value to multiply.
- The second value to multiply.
-
- The product of left and right.
-
-
-
-
- Divides a specified value by another specified value by using
- integer division.
-
- The value to be divided.
- The value to divide by.
-
- The integral result of the division.
-
-
-
-
- Returns the remainder that results from division with two specified values.
-
- The value to be divided.
- The value to divide by.
-
- The remainder that results from the division.
-
-
-
-
- Negates a specified value.
-
- The value to negate.
-
- The result of the parameter multiplied by negative one (-1).
-
-
-
-
- Returns the value of the operand.
-
- An integer value.
-
- The value of the operand.
-
-
- The sign of the operand is unchanged.
-
-
-
-
- Increments a value by 1.
-
- The value to increment.
-
- The value of the parameter incremented by 1.
-
-
-
-
- Decrements a value by 1.
-
- The value to decrement.
-
- The value of the parameter decremented by 1.
-
-
-
-
- Performs a bitwise And operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise And operation.
-
-
-
-
- Performs a bitwise Or operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise Or operation.
-
-
-
-
- Performs a bitwise exclusive Or (XOr ) operation on two values.
-
- The first value.
- The second value.
-
- The result of the bitwise Or operation.
-
-
-
-
- Returns the bitwise one's complement of a value.
-
- An integer value.
-
- The bitwise one's complement of .
-
-
-
-
- Shifts a value a specified number of bits to the left.
-
- The value whose bits are to be shifted.
- The number of bits to shift value to the left.
-
- A value that has been shifted to the left by the specified number of bits.
-
-
-
-
- Shifts a value a specified number of bits to the right.
-
- The value whose bits are to be shifted.
- The number of bits to shift value to the right.
-
- A value that has been shifted to the right by the specified number of bits.
-
-
-
-
- Returns a value that indicates whether a value is less than another
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than a 64-bit signed integer.
-
- The first value to compare.
- The second value to compare.
-
- true if left is than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is less than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than ; otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal
- to another value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal
- to a 64-bit signed integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is less than or equal to a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is less than or equal to
- a 64-bit unsigned integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is less than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is less than or equal to ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than another
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a is greater than a 64-bit signed integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is greater than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than a 64-bit unsigned integer.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is greater than a value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal
- to another value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal
- to a 64-bit signed integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer is greater than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value is greater than or equal to a
- 64-bit unsigned integer value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer is greater than or equal to a
- value.
-
- The first value to compare.
- The second value to compare.
-
- true if is greater than ;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the values of two objects are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a signed long integer value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a signed long integer value and a value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and an unsigned long integer value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether an unsigned long integer value and a value are equal.
-
- The first value to compare.
- The second value to compare.
-
- true if the and parameters have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether two objects have different values.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a 64-bit signed integer are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit signed integer and a value are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a value and a 64-bit unsigned integer are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether a 64-bit unsigned integer and a value are not equal.
-
- The first value to compare.
- The second value to compare.
-
- true if and are not equal;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a specified object have the same value.
-
- The object to compare.
-
- true if the parameter is a object or a type capable
- of implicit conversion to a value, and its value is equal to the value of the
- current object; otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a specified object
- have the same value.
-
- The object to compare.
-
- true if this object and have the same value;
- otherwise, false .
-
-
-
-
- Returns a value that indicates whether the current instance and a signed 64-bit integer have the same value.
-
- The signed 64-bit integer value to compare.
-
- true if the signed 64-bit integer and the current instance have the same value; otherwise, false .
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation.
-
-
- The string representation of the current value.
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified format.
-
- A standard or custom numeric format string.
-
- The string representation of the current value in the format specified by the
- parameter.
-
- is not a valid format string.
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified culture-specific formatting information.
-
- An object that supplies culture-specific formatting information.
-
- The string representation of the current value in the format specified by the
- parameter.
-
-
-
-
- Converts the numeric value of the current object to its equivalent string representation
- by using the specified format and culture-specific format information.
-
- A standard or custom numeric format string.
- An object that supplies culture-specific formatting information.
-
- The string representation of the current value as specified by the
- and parameters.
-
-
-
-
- Converts the string representation of a number to its equivalent.
-
- A string that contains the number to convert.
-
- A value that is equivalent to the number specified in the parameter.
-
- is null .
- is not in the correct format.
-
-
-
- Converts the string representation of a number in a specified style to its equivalent.
-
- A string that contains a number to convert.
- A bitwise combination of the enumeration values that specify the permitted format of .
-
- A value that is equivalent to the number specified in the parameter.
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
- is null .
- does not comply with the input pattern specified by .
-
-
-
- Converts the string representation of a number in a specified style to its equivalent.
-
- A string that contains a number to convert.
- An object that provides culture-specific formatting information about .
-
- A value that is equivalent to the number specified in the parameter.
-
- is null .
- is not in the correct format.
-
-
-
- Converts the string representation of a number in a specified style and culture-specific format to its equivalent.
-
- A string that contains a number to convert.
- A bitwise combination of the enumeration values that specify the permitted format of .
- An object that provides culture-specific formatting information about .
-
- A value that is equivalent to the number specified in the parameter.
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
- is null .
- does not comply with the input pattern specified by .
-
-
-
- Tries to convert the string representation of a number to its equivalent, and
- returns a value that indicates whether the conversion succeeded.
-
- The string representation of a number.
- When this method returns, contains the equivalent to the number that is contained in value, or zero (0) if the conversion fails. The conversion fails if the parameter is null or is not of the correct format. This parameter is passed uninitialized.
-
- true if was converted successfully; otherwise, false .
-
- is null .
-
-
-
- Tries to convert the string representation of a number in a specified style and culture-specific format to its
- equivalent, and returns a value that indicates whether the conversion succeeded.
-
- The string representation of a number.
- A bitwise combination of enumeration values that indicates the style elements that can be present in .
- An object that supplies culture-specific formatting information about .
- When this method returns, contains the equivalent to the number that is contained in value, or if the conversion fails. The conversion fails if the parameter is null or is not of the correct format. This parameter is passed uninitialized.
-
- true if was converted successfully; otherwise, false .
-
-
- is not a value.
- -or-
- includes the or flag along with another value.
-
-
-
-
- Returns the smaller of two values.
-
- The first value to compare.
- The second value to compare.
-
- The or parameter, whichever is smaller.
-
-
-
-
- Returns the larger of two values.
-
- The first value to compare.
- The second value to compare.
-
- The or parameter, whichever is larger.
-
-
-
-
- Gets the absolute value of a object.
-
- A number.
-
- The absolute value of .
-
-
-
-
- Divides one value by another, returns the result, and returns the remainder in
- an output parameter.
-
- The value to be divided.
- The value to divide by.
- When this method returns, contains a value that represents the remainder from the division. This parameter is passed uninitialized.
-
- The quotient of the division.
-
-
-
-
- Raises a value to the power of a specified value.
-
- The number to raise to the power.
- The exponent to raise by.
-
- The result of raising to the power.
-
-
-
-
- Performs modulus division on a number raised to the power of another number.
-
- The number to raise to the power.
- The exponent to raise by.
- The number by which to divide raised to the power.
-
- The remainder after dividing raised by by
- .
-
- is negative.
-
-
-
- Finds the greatest common divisor of two values.
-
- The first value.
- The second value.
-
- The greatest common divisor of and .
-
-
-
-
- Returns the logarithm of a specified number in a specified base.
-
- A number whose logarithm is to be found.
- The base of the logarithm.
-
- The base logarithm of value,
-
- The log of is out of range of the data type.
-
-
-
- Returns the natural (base e ) logarithm of a specified number.
-
- The number whose logarithm is to be found.
-
- The natural (base e ) logarithm of .
-
- The base 10 log of value is out of range of the data type.
-
-
-
- Returns the base 10 logarithm of a specified number.
-
- A number whose logarithm is to be found.
-
- The base 10 logarithm of .
-
- The base 10 log of value is out of range of the data type.
-
-
-
- Returns a value that indicates whether the current instance and an unsigned 64-bit integer have the same value.
-
- The unsigned 64-bit integer to compare.
-
- true if the current instance and the unsigned 64-bit integer have the same value; otherwise, false .
-
-
-
-
- Returns the hash code for the current object.
-
-
- A 32-bit signed integer hash code.
-
-
-
-
- Adds two values and returns the result.
-
- The first value to add.
- The second value to add.
-
- The sum of and .
-
-
-
-
- Subtracts one value from another and returns the result.
-
- The value to subtract from (the minuend).
- The value to subtract (the subtrahend).
-
- The result of subtracting from .
-
-
-
-
- Returns the product of two values.
-
- The first number to multiply.
- The second number to multiply.
-
- The product of the and parameters.
-
-
-
-
- Divides one value by another and returns the result.
-
- The value to be divided.
- The value to divide by.
-
- The quotient of the division.
-
-
-
-
- Performs integer division on two values and returns the remainder.
-
- The value to be divided.
- The value to divide by.
-
- The remainder after dividing by .
-
-
-
-
- Negates a specified value.
-
- The value to negate.
-
- The result of the parameter multiplied by negative one (-1).
-
-
-
-
- Compares this instance to a specified object and returns an integer that indicates whether the value of
- this instance is less than, equal to, or greater than the value of the specified object.
-
- The object to compare.
-
- A signed integer that indicates the relationship of the current instance to the parameter,
- as shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
- is not a .
-
-
-
- Compares this instance to a second and returns an integer that indicates whether the
- value of this instance is less than, equal to, or greater than the value of the specified object.
-
- The object to compare.
-
- A signed integer value that indicates the relationship of this instance to , as
- shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares this instance to an unsigned 64-bit integer and returns an integer that indicates whether the value of this
- instance is less than, equal to, or greater than the value of the unsigned 64-bit integer.
-
- The unsigned 64-bit integer to compare.
-
- A signed integer that indicates the relative value of this instance and , as shown
- in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares this instance to a signed 64-bit integer and returns an integer that indicates whether the value of this
- instance is less than, equal to, or greater than the value of the signed 64-bit integer.
-
- The signed 64-bit integer to compare.
-
- A signed integer that indicates the relative value of this instance and , as shown
- in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- The current instance is less than .
-
- -
-
Zero
- The current instance equals .
-
- -
-
Greater than zero
- The current instance is greater than .
-
-
-
-
-
-
- Compares two values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.
-
- The first value to compare.
- The second value to compare.
-
- A signed integer that indicates the relative values of left and right, as shown in the following table.
-
-
- Value
- Condition
-
- -
-
Less than zero
- is less than .
-
- -
-
Zero
- equals .
-
- -
-
Greater than zero
- is greater than .
-
-
-
-
-
-
- Converts a value to a byte array.
-
-
- The value of the current object converted to an array of bytes.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets channel data.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Channel data.
-
-
-
- Base class for all channel related events.
-
-
-
-
- Gets the channel number.
-
-
-
-
- Initializes a new instance of the class.
-
- The channel number.
-
-
-
- Provides data for events.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Channel data.
- Channel data type code.
-
-
-
- Gets the data type code.
-
-
-
-
- Provides data for event.
-
-
-
-
- Initializes a new instance of the class.
-
- The remote channel number.
- The initial window size.
- The maximum packet size.
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Provides data for event.
-
-
-
-
- Gets failure reason code.
-
-
-
-
- Gets failure description.
-
-
-
-
- Gets failure language.
-
-
-
-
- Initializes a new instance of the class.
-
- Channel number.
- Failure reason code.
- Failure description.
- Failure language.
-
-
-
- Provides data for event.
-
-
-
-
- Gets request information.
-
-
-
-
- Initializes a new instance of the class.
-
- Request information.
-
-
-
- Base class for DER encoded data.
-
-
-
-
- Gets a value indicating whether end of data is reached.
-
-
- true if end of data is reached; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded data.
- its a construct
-
-
-
- Encodes written data as DER byte array.
-
- DER Encoded array.
-
-
-
- Reads next mpint data type from internal buffer.
-
- mpint read.
-
-
-
- Reads next int data type from internal buffer.
-
- int read.
-
-
-
- Reads next octetstring data type from internal buffer.
-
- data read.
-
-
-
- Reads next bitstring data type from internal buffer.
-
- data read.
-
-
-
- Reads next object data type from internal buffer.
-
- data read.
-
-
-
- Writes BOOLEAN data into internal buffer.
-
- UInt32 data to write.
-
-
-
- Writes UInt32 data into internal buffer.
-
- UInt32 data to write.
-
-
-
- Writes INTEGER data into internal buffer.
-
- BigInteger data to write.
-
-
-
- Writes OCTETSTRING data into internal buffer.
-
- The data.
-
-
-
- Writes BITSTRING data into internal buffer.
-
- The data.
-
-
-
- Writes OBJECTIDENTIFIER data into internal buffer.
-
- The identifier.
-
-
-
- Writes OBJECTIDENTIFIER data into internal buffer.
-
- The bytes.
-
-
-
- Writes NULL data into internal buffer.
-
-
-
-
- Writes DerData data into internal buffer.
-
- DerData data to write.
-
-
-
- Gets Data Length
-
- length
-
-
-
- Write Byte data into internal buffer.
-
-
-
-
- Reads Byte data into internal buffer.
-
- data read
-
-
-
- Reads lengths Bytes data into internal buffer.
-
- data read
- amount of data to read.
-
-
-
- Provides data for the ErrorOccured events.
-
-
-
-
- Gets the System.Exception that represents the error that occurred.
-
-
-
-
- Initializes a new instance of the class.
-
- An System.Exception that represents the error that occurred.
-
-
-
- Collection of different extension method
-
-
-
-
- Determines whether the specified value is null or white space.
-
- The value.
-
- true if is null or white space; otherwise, false .
-
-
-
-
- Initializes a new instance of the structure using the SSH BigNum2 Format
-
-
-
-
- Reverses the sequence of the elements in the entire one-dimensional .
-
- The one-dimensional to reverse.
-
- The with its elements reversed.
-
-
-
-
- Prints out
-
- The bytes.
-
-
-
- Creates an instance of the specified type using that type's default constructor.
-
- The type to create.
- Type of the instance to create.
- A reference to the newly created object.
-
-
-
- Returns a specified number of contiguous bytes from a given offset.
-
- The array to return a number of bytes from.
- The zero-based offset in at which to begin taking bytes.
- The number of bytes to take from .
-
- A array that contains the specified number of bytes at the specified offset
- of the input array.
-
- is null .
-
- When is zero and equals the length of ,
- then is returned.
-
-
-
-
- Returns a specified number of contiguous bytes from the start of the specified byte array.
-
- The array to return a number of bytes from.
- The number of bytes to take from .
-
- A array that contains the specified number of bytes at the start of the input array.
-
- is null .
-
- When equals the length of , then
- is returned.
-
-
-
-
- Trims the leading zero from a byte array.
-
- The value.
-
- without leading zeros.
-
-
-
-
- Pads with leading zeros if needed.
-
- The data.
- The length to pad to.
-
-
-
- Provides data for the HostKeyReceived event.
-
-
-
-
- Gets or sets a value indicating whether host key can be trusted.
-
-
- true if host key can be trusted; otherwise, false .
-
-
-
-
- Gets the host key.
-
-
-
-
- Gets the host key name.
-
-
-
-
- Gets the finger print.
-
-
-
-
- Gets the length of the key in bits.
-
-
- The length of the key in bits.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
-
-
-
- The exception that is thrown when there is something wrong with the server capabilities.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Describes object identifier for DER encoding
-
-
-
-
- Gets the object identifier.
-
-
-
-
- Initializes a new instance of the class.
-
- The identifiers.
-
-
-
- Provides convenience methods for conversion to and from both Big Endian and Little Endian.
-
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- The buffer offset.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts little endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
- The buffer offset.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
-
-
-
- Populates buffer with little endian number representation.
-
- The number to convert.
- The buffer.
-
-
-
- Returns the specified 64-bit unsigned integer value as an array of bytes.
-
- The number to convert.
- An array of bytes with length 8.
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- The buffer offset.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- Converts big endian bytes into number.
-
- The buffer.
- Converted .
-
-
-
- PipeStream is a thread-safe read/write data stream for use between two threads in a
- single-producer/single-consumer type problem.
-
- 2006/10/13 1.0
- Update on 2008/10/9 1.1 - uses Monitor instead of Manual Reset events for more elegant synchronicity.
-
- Copyright (c) 2006 James Kolpack (james dot kolpack at google mail)
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
- associated documentation files (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge, publish, distribute,
- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or
- substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
- OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-
- Queue of bytes provides the datastructure for transmitting from an
- input stream to an output stream.
-
- Possible more effecient ways to accomplish this.
-
-
-
- Indicates that the input stream has been flushed and that
- all remaining data should be written to the output stream.
-
-
-
-
- Maximum number of bytes to store in the buffer.
-
-
-
-
- Setting this to true will cause Read() to block if it appears
- that it will run out of data.
-
-
-
-
- Indicates whether the current is disposed.
-
-
-
-
- Gets or sets the maximum number of bytes to store in the buffer.
-
- The length of the max buffer.
-
-
-
- Gets or sets a value indicating whether to block last read method before the buffer is empty.
- When true, Read() will block until it can fill the passed in buffer and count.
- When false, Read() will not block, returning all the available buffer data.
-
-
- Setting to true will remove the possibility of ending a stream reader prematurely.
-
-
- true if block last read method before the buffer is empty; otherwise, false .
-
- Methods were called after the stream was closed.
-
-
-
- When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
-
- An I/O error occurs.
- Methods were called after the stream was closed.
-
- Once flushed, any subsequent read operations no longer block until requested bytes are available. Any write operation reactivates blocking
- reads.
-
-
-
-
- When overridden in a derived class, sets the position within the current stream.
-
-
- The new position within the current stream.
-
- A byte offset relative to the origin parameter.
- A value of type indicating the reference point used to obtain the new position.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
-
-
-
- When overridden in a derived class, sets the length of the current stream.
-
- The desired length of the current stream in bytes.
- The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.
-
-
-
- When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
-
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the stream is closed or end of the stream has been reached.
-
- The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- The sum of offset and count is larger than the buffer length.
- Methods were called after the stream was closed.
- The stream does not support reading.
- is null .
- An I/O error occurs.
- offset or count is negative.
-
-
-
- Returns true if there are
-
- The count.
- True if data available; otherwisefalse .
-
-
-
- When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- An array of bytes. This method copies count bytes from buffer to the current stream.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
- is null .
- The sum of offset and count is greater than the buffer length.
- offset or count is negative.
-
-
-
- Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
- Disposing a will interrupt blocking read and write operations.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false.
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- When overridden in a derived class, gets the length in bytes of the stream.
-
-
- A long value representing the length of the stream in bytes.
-
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- When overridden in a derived class, gets or sets the position within the current stream.
-
-
- The current position within the stream.
-
- The stream does not support seeking.
-
-
-
- Provides data for event.
-
-
-
-
- Gets request originator host.
-
-
-
-
- Gets request originator port.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- is null .
- is not within and .
-
-
-
- Gets the file name part of a given POSIX path.
-
- The POSIX path to get the file name for.
-
- The file name part of .
-
- is null .
-
-
- If contains no forward slash, then
- is returned.
-
-
- If path has a trailing slash, return a zero-length string.
-
-
-
-
-
- Gets the directory name part of a given POSIX path.
-
- The POSIX path to get the directory name for.
-
- The directory part of the specified , or . if
- does not contain any directory information.
-
- is null .
-
-
-
- The exception that is thrown when a proxy connection cannot be established.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for the Downloading event.
-
-
-
-
- Gets the downloaded filename.
-
-
-
-
- Gets the downloaded file size.
-
-
-
-
- Gets number of downloaded bytes so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The downloaded filename.
- The downloaded file size.
- The number of downloaded bytes so far.
-
-
-
- The exception that is thrown when SCP error occurred.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for the Uploading event.
-
-
-
-
- Gets the uploaded filename.
-
-
-
-
- Gets the uploaded file size.
-
-
-
-
- Gets number of uploaded bytes so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The uploaded filename.
- The uploaded file size.
- The number of uploaded bytes so far.
-
-
-
- Light implementation of SemaphoreSlim.
-
-
-
-
- Initializes a new instance of the class, specifying
- the initial number of requests that can be granted concurrently.
-
- The initial number of requests for the semaphore that can be granted concurrently.
- is a negative number.
-
-
-
- Gets the current count of the .
-
-
-
-
- Returns a that can be used to wait on the semaphore.
-
-
- A that can be used to wait on the semaphore.
-
-
- A successful wait on the does not imply a successful
- wait on the itself. It should be followed by a true wait
- on the semaphore.
-
-
-
-
- Exits the once.
-
- The previous count of the .
-
-
-
- Exits the a specified number of times.
-
- The number of times to exit the semaphore.
-
- The previous count of the .
-
-
-
-
- Blocks the current thread until it can enter the .
-
-
-
-
- Blocks the current thread until it can enter the , using a 32-bit signed
- integer that specifies the timeout.
-
- The number of milliseconds to wait, or Infinite(-1) to wait indefinitely.
-
- true if the current thread successfully entered the ; otherwise, false .
-
-
-
-
- Blocks the current thread until it can enter the , using a
- to specify the timeout.
-
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- true if the current thread successfully entered the ; otherwise, false .
-
-
-
-
- Finalizes the current .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- The exception that is thrown when file or directory is not found.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when operation permission is denied.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Provides data for Shell DataReceived event
-
-
-
-
- Gets the data.
-
-
-
-
- Gets the line data.
-
-
-
-
- Initializes a new instance of the class.
-
- The data.
-
-
-
- Initializes a new instance of the class.
-
- The line.
-
-
-
- The exception that is thrown when authentication failed.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when connection was terminated.
-
-
-
-
- Gets the disconnect reason if provided by the server or client. Otherwise None.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The disconnect reason code.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The disconnect reason code.
- The inner.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Base ssh data serialization type
-
-
-
-
- Gets the underlying that is used for reading and writing SSH data.
-
-
- The underlying that is used for reading and writing SSH data.
-
-
-
-
- Gets a value indicating whether all data from the buffer has been read.
-
-
- true if this instance is end of data; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets data bytes array.
-
-
- A array representation of data structure.
-
-
-
-
- Writes the current message to the specified .
-
- The to write the message to.
-
-
-
- Loads data from specified bytes.
-
- Bytes array.
- is null .
-
-
-
- Loads data from the specified buffer.
-
- Bytes array.
- The zero-based offset in at which to begin reading SSH data.
- The number of bytes to load.
- is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Reads all data left in internal buffer at current position.
-
- An array of bytes containing the remaining data in the internal buffer.
-
-
-
- Reads next specified number of bytes data type from internal buffer.
-
- Number of bytes to read.
- An array of bytes that was read from the internal buffer.
- is greater than the internal buffer size.
-
-
-
- Reads next byte data type from internal buffer.
-
- Byte read.
-
-
-
- Reads next boolean data type from internal buffer.
-
- Boolean read.
-
-
-
- Reads next uint16 data type from internal buffer.
-
- uint16 read
-
-
-
- Reads next uint32 data type from internal buffer.
-
- uint32 read
-
-
-
- Reads next uint64 data type from internal buffer.
-
- uint64 read
-
-
-
- Reads next string data type from internal buffer using the specific encoding.
-
-
- The read.
-
-
-
-
- Reads next data type as byte array from internal buffer.
-
-
- The bytes read.
-
-
-
-
- Reads next name-list data type from internal buffer.
-
-
- String array or read data.
-
-
-
-
- Reads next extension-pair data type from internal buffer.
-
- Extensions pair dictionary.
-
-
-
- Writes bytes array data into internal buffer.
-
- Byte array data to write.
- is null .
-
-
-
- Writes a sequence of bytes to the current SSH data stream and advances the current position
- within this stream by the number of bytes written.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer.
-
- data to write.
-
-
-
- Writes data into internal buffer using default encoding.
-
- data to write.
- is null .
-
-
-
- Writes data into internal buffer using the specified encoding.
-
- data to write.
- The character encoding to use.
- is null .
- is null .
-
-
-
- Writes data into internal buffer.
-
- The data to write.
- is null .
-
-
-
- Writes data into internal buffer.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based byte offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes mpint data into internal buffer.
-
- mpint data to write.
-
-
-
- Writes name-list data into internal buffer.
-
- name-list data to write.
-
-
-
- Writes extension-pair data into internal buffer.
-
- extension-pair data to write.
-
-
-
- Specialized for reading and writing data SSH data.
-
-
-
-
- Initializes a new instance of the class with an expandable capacity initialized
- as specified.
-
- The initial size of the internal array in bytes.
-
-
-
- Initializes a new non-resizable instance of the class based on the specified byte array.
-
- The array of unsigned bytes from which to create the current stream.
- is null .
-
-
-
- Initializes a new non-resizable instance of the class based on the specified byte array.
-
- The array of unsigned bytes from which to create the current stream.
- The zero-based offset in at which to begin reading SSH data.
- The number of bytes to load.
- is null .
-
-
-
- Gets a value indicating whether all data from the SSH data stream has been read.
-
-
- true if this instance is end of data; otherwise, false .
-
-
-
-
- Writes an to the SSH data stream.
-
- data to write.
-
-
-
- Writes an to the SSH data stream.
-
- data to write.
-
-
-
- Writes a into the SSH data stream.
-
- The to write.
-
-
-
- Writes bytes array data into the SSH data stream.
-
- Byte array data to write.
- is null .
-
-
-
- Reads a byte array from the SSH data stream.
-
-
- The byte array read from the SSH data stream.
-
-
-
-
- Writes a buffer preceded by its length into the SSH data stream.
-
- The data to write.
- is null .
-
-
-
- Writes a buffer preceded by its length into the SSH data stream.
-
- An array of bytes. This method write bytes from buffer to the current SSH data stream.
- The zero-based byte offset in at which to begin writing bytes to the SSH data stream.
- The number of bytes to be written to the current SSH data stream.
- is null .
- The sum of and is greater than the buffer length.
- or is negative.
-
-
-
- Writes string data to the SSH data stream using the specified encoding.
-
- The string data to write.
- The character encoding to use.
- is null .
- is null .
-
-
-
- Reads a from the SSH datastream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads the next data type from the SSH data stream.
-
-
- The read from the SSH data stream.
-
-
-
-
- Reads next specified number of bytes data type from internal buffer.
-
- Number of bytes to read.
-
- An array of bytes that was read from the internal buffer.
-
- is greater than the internal buffer size.
-
-
-
- Writes the stream contents to a byte array, regardless of the .
-
-
- This method returns the contents of the as a byte array.
-
-
- If the current instance was constructed on a provided byte array, a copy of the section of the array
- to which this instance has access is returned.
-
-
-
-
- The exception that is thrown when SSH exception occurs.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when operation is timed out.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- The exception that is thrown when pass phrase for key file is empty or null
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
-
-
-
- Initializes a new instance of the class.
-
- The message.
- The inner exception.
-
-
-
- Initializes a new instance of the class.
-
- The that holds the serialized object data about the exception being thrown.
- The that contains contextual information about the source or destination.
- The parameter is null .
- The class name is null or is zero (0).
-
-
-
- Specifies the initial assignments of the opcode values that are used in the 'encoded terminal modes' valu
-
-
-
-
- Indicates end of options.
-
-
-
-
- Interrupt character; 255 if none. Similarly for the other characters. Not all of these characters are supported on all systems.
-
-
-
-
- The quit character (sends SIGQUIT signal on POSIX systems).
-
-
-
-
- Erase the character to left of the cursor.
-
-
-
-
- Kill the current input line.
-
-
-
-
- End-of-file character (sends EOF from the terminal).
-
-
-
-
- End-of-line character in addition to carriage return and/or linefeed.
-
-
-
-
- Additional end-of-line character.
-
-
-
-
- Continues paused output (normally control-Q).
-
-
-
-
- Pauses output (normally control-S).
-
-
-
-
- Suspends the current program.
-
-
-
-
- Another suspend character.
-
-
-
-
- Reprints the current input line.
-
-
-
-
- Erases a word left of cursor.
-
-
-
-
- Enter the next character typed literally, even if it is a special character
-
-
-
-
- Character to flush output.
-
-
-
-
- Switch to a different shell layer.
-
-
-
-
- Prints system status line (load, command, pid, etc).
-
-
-
-
- Toggles the flushing of terminal output.
-
-
-
-
- The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE, and 1 if it is TRUE.
-
-
-
-
- Mark parity and framing errors.
-
-
-
-
- Enable checking of parity errors.
-
-
-
-
- Strip 8th bit off characters.
-
-
-
-
- Map NL into CR on input.
-
-
-
-
- Ignore CR on input.
-
-
-
-
- Map CR to NL on input.
-
-
-
-
- Translate uppercase characters to lowercase.
-
-
-
-
- Enable output flow control.
-
-
-
-
- Any char will restart after stop.
-
-
-
-
- Enable input flow control.
-
-
-
-
- Ring bell on input queue full.
-
-
-
-
- Terminal input and output is assumed to be encoded in UTF-8.
-
-
-
-
- Enable signals INTR, QUIT, [D]SUSP.
-
-
-
-
- Canonicalize input lines.
-
-
-
-
- Enable input and output of uppercase characters by preceding their lowercase equivalents with "\".
-
-
-
-
- Enable echoing.
-
-
-
-
- Visually erase chars.
-
-
-
-
- Kill character discards current line.
-
-
-
-
- Echo NL even if ECHO is off.
-
-
-
-
- Don't flush after interrupt.
-
-
-
-
- Stop background jobs from output.
-
-
-
-
- Enable extensions.
-
-
-
-
- Echo control characters as ^(Char).
-
-
-
-
- Visual erase for line kill.
-
-
-
-
- Retype pending input.
-
-
-
-
- Enable output processing.
-
-
-
-
- Convert lowercase to uppercase.
-
-
-
-
- Map NL to CR-NL.
-
-
-
-
- Translate carriage return to newline (output).
-
-
-
-
- Translate newline to carriage return-newline (output).
-
-
-
-
- Newline performs a carriage return (output).
-
-
-
-
- 7 bit mode.
-
-
-
-
- 8 bit mode.
-
-
-
-
- Parity enable.
-
-
-
-
- Odd parity, else even.
-
-
-
-
- Specifies the input baud rate in bits per second.
-
-
-
-
- Specifies the output baud rate in bits per second.
-
-
-
-
- Specifies compression modes
-
-
-
-
- Specifies that content should be compressed.
-
-
-
-
- Specifies that content should be decompressed.
-
-
-
-
- Represents base class for compression algorithm implementation
-
-
-
-
- Gets or sets a value indicating whether compression is active.
-
-
- true if compression is active; otherwise, false .
-
-
-
-
- Gets the session.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Compresses the specified data.
-
- Data to compress.
- Compressed data
-
-
-
- Compresses the specified data.
-
- Data to compress.
- The zero-based byte offset in at which to begin reading the data to compress.
- The number of bytes to be compressed.
-
- The compressed data.
-
-
-
-
- Decompresses the specified data.
-
- Compressed data.
-
- The decompressed data.
-
-
-
-
- Decompresses the specified data.
-
- Compressed data.
- The zero-based byte offset in at which to begin reading the data to decompress.
- The number of bytes to be read from the compressed data.
-
- The decompressed data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the is reclaimed
- by garbage collection.
-
-
-
-
- Represents "zlib" compression implementation
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Represents "zlib@openssh.org" compression implementation
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Initializes the algorithm
-
- The session.
-
-
-
- Implements Zlib compression algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The stream.
- The mode.
-
-
-
- Writes the specified buffer.
-
- The buffer.
- The offset.
- The count.
-
-
-
- Represents remote connection information class.
-
-
- This class is NOT thread-safe. Do not use the same with multiple
- client instances.
-
-
-
-
- The default connection timeout.
-
-
- 30 seconds.
-
-
-
-
- The default channel close timeout.
-
-
- 1 second.
-
-
-
-
- Gets supported key exchange algorithms for this connection.
-
-
-
-
- Gets supported encryptions for this connection.
-
-
-
-
- Gets supported hash algorithms for this connection.
-
-
-
-
- Gets supported host key algorithms for this connection.
-
-
-
-
- Gets supported authentication methods for this connection.
-
-
-
-
- Gets supported compression algorithms for this connection.
-
-
-
-
- Gets the supported channel requests for this connection.
-
-
- The supported channel requests for this connection.
-
-
-
-
- Gets a value indicating whether connection is authenticated.
-
-
- true if connection is authenticated; otherwise, false .
-
-
-
-
- Gets connection host.
-
-
-
-
- Gets connection port.
-
-
- The connection port. The default value is 22.
-
-
-
-
- Gets connection username.
-
-
-
-
- Gets proxy type.
-
-
- The type of the proxy.
-
-
-
-
- Gets proxy connection host.
-
-
-
-
- Gets proxy connection port.
-
-
-
-
- Gets proxy connection username.
-
-
-
-
- Gets proxy connection password.
-
-
-
-
- Gets or sets connection timeout.
-
-
- The connection timeout. The default value is 30 seconds.
-
-
-
-
-
-
-
- Gets or sets the timeout to use when waiting for a server to acknowledge closing a channel.
-
-
- The channel close timeout. The default value is 1 second.
-
-
- If a server does not send a SSH_MSG_CHANNEL_CLOSE message before the specified timeout
- elapses, the channel will be closed immediately.
-
-
-
-
- Gets or sets the character encoding.
-
-
- The character encoding. The default is .
-
-
-
-
- Gets or sets number of retry attempts when session channel creation failed.
-
-
- The number of retry attempts when session channel creation failed. The default
- value is 10.
-
-
-
-
- Gets or sets maximum number of session channels to be open simultaneously.
-
-
- The maximum number of session channels to be open simultaneously. The default
- value is 10.
-
-
-
-
- Occurs when authentication banner is sent by the server.
-
-
-
-
-
-
-
- Gets the current key exchange algorithm.
-
-
-
-
- Gets the current server encryption.
-
-
-
-
- Gets the current client encryption.
-
-
-
-
- Gets the current server hash algorithm.
-
-
-
-
- Gets the current client hash algorithm.
-
-
-
-
- Gets the current host key algorithm.
-
-
-
-
- Gets the current server compression algorithm.
-
-
-
-
- Gets the server version.
-
-
-
-
- Get the client version.
-
-
-
-
- Gets the current client compression algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The username.
- The authentication methods.
- is null .
- is a zero-length string.
- is null , a zero-length string or contains only whitespace characters.
- is null .
- No specified.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- The username.
- The authentication methods.
- is null .
- is null , a zero-length string or contains only whitespace characters.
- is not within and .
- is null .
- No specified.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The authentication methods.
- is null .
- is null , a zero-length string or contains only whitespace characters.
- is not within and .
- is not and is null .
- is not and is not within and .
- is null .
- No specified.
-
-
-
- Authenticates the specified session.
-
- The session to be authenticated.
- The factory to use for creating new services.
- is null .
- is null .
- No suitable authentication method found to complete authentication, or permission denied.
-
-
-
- Signals that an authentication banner message was received from the server.
-
- The session in which the banner message was received.
- The banner message.{
-
-
-
- Specifies behavior for expected expression
-
-
-
-
- Gets the expected regular expression.
-
-
-
-
- Gets the action to perform when expected expression is found.
-
-
-
-
- Initializes a new instance of the class.
-
- The expect regular expression.
- The action to perform.
- or is null .
-
-
-
- Initializes a new instance of the class.
-
- The expect expression.
- The action to perform.
- or is null .
-
-
-
- Provides additional information for asynchronous command execution
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Base class for port forwarding functionality.
-
-
-
-
- Gets or sets the session.
-
-
- The session.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Occurs when an exception is thrown.
-
-
-
-
- Occurs when a port forwarding request is received.
-
-
-
-
- Starts port forwarding.
-
-
-
-
- Stops port forwarding.
-
-
-
-
- Starts port forwarding.
-
-
-
-
- Stops port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Raises event.
-
- The exception.
-
-
-
- Raises event.
-
- Request originator host.
- Request originator port.
-
-
-
- Raises the event.
-
-
-
-
- Handles session ErrorOccured event.
-
- The source of the event.
- The instance containing the event data.
-
-
-
- Provides functionality for forwarding connections from the client to destination servers via the SSH server,
- also known as dynamic port forwarding.
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The port.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
-
-
-
- Starts local port forwarding.
-
-
-
-
- Stops local port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Interrupts the listener, and unsubscribes from events.
-
-
-
-
- Waits for pending channels to close.
-
- The maximum time to wait for the pending channels to close.
-
-
-
- Holds a value indicating whether the current instance is disposed.
-
-
- true if the current instance is disposed; otherwise, false .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Reads a null terminated string from a socket.
-
- The to read from.
- The timeout to apply to individual reads.
-
- The read, or null when the socket was closed.
-
-
-
-
- Provides functionality for local port forwarding
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded port.
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
- The host.
- The port.
- is greater than .
- is null .
- is greater than .
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The host.
- The port.
- is null .
- is null .
- is greater than .
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The bound port.
- The host.
- The port.
- is null .
- is null .
- is greater than .
- is greater than .
-
-
-
- Starts local port forwarding.
-
-
-
-
- Stops local port forwarding, and waits for the specified timeout until all pending
- requests are processed.
-
- The maximum amount of time to wait for pending requests to finish processing.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Interrupts the listener, and unsubscribes from events.
-
-
-
-
- Waits for pending channels to close.
-
- The maximum time to wait for the pending channels to close.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Provides functionality for remote port forwarding
-
-
-
-
- Gets a value indicating whether port forwarding is started.
-
-
- true if port forwarding is started; otherwise, false .
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound host.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded host.
-
-
-
-
- Gets the forwarded port.
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host address.
- The bound port.
- The host address.
- The port.
- is null .
- is null .
- is greater than .
- is greater than .
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
- The host.
- The port.
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The bound host.
- The bound port.
- The host.
- The port.
-
-
-
- Starts remote port forwarding.
-
-
-
-
- Stops remote port forwarding.
-
- The maximum amount of time to wait for the port to stop.
-
-
-
- Ensures the current instance is not disposed.
-
- The current instance is disposed.
-
-
-
- Initializes the .
-
-
-
- When the port is started for the first time, a is created with an initial count
- of 1 .
-
-
- On subsequent (re)starts, we'll dispose the current and create a new one with
- initial count of 1 .
-
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Returns a value indicating whether has been changed to .
-
- The status to transition from.
-
- true if has been changed to ; otherwise, false .
-
- Cannot transition to .
-
- While a transition from to is not possible, this method will
- return false for any such attempts. This is related to concurrency.
-
-
-
-
- Returns a value indicating whether has been changed to .
-
- The status to transition from.
-
- true if has been changed to ; otherwise, false .
-
- Cannot transition to .
-
- While a transition from to is not possible, this method will
- return false for any such attempts. This is related to concurrency.
-
-
-
-
- Holds information about key size and cipher to use
-
-
-
-
- Gets the size of the key.
-
-
- The size of the key.
-
-
-
-
- Gets the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- Size of the key.
- The hash algorithm to use for a given key.
-
-
-
- Base interface for authentication of a session using a given method.
-
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- The result of the authentication process.
-
-
-
-
- Gets the list of allowed authentications.
-
-
- The list of allowed authentications.
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the authentication method.
-
-
-
-
- Signals that an authentication banner message was received from the server.
-
- The session in which the banner message was received.
- The banner message.{
-
-
-
- Gets the supported authentication methods for this connection.
-
-
- The supported authentication methods for this connection.
-
-
-
-
- Creates a for the credentials represented
- by the current .
-
-
- A for the credentials represented by the
- current .
-
-
-
-
- Represents remote connection information.
-
-
-
-
- Gets or sets the timeout to used when waiting for a server to acknowledge closing a channel.
-
-
- The channel close timeout. The default value is 1 second.
-
-
- If a server does not send a SSH2_MSG_CHANNEL_CLOSE message before the specified timeout
- elapses, the channel will be closed immediately.
-
-
-
-
- Gets the supported channel requests for this connection.
-
-
- The supported channel requests for this connection.
-
-
-
-
- Gets the character encoding.
-
-
- The character encoding.
-
-
-
-
- Gets the number of retry attempts when session channel creation failed.
-
-
- The number of retry attempts when session channel creation failed.
-
-
-
-
- Gets or sets connection timeout.
-
-
- The connection timeout. The default value is 30 seconds.
-
-
-
-
-
-
-
- Occurs when authentication banner is sent by the server.
-
-
-
-
- Supports port forwarding functionality.
-
-
-
-
- The event occurs as the forwarded port is being stopped.
-
-
-
-
- Represents a transformation that can be applied to a remote path.
-
-
-
-
- Transforms the specified remote path.
-
- The path to transform.
-
- The transformed path.
-
-
-
-
- Factory for creating new services.
-
-
-
-
- Creates a new with the specified .
-
- The to use for creating a new session.
-
- An for the specified .
-
- is null .
-
-
-
- Creates a new in a given and with
- the specified operation timeout and encoding.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
- The encoding.
- The factory to use for creating SFTP messages.
-
- An .
-
-
-
-
- Create a new .
-
-
- A .
-
-
-
-
- Negotiates a key exchange algorithm, and creates a for the negotiated
- algorithm.
-
- A of the key exchange algorithms supported by the client where the key is the name of the algorithm, and the value is the type implementing this algorithm.
- The names of the key exchange algorithms supported by the SSH server.
-
- A that was negotiated between client and server.
-
- is null .
- is null .
- No key exchange algorithm is supported by both client and server.
-
-
-
- Creates a shell stream.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- Size of the buffer.
- The terminal mode values.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates an that encloses a path in double quotes, and escapes
- any embedded double quote with a backslash.
-
-
- An that encloses a path in double quotes, and escapes any
- embedded double quote with a backslash.
- with a shell.
-
-
-
-
- Creates a new in a given
- and with the specified operation timeout.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
- An .
-
-
-
-
- Provides functionality to connect and interact with SSH server.
-
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
-
-
- Gets the session semaphore that controls session channels.
-
-
- The session semaphore.
-
-
-
-
- Gets a that can be used to wait for the message listener loop to complete.
-
-
- A that can be used to wait for the message listener loop to complete, or
- null when the session has not been connected.
-
-
-
-
- Connects to the server.
-
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Create a new SSH session channel.
-
-
- A new SSH session channel.
-
-
-
-
- Create a new channel for a locally forwarded TCP/IP port.
-
-
- A new channel for a locally forwarded TCP/IP port.
-
-
-
-
- Creates a "forwarded-tcpip" SSH channel.
-
-
- A new "forwarded-tcpip" SSH channel.
-
-
-
-
- Disconnects from the server.
-
-
- This sends a SSH_MSG_DISCONNECT message to the server, waits for the
- server to close the socket on its end and subsequently closes the client socket.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Registers SSH message with the session.
-
- The name of the message to register with the session.
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Unregister SSH message from the session.
-
- The name of the message to unregister with the session.
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- A .
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when session has been disconnected from the server.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when host key received.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Base interface for SSH subsystem implementations.
-
-
-
-
- Gets or set the number of seconds to wait for an operation to complete.
-
-
- The number of seconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
-
- Gets a value indicating whether this session is open.
-
-
- true if this session is open; otherwise, false .
-
-
-
-
- Connects the subsystem using a new SSH channel session.
-
- The session is already connected.
- The method was called after the session was disposed.
-
-
-
- Disconnects the subsystem channel.
-
-
-
-
- Waits a specified time for a given to get signaled.
-
- The handle to wait for.
- The number of millieseconds wait for to get signaled, or -1 to wait indefinitely.
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
-
- true if received a signal within the specified timeout;
- otherwise, false .
-
- The connection was closed by the server.
- The channel was closed.
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The first handle to wait for.
- The second handle to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- 0 if received a signal within the specified timeout and 1
- if received a signal within the specified timeout, or
- if no object satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
-
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
- When both and are signaled during the call,
- then 0 is returned.
-
-
-
-
-
- Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
- integer to specify the time interval.
-
- A array - constructed using - containing the objects to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- The array index of the first non-system object that satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
- No object satified the wait and a time interval equivalent to has passed.
-
- For the return value, the index of the first non-system object is considered to be zero.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- A array containing the objects to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- The first to wait for.
- The second to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Provides functionality to perform keyboard interactive authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Occurs when server prompts for more authentication information.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
- Result of authentication process.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when keyboard interactive authentication method is used
-
-
-
-
-
-
-
- Occurs when server prompts for more authentication information.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The username.
-
-
-
- Initializes a new instance of the class.
-
- The host.
- The port.
- The username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides data for message events.
-
- Message type
-
-
-
- Gets the message.
-
-
-
-
- Initializes a new instance of the class.
-
- The message.
- is null .
-
-
-
- Represents SSH_MSG_USERAUTH_BANNER message.
-
-
-
-
- Gets banner message.
-
-
-
-
- Gets banner language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_FAILURE message.
-
-
-
-
- Gets or sets the allowed authentications if available.
-
-
- The allowed authentications.
-
-
-
-
- Gets failure message.
-
-
-
-
- Gets a value indicating whether authentication is partially successful.
-
-
- true if partially successful; otherwise, false .
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_INFO_REQUEST message.
-
-
-
-
- Gets information request name.
-
-
-
-
- Gets information request instruction.
-
-
-
-
- Gets information request language.
-
-
-
-
- Gets information request prompts.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_INFO_RESPONSE message.
-
-
-
-
- Gets authentication responses.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_PASSWD_CHANGEREQ message.
-
-
-
-
- Gets password change request message as UTF-8 encoded byte array.
-
-
-
-
- Gets message language as UTF-8 encoded byte array.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_PK_OK message.
-
-
-
-
- Gets the name of the public key algorithm as ASCII encoded byte array.
-
-
- The name of the public key algorithm.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_REQUEST message. Server as a base message for other user authentication requests.
-
-
-
-
- Returns the authentication message code for SSH_MSG_USERAUTH_REQUEST .
-
-
-
-
- Gets authentication username as UTF-8 encoded byte array.
-
-
-
-
- Gets the name of the service as ASCII encoded byte array.
-
-
- The name of the service.
-
-
-
-
- Gets the name of the authentication method.
-
-
- The name of the method.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- The name of the authentication method.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets the public key algorithm for host key as ASCII encoded byte array.
-
-
-
-
- Gets or sets the public host key and certificates for client host.
-
-
- The public host key.
-
-
-
-
- Gets or sets the name of the client host as ASCII encoded byte array.
-
-
- The name of the client host.
-
-
-
-
- Gets or sets the client username on the client host as UTF-8 encoded byte array.
-
-
- The client username.
-
-
-
-
- Gets or sets the signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- The public key algorithm.
- The public host key.
- Name of the client host.
- The client username.
- The signature.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets authentication sub methods.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "none" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
-
-
-
- Represents "password" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets authentication password.
-
-
-
-
- Gets new authentication password.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Authentication password.
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Authentication password.
- New authentication password.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "publickey" SSH_MSG_USERAUTH_REQUEST message.
-
-
-
-
- Gets the name of the public key algorithm as ASCII encoded byte array.
-
-
- The name of the public key algorithm.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Gets or sets public key signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Name of private key algorithm.
- Private key data.
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
- Authentication username.
- Name of private key algorithm.
- Private key data.
- Private key signature.
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_USERAUTH_SUCCESS message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Gets the address to bind to.
-
-
-
-
- Gets port number to bind to.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_CLOSE message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_DATA message.
-
-
-
-
- Gets or sets message data.
-
-
- The data.
-
-
- The actual data to read or write depends on the and .
-
-
-
-
- Gets the zero-based offset in at which the data begins.
-
-
- The zero-based offset in at which the data begins.
-
-
-
-
- Gets the number of bytes of to read or write.
-
-
- The number of bytes of to read or write.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- Message data.
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The message data.
- The zero-based byte offset in at which to begin reading or writing data from.
- The number of bytes of to read or write.
-
-
-
- Loads the data.
-
-
-
-
- Saves the data.
-
-
-
-
- Represents SSH_MSG_CHANNEL_EOF message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_EXTENDED_DATA message.
-
-
-
-
- Gets message data type code.
-
-
-
-
- Gets message data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The message data type code.
- The message data.
-
-
-
- Loads the data.
-
-
-
-
- Saves the data.
-
-
-
-
- Represents SSH_MSG_CHANNEL_FAILURE message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Base class for all channel specific SSH messages.
-
-
-
-
- Gets or sets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new .
-
-
-
-
- Initializes a new with the specified local channel number.
-
- The local channel number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN_CONFIRMATION message.
-
-
-
-
- Gets the remote channel number.
-
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- Initial size of the window.
- Maximum size of the packet.
- The remote channel number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN_FAILURE message.
-
-
-
-
- Gets failure reason code.
-
-
-
-
- Gets description for failure.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The description.
- The reason code.
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The description.
- The reason code.
- The language (RFC3066).
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- List channel open failure reasons defined by the protocol.
-
-
-
-
- SSH_OPEN_ADMINISTRATIVELY_PROHIBITED
-
-
-
-
- SSH_OPEN_CONNECT_FAILED
-
-
-
-
- SSH_OPEN_UNKNOWN_CHANNEL_TYPE
-
-
-
-
- SSH_OPEN_RESOURCE_SHORTAGE
-
-
-
-
- Base class for open channel messages
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_OPEN message.
-
-
-
-
- Gets the type of the channel as ASCII encoded byte array.
-
-
- The type of the channel.
-
-
-
-
- Gets or sets the local channel number.
-
-
- The local channel number.
-
-
-
-
- Gets the initial size of the window.
-
-
- The initial size of the window.
-
-
-
-
- Gets the maximum size of the packet.
-
-
- The maximum size of the packet.
-
-
-
-
- Gets channel specific open information.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The channel number.
- Initial size of the window.
- Maximum size of the packet.
- Information specific to the type of the channel to open.
- is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "direct-tcpip" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the host to connect.
-
-
-
-
- Gets the port to connect.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance of the class.
-
- The host to connect.
- The port to connect.
- The originator address.
- The originator port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "forwarded-tcpip" channel type
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance with the specified connector
- address and port, and originator address and port.
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the connected address.
-
-
-
-
- Gets the connected port.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Used to open "session" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Used to open "x11" channel type
-
-
-
-
- Specifies channel open type
-
-
-
-
- Gets the type of the channel to open.
-
-
- The type of the channel to open.
-
-
-
-
- Gets the originator address.
-
-
-
-
- Gets the originator port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class from the
- specified data.
-
- is null .
-
-
-
- Initializes a new instance of the class with the
- specified originator address and port.
-
- The originator address.
- The originator port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "break" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets break length in milliseconds.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Length of the break.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_REQUEST message.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets channel request data.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The info.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "eow@openssh.com" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "env" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets the name of the variable.
-
-
- The name of the variable.
-
-
-
-
- Gets or sets the variable value.
-
-
- The variable value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the variable.
- The variable value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exec" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets command to execute.
-
-
- The command.
-
-
-
-
- Gets the encoding.
-
-
- The encoding.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The command.
- The character encoding to use.
- or is null .
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exit-signal" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the signal.
-
-
- The name of the signal.
-
-
-
-
- Gets a value indicating whether core is dumped.
-
-
- true if core is dumped; otherwise, false .
-
-
-
-
- Gets the error message.
-
-
-
-
- Gets message language.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the signal.
- if set to true then core is dumped.
- The error message.
- The language.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "exit-status" type channel request information
-
-
-
-
- Channel request name.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the exit status number.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The exit status number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "keepalive@openssh.com" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "pty-req" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets the value of the TERM environment variable (e.g., vt100).
-
-
- The value of the TERM environment variable.
-
-
-
-
- Gets or sets the terminal width in columns (e.g., 80).
-
-
- The terminal width in columns.
-
-
-
-
- Gets or sets the terminal width in rows (e.g., 24).
-
-
- The terminal width in rows.
-
-
-
-
- Gets or sets the terminal width in pixels (e.g., 640).
-
-
- The terminal width in pixels.
-
-
-
-
- Gets or sets the terminal height in pixels (e.g., 480).
-
-
- The terminal height in pixels.
-
-
-
-
- Gets or sets the terminal mode.
-
-
- The terminal mode.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The TERM environment variable which a identifier for the text window’s capabilities.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents type specific information for channel request.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether reply message is needed.
-
-
- true if reply message is needed; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "shell" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Represents "signal" type channel request information
-
-
-
-
- Channel request name.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the signal.
-
-
- The name of the signal.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the signal.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "subsystem" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the name of the subsystem.
-
-
- The name of the subsystem.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The subsystem.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "window-change" type channel request information
-
-
-
-
- Channe request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets the columns.
-
-
-
-
- Gets the rows.
-
-
-
-
- Gets the width.
-
-
-
-
- Gets the height.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The columns.
- The rows.
- The width.
- The height.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "x11-req" type channel request information
-
-
-
-
- Channel request name
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether it is a single connection.
-
-
- true if it is a single connection; otherwise, false .
-
-
-
-
- Gets or sets the authentication protocol.
-
-
- The authentication protocol.
-
-
-
-
- Gets or sets the authentication cookie.
-
-
- The authentication cookie.
-
-
-
-
- Gets or sets the screen number.
-
-
- The screen number.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- if set to true it is a single connection.
- The protocol.
- The cookie.
- The screen number.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents "xon-xoff" type channel request information
-
-
-
-
- Channel request type
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets or sets a value indicating whether client can do.
-
-
- true if client can do; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- if set to true [client can do].
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_CHANNEL_SUCCESS message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
-
-
-
- Represents SSH_MSG_CHANNEL_SUCCESS message.
-
-
-
-
- Gets number of bytes to add to the window.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The local channel number.
- The bytes to add.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_GLOBAL_REQUEST message.
-
-
-
-
- Gets the name of the request.
-
-
- The name of the request.
-
-
-
-
- Gets a value indicating whether message reply should be sent..
-
-
- true if message reply should be sent; otherwise, false .
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the request.
- if set to true [want reply].
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Specifies supported request names.
-
-
-
-
- tcpip-forward
-
-
-
-
- cancel-tcpip-forward
-
-
-
-
- Represents SSH_MSG_REQUEST_FAILURE message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_REQUEST_SUCCESS message.
-
-
-
-
- Gets the bound port.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The bound port.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Gets the address to bind to.
-
-
-
-
- Gets port number to bind to.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Base class for all SSH protocol messages
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Writes the message to the specified .
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Process the current message for the specified .
-
- The for which to process the current message.
-
-
-
- Indicates that a class represents SSH message. This class cannot be inherited.
-
-
-
-
- Gets or sets message name as defined in RFC 4250.
-
-
- The name.
-
-
-
-
- Gets or sets message number as defined in RFC 4250.
-
-
- The number.
-
-
-
-
- Initializes a new instance of the class.
-
- The name.
- The number.
-
-
-
- Specifies list of supported services
-
-
-
-
- ssh-userauth
-
-
-
-
- ssh-connection
-
-
-
-
- Represents SSH_MSG_DEBUG message.
-
-
-
-
- Gets a value indicating whether the message to be always displayed.
-
-
- true if the message always to be displayed; otherwise, false .
-
-
-
-
- Gets debug message.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_DISCONNECT message.
-
-
-
-
- Gets disconnect reason code.
-
-
-
-
- Gets disconnect description.
-
-
-
-
- Gets message language.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The reason code.
- The message.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Provides list of disconnect reason as specified by the protocol.
-
-
-
-
- Disconnect reason is not provided.
-
-
-
-
- SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT
-
-
-
-
- SSH_DISCONNECT_PROTOCOL_ERROR
-
-
-
-
- SSH_DISCONNECT_KEY_EXCHANGE_FAILED
-
-
-
-
- SSH_DISCONNECT_RESERVED
-
-
-
-
- SSH_DISCONNECT_MAC_ERROR
-
-
-
-
- SSH_DISCONNECT_COMPRESSION_ERROR
-
-
-
-
- SSH_DISCONNECT_SERVICE_NOT_AVAILABLE
-
-
-
-
- SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED
-
-
-
-
- SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE
-
-
-
-
- SSH_DISCONNECT_CONNECTION_LOST
-
-
-
-
- SSH_DISCONNECT_BY_APPLICATION
-
-
-
-
- SSH_DISCONNECT_TOO_MANY_CONNECTIONS
-
-
-
-
- SSH_DISCONNECT_AUTH_CANCELLED_BY_USER
-
-
-
-
- SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE
-
-
-
-
- SSH_DISCONNECT_ILLEGAL_USER_NAME
-
-
-
-
- Represents SSH_MSG_IGNORE message.
-
-
-
-
- Gets ignore message data if any.
-
-
-
-
- Initializes a new instance of the class
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The data.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Indicates that message that implement this interface is allowed during key exchange phase
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_GROUP message.
-
-
-
-
- Gets or sets the safe prime.
-
-
- The safe prime.
-
-
-
-
- Gets or sets the generator for subgroup in GF(p).
-
-
- The sub group.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_INIT message.
-
-
-
-
- Gets the E value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The client exchange value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_REPLY message.
-
-
-
-
- Gets server public host key and certificates
-
- The host key.
-
-
-
- Gets the F value.
-
-
-
-
- Gets the signature of H.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEX_DH_GEX_REQUEST message.
-
-
-
-
- Gets or sets the minimal size in bits of an acceptable group.
-
-
- The minimum.
-
-
-
-
- Gets or sets the preferred size in bits of the group the server will send.
-
-
- The preferred.
-
-
-
-
- Gets or sets the maximal size in bits of an acceptable group.
-
-
- The maximum.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The minimum.
- The preferred.
- The maximum.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXDH_INIT message.
-
-
-
-
- Gets the E value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The client exchange value.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXDH_REPLY message.
-
-
-
-
- Gets server public host key and certificates
-
- The host key.
-
-
-
- Gets the F value.
-
-
-
-
- Gets the signature of H.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXECDH_INIT message.
-
-
-
-
- Gets the client's ephemeral contribution to the ECDH exchange, encoded as an octet string
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXECDH_REPLY message.
-
-
-
-
- Gets a string encoding an X.509v3 certificate containing the server's ECDSA public host key
-
- The host key.
-
-
-
- Gets the server's ephemeral contribution to the ECDH exchange, encoded as an octet string.
-
-
-
-
- Gets an octet string containing the server's signature of the newly established exchange hash value.
-
- The signature.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_KEXINIT message.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Gets session cookie.
-
-
-
-
- Gets or sets supported key exchange algorithms.
-
-
- Supported key exchange algorithms.
-
-
-
-
- Gets or sets supported server host key algorithms.
-
-
- Supported server host key algorithms.
-
-
-
-
- Gets or sets supported encryption algorithms client to server.
-
-
- Supported encryption algorithms client to server.
-
-
-
-
- Gets or sets supported encryption algorithms server to client.
-
-
- Supported encryption algorithms server to client.
-
-
-
-
- Gets or sets supported hash algorithms client to server.
-
-
- Supported hash algorithms client to server.
-
-
-
-
- Gets or sets supported hash algorithms server to client.
-
-
- Supported hash algorithms server to client.
-
-
-
-
- Gets or sets supported compression algorithms client to server.
-
-
- Supported compression algorithms client to server.
-
-
-
-
- Gets or sets supported compression algorithms server to client.
-
-
- Supported compression algorithms server to client.
-
-
-
-
- Gets or sets supported languages client to server.
-
-
- Supported languages client to server.
-
-
-
-
- Gets or sets supported languages server to client.
-
-
- The languages server to client.
-
-
-
-
- Gets or sets a value indicating whether first key exchange packet follows.
-
-
- true if first key exchange packet follows; otherwise, false .
-
-
-
-
- Gets or sets the reserved value.
-
-
- The reserved value.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- -1 to indicate that the size of the message cannot be determined,
- or is too costly to calculate.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_NEWKEYS message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_SERVICE_ACCEPT message.
-
-
-
-
- Gets the name of the service.
-
-
- The name of the service.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_SERVICE_REQUEST message.
-
-
-
-
- Gets the name of the service.
-
-
- The name of the service.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- Name of the service.
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Represents SSH_MSG_UNIMPLEMENTED message.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Contains operation for working with NetConf server.
-
-
-
-
- Holds instance that used to communicate to the server
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite time-out period.
-
- represents a value that is less than -1 or greater than milliseconds.
-
-
-
- Gets the current NetConf session.
-
-
- The current NetConf session.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Gets the NetConf server capabilities.
-
-
- The NetConf server capabilities.
-
-
-
-
- Gets the NetConf client capabilities.
-
-
- The NetConf client capabilities.
-
-
-
-
- Gets or sets a value indicating whether automatic message id handling is
- enabled.
-
-
- true if automatic message id handling is enabled; otherwise, false .
- The default value is true .
-
-
-
-
- Sends the receive RPC.
-
- The RPC.
- Reply message to RPC request
- Client is not connected.
-
-
-
- Sends the receive RPC.
-
- The XML.
- Reply message to RPC request
-
-
-
- Sends the close RPC.
-
- Reply message to closing RPC request
- Client is not connected.
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Gets the NetConf server capabilities.
-
-
- The NetConf server capabilities.
-
-
-
-
- Gets the NetConf client capabilities.
-
-
- The NetConf client capabilities.
-
-
-
-
- Gets NetConf server capabilities.
-
-
-
-
- Gets NetConf client capabilities.
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
- Provides functionality for "none" authentication method
-
-
-
-
- Gets connection name
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session.
-
- Result of authentication process.
-
- is null .
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides functionality to perform password authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Gets the password as a sequence of bytes.
-
-
- The password as a sequence of bytes.
-
-
-
-
- Occurs when user's password has expired and needs to be changed.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The password.
- is whitespace or null .
- is null .
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The password.
- is whitespace or null .
- is null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- Result of authentication process.
-
- is null .
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when password authentication method is used
-
-
-
-
-
-
-
-
-
- Occurs when user's password has expired and needs to be changed.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
-
-
-
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Connection password.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides functionality to perform private key authentication.
-
-
-
-
- Gets authentication method name
-
-
-
-
- Gets the key files used for authentication.
-
-
-
-
- Initializes a new instance of the class.
-
- The username.
- The key files.
- is whitespace or null .
-
-
-
- Authenticates the specified session.
-
- The session to authenticate.
-
- Result of authentication process.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Provides connection information when private key authentication method is used
-
-
-
-
-
-
-
- Gets the key files used for authentication.
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Connection key files.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Connection username.
- Connection key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The key files.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- The port.
- Connection username.
- Type of the proxy.
- The proxy host.
- The proxy port.
- The proxy username.
- The proxy password.
- The key files.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Represents private key information.
-
-
-
-
-
-
- The following private keys are supported:
-
- -
-
RSA in OpenSSL PEM and ssh.com format
-
- -
-
DSA in OpenSSL PEM and ssh.com format
-
- -
-
ECDSA 256/384/521 in OpenSSL PEM format
-
- -
-
ED25519 in OpenSSH key format
-
-
-
-
- The following encryption algorithms are supported:
-
- -
-
DES-EDE3-CBC
-
- -
-
DES-EDE3-CFB
-
- -
-
DES-CBC
-
- -
-
AES-128-CBC
-
- -
-
AES-192-CBC
-
- -
-
AES-256-CBC
-
-
-
-
-
-
-
- Gets the host key.
-
-
-
-
- Initializes a new instance of the class.
-
- The private key.
-
-
-
- Initializes a new instance of the class.
-
- Name of the file.
- is null or empty.
- This method calls internally, this method does not catch exceptions from .
-
-
-
- Initializes a new instance of the class.
-
- Name of the file.
- The pass phrase.
- is null or empty, or is null .
- This method calls internally, this method does not catch exceptions from .
-
-
-
- Initializes a new instance of the class.
-
- The private key.
- The pass phrase.
- or is null .
-
-
-
- Opens the specified private key.
-
- The private key.
- The pass phrase.
-
-
-
- Decrypts encrypted private key file data.
-
- The cipher info.
- Encrypted data.
- Decryption pass phrase.
- Decryption binary salt.
- Decrypted byte array.
- , , or is null .
-
-
-
- Parses an OpenSSH V1 key file (i.e. ED25519 key) according to the the key spec:
- https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key.
-
- the key file data (i.e. base64 encoded data between the header/footer)
- passphrase or null if there isn't one
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Reads next mpint data type from internal buffer where length specified in bits.
-
- mpint read.
-
-
-
- Specifies the type of proxy client will use to connect to server.
-
-
-
- No proxy server.
-
-
- A SOCKS4 proxy server.
-
-
- A SOCKS5 proxy server.
-
-
- A HTTP proxy server.
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
- The path to transform.
-
- The transformed path.
-
- is null .
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- "/var/log/auth.log"
-
- -
-
/var/mp3/Guns N' Roses
- "/var/mp3/Guns N' Roses"
-
- -
-
/var/garbage!/temp
- "/var/garbage!/temp"
-
- -
-
/var/would be 'kewl'!/not?
- "/var/would be 'kewl'!, not?"
-
- -
-
- ""
-
- -
-
Hello "World"
- "Hello \"World"
-
-
-
-
-
-
- Performs no transformation.
-
-
-
-
- Returns the specified path without applying a transformation.
-
- The path to transform.
-
- The specified path as is.
-
- is null .
-
- This transformation is recommended for servers that do not require any quoting to preserve the
- literal value of metacharacters, or when paths are guaranteed to never contain any such characters.
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
- The path to transform.
-
- A quoted path.
-
- is null .
-
-
- If contains a single-quote, that character is embedded
- in quotation marks (eg. "'"). Sequences of single-quotes are grouped in a single
- pair of quotation marks.
-
-
- An exclamation mark in is escaped with a backslash. This is
- necessary because C Shell interprets it as a meta-character for history substitution
- even when enclosed in single quotes or quotation marks.
-
-
- All other characters are enclosed in single quotes. Sequences of such characters are grouped
- in a single pair of single quotes.
-
-
- References:
-
- -
-
Shell Command Language
-
- -
-
Unix C-Shell special characters and their uses
-
- -
-
Differences Between Bourne and C Shell Quoting
-
-
-
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- '/var/log/auth.log'
-
- -
-
/var/mp3/Guns N' Roses
- '/var/mp3/Guns N'"'"' Roses'
-
- -
-
/var/garbage!/temp
- '/var/garbage'\!'/temp'
-
- -
-
/var/would be 'kewl'!, not?
- '/var/would be '"'"'kewl'"'"\!', not?'
-
- -
-
- ''
-
- -
-
Hello "World"
- 'Hello "World"'
-
-
-
-
-
-
- Provides access to built-in remote path transformations.
-
-
- References:
-
- -
-
Shell Command Language
-
- -
-
Unix C-Shell special characters and their uses
-
- -
-
Differences Between Bourne and C Shell Quoting
-
- -
-
Everyone quotes command line arguments the wrong way
-
-
-
-
-
-
- Quotes a path in a way to be suitable to be used with a shell-based server.
-
-
- A quoted path.
-
-
-
- If a path contains a single-quote, that character is embedded in quotation marks (eg. "'").
- Sequences of single-quotes are grouped in a single pair of quotation marks.
-
-
- An exclamation mark in a path is escaped with a backslash. This is necessary because C Shell
- interprets it as a meta-character for history substitution even when enclosed in single quotes
- or quotation marks.
-
-
- All other characters are enclosed in single quotes. Sequences of such characters are grouped
- in a single pair of single quotes.
-
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- '/var/log/auth.log'
-
- -
-
/var/mp3/Guns N' Roses
- '/var/mp3/Guns N'"'"' Roses'
-
- -
-
/var/garbage!/temp
- '/var/garbage'\!'/temp'
-
- -
-
/var/would be 'kewl'!, not?
- '/var/would be '"'"'kewl'"'"\!', not?'
-
- -
-
- ''
-
- -
-
Hello "World"
- 'Hello "World"'
-
-
-
-
-
-
- Performs no transformation.
-
-
- Recommended for servers that do not require any character to be escaped or enclosed in quotes,
- or when paths are guaranteed to never contain any special characters (such as #, ", ', $, ...).
-
-
-
-
- Encloses a path in double quotes, and escapes any embedded double quote with a backslash.
-
-
- A transformation that encloses a path in double quotes, and escapes any embedded double quote with
- a backslash.
-
-
-
-
- Original
- Transformed
-
- -
-
/var/log/auth.log
- "/var/log/auth.log"
-
- -
-
/var/mp3/Guns N' Roses
- "/var/mp3/Guns N' Roses"
-
- -
-
/var/garbage!/temp
- "/var/garbage!/temp"
-
- -
-
/var/would be 'kewl'!, not?
- "/var/would be 'kewl'!, not?"
-
- -
-
- ""
-
- -
-
Hello "World"
- "Hello \"World"
-
-
-
-
-
-
- Provides SCP client functionality.
-
-
-
- More information on the SCP protocol is available here:
- https://github.com/net-ssh/net-scp/blob/master/lib/net/scp.rb
-
-
- Known issues in OpenSSH:
-
- -
-
Recursive download (-prf) does not deal well with specific UTF-8 and newline characters.
- Recursive update does not support empty path for uploading to home directory.
-
-
-
-
-
- Provides SCP client functionality.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite time-out period.
-
-
-
-
- Gets or sets the size of the buffer.
-
-
- The size of the buffer. The default buffer size is 16384 bytes.
-
-
-
-
- Gets or sets the transformation to apply to remote paths.
-
-
- The transformation to apply to remote paths. The default is .
-
- is null .
-
-
- This transformation is applied to the remote file or directory path that is passed to the
- scp command.
-
-
- See for the transformations that are supplied
- out-of-the-box with SSH.NET.
-
-
-
-
-
- Occurs when downloading file.
-
-
-
-
- Occurs when uploading file.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Uploads the specified stream to the remote host.
-
- The to upload.
- A relative or absolute path for the remote file.
- is null .
- is a zero-length .
- A directory with the specified path exists on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified file from the remote host to the stream.
-
- A relative or absolute path for the remote file.
- The to download the remote file to.
- is null or contains only whitespace characters.
- is null .
- exists on the remote host, and is not a regular file.
- The secure copy execution request was rejected by the server.
-
-
-
- Sets mode, size and name of file being upload.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The size of the content to upload.
- The name of the file, without path, to which the content is to be uploaded.
-
-
- When the SCP transfer is already initiated for a file, a zero-length should
- be specified for . This prevents the server from uploading the
- content to a file with path <file path>/ if there's
- already a directory with this path, and allows us to receive an error response.
-
-
-
-
-
- Uploads the content of a file.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The content to upload.
- The name of the remote file, without path, to which the content is uploaded.
-
- is only used for raising the event.
-
-
-
-
- Checks the return code.
-
- The output stream.
-
-
-
- Read a LF-terminated string from the .
-
- The to read from.
-
- The string without trailing LF.
-
-
-
-
- Uploads the specified file to the remote host.
-
- The file system info.
- A relative or absolute path for the remote file.
- is null .
- is null .
- is a zero-length .
- A directory with the specified path exists on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Uploads the specified directory to the remote host.
-
- The directory info.
- A relative or absolute path for the remote directory.
- is null .
- is null .
- is a zero-length string.
- does not exist on the remote host, is not a directory or the user does not have the required permission.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified file from the remote host to local file.
-
- Remote host file name.
- Local file information.
- is null .
- is null or empty.
- exists on the remote host, and is not a regular file.
- The secure copy execution request was rejected by the server.
-
-
-
- Downloads the specified directory from the remote host to local directory.
-
- Remote host directory name.
- Local directory information.
- is null or empty.
- is null .
- File or directory with the specified path does not exist on the remote host.
- The secure copy execution request was rejected by the server.
-
-
-
- Uploads the and
- of the next file or directory to upload.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The file or directory to upload.
-
-
-
- Upload the files and subdirectories in the specified directory.
-
- The channel to perform the upload in.
- A from which any feedback from the server can be read.
- The directory to upload.
-
-
-
- Sets mode and name of the directory being upload.
-
-
-
-
- Return a value indicating whether the specified path is a valid SCP file path.
-
- The path to verify.
-
- if is a valid SCP file path; otherwise, .
-
-
- To match OpenSSH behavior (introduced as a result of CVE-2018-20685), a file path is considered
- invalid in any of the following conditions:
-
- -
-
is a zero-length string.
-
- -
-
is ". ".
-
- -
-
is ".. ".
-
- -
-
contains a forward slash (/).
-
-
-
-
-
-
- Represents the abstract base class from which all implementations of algorithms must inherit.
-
-
-
-
- Gets algorithm name.
-
-
-
- Copy constructor. This will copy the state of the provided
- message digest.
-
-
- interface that a message digest conforms to.
-
-
- return the algorithm name
-
- @return the algorithm name
-
-
- return the size, in bytes, of the digest produced by this message digest.
-
- @return the size, in bytes, of the digest produced by this message digest.
-
-
- return the size, in bytes, of the internal buffer used by this digest.
-
- @return the size, in bytes, of the internal buffer used by this digest.
-
-
- update the message digest with a single byte.
-
- @param inByte the input byte to be entered.
-
-
- update the message digest with a block of bytes.
-
- @param input the byte array containing the data.
- @param inOff the offset into the byte array where the data starts.
- @param len the length of the data.
-
-
- Close the digest, producing the final digest value. The doFinal
- call leaves the digest reset.
-
- @param output the array the digest is to be copied into.
- @param outOff the offset into the out array the digest is to start at.
-
-
- reset the digest back to it's initial state.
-
-
- The base class for parameters to key generators.
-
-
- initialise the generator with a source of randomness
- and a strength (in bits).
-
- @param random the random byte source.
- @param strength the size, in bits, of the keys we want to produce.
-
-
- return the random source associated with this
- generator.
-
- @return the generators random source.
-
-
- return the bit strength for keys produced by this generator,
-
- @return the strength of the keys this generator produces (in bits).
-
-
- Generic interface for objects generating random bytes.
-
-
- Add more seed material to the generator.
- A byte array to be mixed into the generator's state.
-
-
- Add more seed material to the generator.
- A long value to be mixed into the generator's state.
-
-
- Fill byte array with random values.
- Array to be filled.
-
-
- Fill byte array with random values.
- Array to receive bytes.
- Index to start filling at.
- Length of segment to fill.
-
-
- return a = a + b - b preserved.
-
-
- unsigned comparison on two arrays - note the arrays may
- start with leading zeros.
-
-
- return z = x / y - done in place (z value preserved, x contains the
- remainder)
-
-
- return whether or not a BigInteger is probably prime with a
- probability of 1 - (1/2)**certainty.
- From Knuth Vol 2, pg 395.
-
-
- Calculate the numbers u1, u2, and u3 such that:
-
- u1 * a + u2 * b = u3
-
- where u3 is the greatest common divider of a and b.
- a and b using the extended Euclid algorithm (refer p. 323
- of The Art of Computer Programming vol 2, 2nd ed).
- This also seems to have the side effect of calculating
- some form of multiplicative inverse.
-
- @param a First number to calculate gcd for
- @param b Second number to calculate gcd for
- @param u1Out the return object for the u1 value
- @return The greatest common divisor of a and b
-
-
- return w with w = x * x - w is assumed to have enough space.
-
-
- return x with x = y * z - x is assumed to have enough space.
-
-
- Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size)
-
-
- Montgomery multiplication: a = x * y * R^(-1) mod m
-
- Based algorithm 14.36 of Handbook of Applied Cryptography.
-
- m, x, y should have length n
- a should have length (n + 1)
- b = 2^32, R = b^n
-
- The result is put in x
-
- NOTE: the indices of x, y, m, a different in HAC and in Java
-
-
- return x = x % y - done in place (y value preserved)
-
-
- do a left shift - this returns a new array.
-
-
- do a right shift - this does it in place.
-
-
- do a right shift by one - this does it in place.
-
-
- returns x = x - y - we assume x is >= y
-
-
- Class representing a simple version of a big decimal. A
- SimpleBigDecimal
is basically a
- {@link java.math.BigInteger BigInteger} with a few digits on the right of
- the decimal point. The number of (binary) digits on the right of the decimal
- point is called the scale
of the SimpleBigDecimal
.
- Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted
- automatically, but must be set manually. All SimpleBigDecimal
s
- taking part in the same arithmetic operation must have equal scale. The
- result of a multiplication of two SimpleBigDecimal
s returns a
- SimpleBigDecimal
with double scale.
-
-
- Returns a SimpleBigDecimal
representing the same numerical
- value as value
.
- @param value The value of the SimpleBigDecimal
to be
- created.
- @param scale The scale of the SimpleBigDecimal
to be
- created.
- @return The such created SimpleBigDecimal
.
-
-
- Constructor for SimpleBigDecimal
. The value of the
- constructed SimpleBigDecimal
Equals bigInt /
- 2scale
.
- @param bigInt The bigInt
value parameter.
- @param scale The scale of the constructed SimpleBigDecimal
.
-
-
- Class holding methods for point multiplication based on the window
- τ-adic nonadjacent form (WTNAF). The algorithms are based on the
- paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves"
- by Jerome A. Solinas. The paper first appeared in the Proceedings of
- Crypto 1997.
-
-
- The window width of WTNAF. The standard value of 4 is slightly less
- than optimal for running time, but keeps space requirements for
- precomputation low. For typical curves, a value of 5 or 6 results in
- a better running time. When changing this value, the
- αu
's must be computed differently, see
- e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson,
- Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004,
- p. 121-122
-
-
- 24
-
-
- The αu
's for a=0
as an array
- of ZTauElement
s.
-
-
- The αu
's for a=0
as an array
- of TNAFs.
-
-
- The αu
's for a=1
as an array
- of ZTauElement
s.
-
-
- The αu
's for a=1
as an array
- of TNAFs.
-
-
- Computes the norm of an element λ
of
- Z [τ]
.
- @param mu The parameter μ
of the elliptic curve.
- @param lambda The element λ
of
- Z [τ]
.
- @return The norm of λ
.
-
-
- Computes the norm of an element λ
of
- R [τ]
, where λ = u + vτ
- and u
and u
are real numbers (elements of
- R
).
- @param mu The parameter μ
of the elliptic curve.
- @param u The real part of the element λ
of
- R [τ]
.
- @param v The τ
-adic part of the element
- λ
of R [τ]
.
- @return The norm of λ
.
-
-
- Rounds an element λ
of R [τ]
- to an element of Z [τ]
, such that their difference
- has minimal norm. λ
is given as
- λ = λ0 + λ1 τ
.
- @param lambda0 The component λ0
.
- @param lambda1 The component λ1
.
- @param mu The parameter μ
of the elliptic curve. Must
- equal 1 or -1.
- @return The rounded element of Z [τ]
.
- @throws ArgumentException if lambda0
and
- lambda1
do not have same scale.
-
-
- Approximate division by n
. For an integer
- k
, the value λ = s k / n
is
- computed to c
bits of accuracy.
- @param k The parameter k
.
- @param s The curve parameter s0
or
- s1
.
- @param vm The Lucas Sequence element Vm
.
- @param a The parameter a
of the elliptic curve.
- @param m The bit length of the finite field
- F m
.
- @param c The number of bits of accuracy, i.e. the scale of the returned
- SimpleBigDecimal
.
- @return The value λ = s k / n
computed to
- c
bits of accuracy.
-
-
- Computes the τ
-adic NAF (non-adjacent form) of an
- element λ
of Z [τ]
.
- @param mu The parameter μ
of the elliptic curve.
- @param lambda The element λ
of
- Z [τ]
.
- @return The τ
-adic NAF of λ
.
-
-
- Applies the operation τ()
to an
- AbstractF2mPoint
.
- @param p The AbstractF2mPoint to which τ()
is applied.
- @return τ(p)
-
-
- Returns the parameter μ
of the elliptic curve.
- @param curve The elliptic curve from which to obtain μ
.
- The curve must be a Koblitz curve, i.e. a
Equals
- 0
or 1
and b
Equals
- 1
.
- @return μ
of the elliptic curve.
- @throws ArgumentException if the given ECCurve is not a Koblitz
- curve.
-
-
- Calculates the Lucas Sequence elements Uk-1
and
- Uk
or Vk-1
and
- Vk
.
- @param mu The parameter μ
of the elliptic curve.
- @param k The index of the second element of the Lucas Sequence to be
- returned.
- @param doV If set to true, computes Vk-1
and
- Vk
, otherwise Uk-1
and
- Uk
.
- @return An array with 2 elements, containing Uk-1
- and Uk
or Vk-1
- and Vk
.
-
-
- Computes the auxiliary value tw
. If the width is
- 4, then for mu = 1
, tw = 6
and for
- mu = -1
, tw = 10
- @param mu The parameter μ
of the elliptic curve.
- @param w The window width of the WTNAF.
- @return the auxiliary value tw
-
-
- Computes the auxiliary values s0
and
- s1
used for partial modular reduction.
- @param curve The elliptic curve for which to compute
- s0
and s1
.
- @throws ArgumentException if curve
is not a
- Koblitz curve (Anomalous Binary Curve, ABC).
-
-
- Partial modular reduction modulo
- (τm - 1)/(τ - 1)
.
- @param k The integer to be reduced.
- @param m The bitlength of the underlying finite field.
- @param a The parameter a
of the elliptic curve.
- @param s The auxiliary values s0
and
- s1
.
- @param mu The parameter μ of the elliptic curve.
- @param c The precision (number of bits of accuracy) of the partial
- modular reduction.
- @return ρ := k partmod (τm - 1)/(τ - 1)
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by a BigInteger
using the reduced τ
-adic
- NAF (RTNAF) method.
- @param p The AbstractF2mPoint to Multiply.
- @param k The BigInteger
by which to Multiply p
.
- @return k * p
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ
of Z [τ]
- using the τ
-adic NAF (TNAF) method.
- @param p The AbstractF2mPoint to Multiply.
- @param lambda The element λ
of
- Z [τ]
.
- @return λ * p
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ
of Z [τ]
- using the τ
-adic NAF (TNAF) method, given the TNAF
- of λ
.
- @param p The AbstractF2mPoint to Multiply.
- @param u The the TNAF of λ
..
- @return λ * p
-
-
- Computes the [τ]
-adic window NAF of an element
- λ
of Z [τ]
.
- @param mu The parameter μ of the elliptic curve.
- @param lambda The element λ
of
- Z [τ]
of which to compute the
- [τ]
-adic NAF.
- @param width The window width of the resulting WNAF.
- @param pow2w 2width .
- @param tw The auxiliary value tw
.
- @param alpha The αu
's for the window width.
- @return The [τ]
-adic window NAF of
- λ
.
-
-
- Does the precomputation for WTNAF multiplication.
- @param p The ECPoint
for which to do the precomputation.
- @param a The parameter a
of the elliptic curve.
- @return The precomputation array for p
.
-
-
- Class representing an element of Z [τ]
. Let
- λ
be an element of Z [τ]
. Then
- λ
is given as λ = u + vτ
. The
- components u
and v
may be used directly, there
- are no accessor methods.
- Immutable class.
-
-
- The "real" part of λ
.
-
-
- The "τ
-adic" part of λ
.
-
-
- Constructor for an element λ
of
- Z [τ]
.
- @param u The "real" part of λ
.
- @param v The "τ
-adic" part of
- λ
.
-
-
- Simple shift-and-add multiplication. Serves as reference implementation
- to verify (possibly faster) implementations, and for very small scalars.
-
- @param p
- The point to multiply.
- @param k
- The multiplier.
- @return The result of the point multiplication kP
.
-
-
- Base class for an elliptic curve.
-
-
- Compute a PreCompInfo
for a point on this curve, under a given name. Used by
- ECMultiplier
s to save the precomputation for this ECPoint
for use
- by subsequent multiplication.
-
- @param point
- The ECPoint
to store precomputations for.
- @param name
- A String
used to index precomputations of different types.
- @param callback
- Called to calculate the PreCompInfo
.
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system. Where more
- than one point is to be normalized, this method will generally be more efficient than
- normalizing each point separately.
-
- @param points
- An array of points that will be updated in place with their normalized versions,
- where necessary
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system. Where more
- than one point is to be normalized, this method will generally be more efficient than
- normalizing each point separately. An (optional) z-scaling factor can be applied; effectively
- each z coordinate is scaled by this value prior to normalization (but only one
- actual multiplication is needed).
-
- @param points
- An array of points that will be updated in place with their normalized versions,
- where necessary
- @param off
- The start of the range of points to normalize
- @param len
- The length of the range of points to normalize
- @param iso
- The (optional) z-scaling factor - can be null
-
-
- Create a cache-safe lookup table for the specified sequence of points. All the points MUST
- belong to this ECCurve
instance, and MUST already be normalized.
-
-
- Sets the default ECMultiplier
, unless already set.
-
-
- Decode a point on this curve from its ASN.1 encoding. The different
- encodings are taken account of, including point compression for
- Fp
(X9.62 s 4.2.1 pg 17).
- @return The decoded point.
-
-
- Elliptic curve over Fp
-
-
- The auxiliary values s0
and
- s1
used for partial modular reduction for
- Koblitz curves.
-
-
- Solves a quadratic equation z2 + z = beta
(X9.62
- D.1.6) The other solution is z + 1
.
-
- @param beta
- The value to solve the quadratic equation for.
- @return the solution for z2 + z = beta
or
- null
if no solution exists.
-
-
- @return the auxiliary values s0
and
- s1
used for partial modular reduction for
- Koblitz curves.
-
-
- Returns true if this is a Koblitz curve (ABC curve).
- @return true if this is a Koblitz curve (ABC curve), false otherwise
-
-
- Elliptic curves over F2m. The Weierstrass equation is given by
- y2 + xy = x3 + ax2 + b
.
-
-
- The exponent m
of F2m
.
-
-
- TPB: The integer k
where xm +
- xk + 1
represents the reduction polynomial
- f(z)
.
- PPB: The integer k1
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- TPB: Always set to 0
- PPB: The integer k2
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- TPB: Always set to 0
- PPB: The integer k3
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- The point at infinity on this curve.
-
-
- Constructor for Trinomial Polynomial Basis (TPB).
- @param m The exponent m
of
- F2m
.
- @param k The integer k
where xm +
- xk + 1
represents the reduction
- polynomial f(z)
.
- @param a The coefficient a
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param b The coefficient b
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
-
-
- Constructor for Trinomial Polynomial Basis (TPB).
- @param m The exponent m
of
- F2m
.
- @param k The integer k
where xm +
- xk + 1
represents the reduction
- polynomial f(z)
.
- @param a The coefficient a
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param b The coefficient b
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param order The order of the main subgroup of the elliptic curve.
- @param cofactor The cofactor of the elliptic curve, i.e.
- #Ea (F2m ) = h * n
.
-
-
- Constructor for Pentanomial Polynomial Basis (PPB).
- @param m The exponent m
of
- F2m
.
- @param k1 The integer k1
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k2 The integer k2
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k3 The integer k3
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param a The coefficient a
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param b The coefficient b
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
-
-
- Constructor for Pentanomial Polynomial Basis (PPB).
- @param m The exponent m
of
- F2m
.
- @param k1 The integer k1
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k2 The integer k2
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k3 The integer k3
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param a The coefficient a
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param b The coefficient b
in the Weierstrass equation
- for non-supersingular elliptic curves over
- F2m
.
- @param order The order of the main subgroup of the elliptic curve.
- @param cofactor The cofactor of the elliptic curve, i.e.
- #Ea (F2m ) = h * n
.
-
-
- Return true if curve uses a Trinomial basis.
-
- @return true if curve Trinomial, false otherwise.
-
-
- return the field name for this field.
-
- @return the string "Fp".
-
-
- return a sqrt root - the routine verifies that the calculation
- returns the right value - if none exists it returns null.
-
-
- Class representing the Elements of the finite field
- F2m
in polynomial basis (PB)
- representation. Both trinomial (Tpb) and pentanomial (Ppb) polynomial
- basis representations are supported. Gaussian normal basis (GNB)
- representation is not supported.
-
-
- Indicates gaussian normal basis representation (GNB). Number chosen
- according to X9.62. GNB is not implemented at present.
-
-
- Indicates trinomial basis representation (Tpb). Number chosen
- according to X9.62.
-
-
- Indicates pentanomial basis representation (Ppb). Number chosen
- according to X9.62.
-
-
- Tpb or Ppb.
-
-
- The exponent m
of F2m
.
-
-
- The LongArray
holding the bits.
-
-
- Constructor for Ppb.
- @param m The exponent m
of
- F2m
.
- @param k1 The integer k1
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k2 The integer k2
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param k3 The integer k3
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
- @param x The BigInteger representing the value of the field element.
-
-
- Constructor for Tpb.
- @param m The exponent m
of
- F2m
.
- @param k The integer k
where xm +
- xk + 1
represents the reduction
- polynomial f(z)
.
- @param x The BigInteger representing the value of the field element.
-
-
- Checks, if the ECFieldElements a
and b
- are elements of the same field F2m
- (having the same representation).
- @param a field element.
- @param b field element to be compared.
- @throws ArgumentException if a
and b
- are not elements of the same field
- F2m
(having the same
- representation).
-
-
- @return the representation of the field
- F2m
, either of
- {@link F2mFieldElement.Tpb} (trinomial
- basis representation) or
- {@link F2mFieldElement.Ppb} (pentanomial
- basis representation).
-
-
- @return the degree m
of the reduction polynomial
- f(z)
.
-
-
- @return Tpb: The integer k
where xm +
- xk + 1
represents the reduction polynomial
- f(z)
.
- Ppb: The integer k1
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- @return Tpb: Always returns 0
- Ppb: The integer k2
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- @return Tpb: Always set to 0
- Ppb: The integer k3
where xm +
- xk3 + xk2 + xk1 + 1
- represents the reduction polynomial f(z)
.
-
-
- base class for points on elliptic curves.
-
-
- Returns the affine x-coordinate after checking that this point is normalized.
-
- @return The affine x-coordinate of this point
- @throws IllegalStateException if the point is not normalized
-
-
- Returns the affine y-coordinate after checking that this point is normalized
-
- @return The affine y-coordinate of this point
- @throws IllegalStateException if the point is not normalized
-
-
- Returns the x-coordinate.
-
- Caution: depending on the curve's coordinate system, this may not be the same value as in an
- affine coordinate system; use Normalize() to get a point where the coordinates have their
- affine values, or use AffineXCoord if you expect the point to already have been normalized.
-
- @return the x-coordinate of this point
-
-
- Returns the y-coordinate.
-
- Caution: depending on the curve's coordinate system, this may not be the same value as in an
- affine coordinate system; use Normalize() to get a point where the coordinates have their
- affine values, or use AffineYCoord if you expect the point to already have been normalized.
-
- @return the y-coordinate of this point
-
-
- Normalization ensures that any projective coordinate is 1, and therefore that the x, y
- coordinates reflect those of the equivalent point in an affine coordinate system.
-
- @return a new ECPoint instance representing the same point, but with normalized coordinates
-
-
- return the field element encoded with point compression. (S 4.3.6)
-
-
- Multiplies this ECPoint
by the given number.
- @param k The multiplicator.
- @return k * this
.
-
-
- Elliptic curve points over Fp
-
-
- Create a point which encodes without point compression.
-
- @param curve the curve to use
- @param x affine x co-ordinate
- @param y affine y co-ordinate
-
-
- Create a point that encodes with or without point compression.
-
- @param curve the curve to use
- @param x affine x co-ordinate
- @param y affine y co-ordinate
- @param withCompression if true encode with point compression
-
-
- Elliptic curve points over F2m
-
-
- @param curve base curve
- @param x x point
- @param y y point
-
-
- @param curve base curve
- @param x x point
- @param y y point
- @param withCompression true if encode with point compression.
-
-
- Interface for classes encapsulating a point multiplication algorithm
- for ECPoint
s.
-
-
- Multiplies the ECPoint p
by k
, i.e.
- p
is added k
times to itself.
- @param p The ECPoint
to be multiplied.
- @param k The factor by which p
is multiplied.
- @return p
multiplied by k
.
-
-
- Class holding precomputation data for fixed-point multiplications.
-
-
- Lookup table for the precomputed ECPoint
s used for a fixed point multiplication.
-
-
- The width used for the precomputation. If a larger width precomputation
- is already available this may be larger than was requested, so calling
- code should refer to the actual width.
-
-
- Interface for classes storing precomputation data for multiplication
- algorithms. Used as a Memento (see GOF patterns) for
- WNafMultiplier
.
-
-
- Class implementing the WNAF (Window Non-Adjacent Form) multiplication
- algorithm.
-
-
- Multiplies this
by an integer k
using the
- Window NAF method.
- @param k The integer by which this
is multiplied.
- @return A new ECPoint
which equals this
- multiplied by k
.
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @return the window size to use
-
-
- Class holding precomputation data for the WNAF (Window Non-Adjacent Form)
- algorithm.
-
-
- Array holding the precomputed ECPoint
s used for a Window
- NAF multiplication.
-
-
- Array holding the negations of the precomputed ECPoint
s used
- for a Window NAF multiplication.
-
-
- Holds an ECPoint
representing Twice(this). Used for the
- Window NAF multiplication to create or extend the precomputed values.
-
-
- Computes the Window NAF (non-adjacent Form) of an integer.
- @param width The width w
of the Window NAF. The width is
- defined as the minimal number w
, such that for any
- w
consecutive digits in the resulting representation, at
- most one is non-zero.
- @param k The integer of which the Window NAF is computed.
- @return The Window NAF of the given width, such that the following holds:
- k = ∑i=0 l-1 ki 2i
-
, where the ki
denote the elements of the
- returned byte[]
.
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @return the window size to use
-
-
- Determine window width to use for a scalar multiplication of the given size.
-
- @param bits the bit-length of the scalar to multiply by
- @param windowSizeCutoffs a monotonically increasing list of bit sizes at which to increment the window width
- @return the window size to use
-
-
- Class implementing the WTNAF (Window
- τ
-adic Non-Adjacent Form) algorithm.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by k
using the reduced τ
-adic NAF (RTNAF)
- method.
- @param p The AbstractF2mPoint to multiply.
- @param k The integer by which to multiply k
.
- @return p
multiplied by k
.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ
of Z [τ]
using
- the τ
-adic NAF (TNAF) method.
- @param p The AbstractF2mPoint to multiply.
- @param lambda The element λ
of
- Z [τ]
of which to compute the
- [τ]
-adic NAF.
- @return p
multiplied by λ
.
-
-
- Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
- by an element λ
of Z [τ]
- using the window τ
-adic NAF (TNAF) method, given the
- WTNAF of λ
.
- @param p The AbstractF2mPoint to multiply.
- @param u The the WTNAF of λ
..
- @return λ * p
-
-
- Class holding precomputation data for the WTNAF (Window
- τ
-adic Non-Adjacent Form) algorithm.
-
-
- Array holding the precomputed AbstractF2mPoint
s used for the
- WTNAF multiplication in
- {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply()
- WTauNafMultiplier.multiply()}
.
-
-
-
- Utility class for creating IDigest objects from their names/Oids
-
-
-
- Use the specified instance of IRandomGenerator as random source.
-
- This constructor performs no seeding of either the IRandomGenerator or the
- constructed SecureRandom . It is the responsibility of the client to provide
- proper seed material as necessary/appropriate for the given IRandomGenerator
- implementation.
-
- The source to generate all random bytes from.
-
-
- base constructor.
-
-
- create a SecurityUtilityException with the given message.
-
- @param message the message to be carried with the exception.
-
-
- General array utilities.
-
-
-
- Are two arrays equal.
-
- Left side.
- Right side.
- True if equal.
-
-
-
- A constant time equals comparison - does not terminate early if
- test will fail.
-
- first array
- second array
- true if arrays equal, false otherwise.
-
-
- Make a copy of a range of bytes from the passed in data array. The range can
- extend beyond the end of the input array, in which case the return array will
- be padded with zeroes.
-
- @param data the array from which the data is to be copied.
- @param from the start index at which the copying should take place.
- @param to the final index of the range (exclusive).
-
- @return a new byte array containing the range given.
-
-
- BigInteger utilities.
-
-
- Return the passed in value as an unsigned byte array.
-
- @param value value to be converted.
- @return a byte array without a leading zero byte if present in the signed encoding.
-
-
- Return the passed in value as an unsigned byte array of specified length, zero-extended as necessary.
-
- @param length desired length of result array.
- @param n value to be converted.
- @return a byte array of specified length, with leading zeroes as necessary given the size of n.
-
-
- Return a random BigInteger not less than 'min' and not greater than 'max'
-
- @param min the least value that may be generated
- @param max the greatest value that may be generated
- @param random the source of randomness
- @return a random BigInteger value in the range [min,max]
-
-
-
- Class to decode and encode Hex.
-
-
-
- encode the input data producing a Hex encoded byte array.
-
- @return a byte array containing the Hex encoded data.
-
-
- encode the input data producing a Hex encoded byte array.
-
- @return a byte array containing the Hex encoded data.
-
-
- Hex encode the byte data writing it to the given output stream.
-
- @return the number of bytes produced.
-
-
- Hex encode the byte data writing it to the given output stream.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded input data. It is assumed the input data is valid.
-
- @return a byte array representing the decoded data.
-
-
- decode the Hex encoded string data - whitespace will be ignored.
-
- @return a byte array representing the decoded data.
-
-
- decode the Hex encoded string data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
- encode the input data producing a Hex output stream.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded byte data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
- decode the Hex encoded string data writing it to the given output stream,
- whitespace characters will be ignored.
-
- @return the number of bytes produced.
-
-
-
- Produce a copy of this object with its configuration and in its current state.
-
-
- The returned object may be used simply to store the state, or may be used as a similar object
- starting from the copied state.
-
-
-
-
- Restore a copied object state into this object.
-
-
- Implementations of this method should try to avoid or minimise memory allocation to perform the reset.
-
- an object originally {@link #copy() copied} from an object of the same type as this instance.
- if the provided object is not of the correct type.
- if the other parameter is in some other way invalid.
-
-
- Exception to be thrown on a failure to reset an object implementing Memoable.
-
- The exception extends InvalidCastException to enable users to have a single handling case,
- only introducing specific handling of this one if required.
-
-
-
- Basic Constructor.
-
- @param msg message to be associated with this exception.
-
-
-
- Implements certificate support for host algorithm.
-
-
-
-
- Gets the host key data.
-
-
-
-
- Initializes a new instance of the class.
-
- The host key name.
-
-
-
- Signs the specified data.
-
- The data.
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
- true if signature was successfully verified; otherwise false .
-
-
-
-
- Base class for asymmetric cipher implementations.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
- BCrypt implementation.
-
-
- BCrypt implements OpenBSD-style Blowfish password hashing using the scheme described in
- "A Future-
- Adaptable Password Scheme" by Niels Provos and David Mazieres.
-
-
- This password hashing system tries to thwart off-line password cracking using a
- computationally-intensive hashing algorithm, based on Bruce Schneier's Blowfish cipher.
- The work factor of the algorithm is parameterised, so it can be increased as computers
- get faster.
-
-
- Usage is really simple. To hash a password for the first time, call the method with a random salt, like this:
-
- string pw_hash = BCrypt.HashPassword(plain_password);
-
- To check whether a plaintext password matches one that has been hashed previously,
- use the method:
-
-
- if (BCrypt.Verify(candidate_password, stored_hash))
- Console.WriteLine("It matches");
- else
- Console.WriteLine("It does not match");
-
-
- The method takes an optional parameter (workFactor) that
- determines the computational complexity of the hashing:
-
-
- string strong_salt = BCrypt.GenerateSalt(10);
- string stronger_salt = BCrypt.GenerateSalt(12);
-
-
- The amount of work increases exponentially (2^workFactor), so each increment is twice
- as much work. The default workFactor is 10, and the valid range is 4 to 31.
-
-
-
-
-
- Hash a string using the OpenBSD bcrypt scheme and a salt generated by .
-
- Just an alias for HashPassword.
- The string to hash.
- The hashed string.
-
-
-
- Hash a string using the OpenBSD bcrypt scheme and a salt generated by .
-
- Just an alias for HashPassword.
- The string to hash.
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2^workFactor.
- The hashed string.
-
-
-
- Hash a password using the OpenBSD bcrypt scheme and a salt generated by .
-
- The password to hash.
- The hashed password.
-
-
-
- Hash a password using the OpenBSD bcrypt scheme and a salt generated by using the given .
-
- The password to hash.
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2^workFactor.
- The hashed password.
-
-
- Hash a password using the OpenBSD bcrypt scheme.
- Thrown when one or more arguments have unsupported or
- illegal values.
- The password to hash.
- the salt to hash with (perhaps generated using BCrypt.gensalt).
- The hashed password
-
-
-
- Generate a salt for use with the method.
-
- The log2 of the number of rounds of hashing to apply - the work
- factor therefore increases as 2**workFactor.
- A base64 encoded salt value.
-
-
-
- Generate a salt for use with the method
- selecting a reasonable default for the number of hashing rounds to apply.
-
- A base64 encoded salt value.
-
-
-
- Verifies that the hash of the given matches the provided
-
-
- The text to verify.
- The previously-hashed password.
- true if the passwords match, false otherwise.
-
-
-
- Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. Note that this
- is *not* compatible with the standard MIME-base64 encoding.
-
- Thrown when one or more arguments have unsupported or
- illegal values.
- The byte array to encode.
- The number of bytes to encode.
- Base64-encoded string.
-
-
-
- Decode a string encoded using bcrypt's base64 scheme to a byte array. Note that this is *not*
- compatible with the standard MIME-base64 encoding.
-
- Thrown when one or more arguments have unsupported or
- illegal values.
- The string to decode.
- The maximum bytes to decode.
- The decoded byte array.
-
-
-
- Look up the 3 bits base64-encoded by the specified character, range-checking against
- conversion table.
-
- The base64-encoded value.
- The decoded value of x.
-
-
- Blowfish encipher a single 64-bit block encoded as two 32-bit halves.
- An array containing the two 32-bit half blocks.
- The position in the array of the blocks.
-
-
- Cycically extract a word of key material.
- The string to extract the data from.
- [in,out] The current offset.
- The next word of material from data.
-
-
- Initializes the Blowfish key schedule.
-
-
- Key the Blowfish cipher.
- The key byte array.
-
-
-
- Perform the "enhanced key schedule" step described by Provos and Mazieres in "A Future-
- Adaptable Password Scheme" http://www.openbsd.org/papers/bcrypt-paper.ps.
-
- Salt byte array.
- Input byte array.
-
-
- Perform the central hashing step in the bcrypt scheme.
- Thrown when one or more arguments have unsupported or
- illegal values.
- The input byte array to hash.
- The salt byte array to hash with.
- The binary logarithm of the number of rounds of hashing to apply.
- A byte array containing the hashed result.
-
-
- Compatibility with new OpenBSD function.
- Ported from SSHJ library (https://github.com/hierynomus/sshj)
-
-
-
- Applies the Bcrypt kdf to derive a key and iv from the passphrase,
- the key/iv are returned in the output variable.
- Ported from the SSHJ library. https://github.com/hierynomus/sshj
-
-
-
-
-
-
-
-
- Appends multiple byte arrays into one array.
-
-
-
-
-
-
- Exception for signalling parse errors.
-
-
- Default constructor.
-
-
- Initializes a new instance of .
- The message.
-
-
- Initializes a new instance of .
- The message.
- The inner exception.
-
-
-
- Base class for block cipher implementations.
-
-
-
-
- Gets the size of the block in bytes.
-
-
- The size of the block in bytes.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Gets the size of the block.
-
-
- The size of the block.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- Size of the block.
- Cipher mode.
- Cipher padding.
- is null .
-
-
-
- Encrypts the specified data.
-
- The data.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
- Encrypted data
-
-
-
- Decrypts the specified data.
-
- The data.
- Decrypted data
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Base class for cipher implementation.
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Encrypts the specified input.
-
- The input.
- Encrypted data.
-
-
-
- Encrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
-
- The encrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
-
- The decrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Implements digital signature where where asymmetric cipher is used,
-
-
-
-
- Initializes a new instance of the class.
-
- The object identifier.
- The cipher.
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- True if signature was successfully verified; otherwise false .
-
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
-
-
-
- Hashes the specified input.
-
- The input.
- Hashed data.
-
-
-
- Encodes hash using DER.
-
- The hash data.
- DER Encoded byte array
-
-
-
- AES cipher implementation.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
- or is null .
- or is too short.
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
- or is null .
- or is too short.
-
-
-
- Implements ARCH4 cipher algorithm
-
-
-
-
- Holds the state of the RC4 engine
-
-
-
-
- Gets the minimum data size.
-
-
- The minimum data size.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- if set to true will disharged first 1536 bytes.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Encrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
-
- Encrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
-
- The decrypted data.
-
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
-
-
-
- Blowfish cipher implementation.
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The s-boxes
-
-
-
-
- The p-array
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- apply the encryption cycle to each value pair in the table.
-
- The xl.
- The xr.
- The table.
-
-
-
- Implements CAST cipher algorithm
-
-
-
-
- The rotating round key
-
-
-
-
- The masking round key
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Sets the subkeys using the same nomenclatureas described in RFC2144.
-
- The key.
-
-
-
- The first of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- The second of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- The third of the three processing functions for the encryption and decryption.
-
- The input to be processed.
- The mask to be used from Km[n].
- The rotation value to be used.
-
-
-
-
- Does the 16 rounds to encrypt the block.
-
- The LH-32bits of the plaintext block.
- The RH-32bits of the plaintext block.
- The result.
-
-
-
- Base class for cipher mode implementations
-
-
-
-
- Gets the cipher.
-
-
-
-
- Gets the IV vector.
-
-
-
-
- Holds block size of the cipher.
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Initializes the specified cipher mode.
-
- The cipher.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Base class for cipher padding implementations
-
-
-
-
- Pads the specified input to match the block size.
-
- Size of the block.
- The input.
-
- Padded data array.
-
-
-
-
- Pads the specified input to match the block size.
-
- Size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements DES cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Generates the working key.
-
- if set to true [encrypting].
- The key.
- Generated working key.
-
-
-
- Validates the key.
-
-
-
-
- Performs DES function.
-
- The w key.
- The input.
- The in off.
- The out bytes.
- The out off.
-
-
-
- Implements CBC cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements CFB cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements CTR cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements OFB cipher mode
-
-
-
-
- Initializes a new instance of the class.
-
- The iv.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Implements PKCS5 cipher padding
-
-
-
-
- Pads the specified input to match the block size.
-
- The size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements PKCS7 cipher padding
-
-
-
-
- Pads the specified input to match the block size.
-
- The size of the block.
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
-
- The padded data array.
-
-
-
-
- Pads the specified input with a given number of bytes.
-
- The input.
- The zero-based offset in at which the data to pad starts.
- The number of bytes in to take into account.
- The number of bytes to pad the input with.
-
- The padded data array.
-
-
-
-
- Implements RSA cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The RSA key.
-
-
-
- Encrypts the specified data.
-
- The data.
- The zero-based offset in at which to begin encrypting.
- The number of bytes to encrypt from .
- Encrypted data.
-
-
-
- Decrypts the specified data.
-
- The data.
-
- The decrypted data.
-
- Only block type 01 or 02 are supported.
- Thrown when decrypted block type is not supported.
-
-
-
- Decrypts the specified input.
-
- The input.
- The zero-based offset in at which to begin decrypting.
- The number of bytes to decrypt from .
-
- The decrypted data.
-
- Only block type 01 or 02 are supported.
- Thrown when decrypted block type is not supported.
-
-
-
- Implements Serpent cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Expand a user-supplied key material into a session key.
-
- The user-key bytes to use.
-
- A session key.
-
- is not multiple of 4 bytes.
-
-
-
- S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.
-
- A.
- The b.
- The c.
- The d.
-
-
-
- Apply the linear transformation to the register set.
-
-
-
-
- Apply the inverse of the linear transformation to the register set.
-
-
-
-
- Implements 3DES cipher algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Validates the key.
-
-
-
-
- Implements Twofish cipher algorithm
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- The mode.
- The padding.
- is null .
- Keysize is not valid for this algorithm.
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
- Define the fixed p0/p1 permutations used in keyed S-box lookup.
- By changing the following constant definitions, the S-boxes will
- automatically Get changed in the Twofish engine.
-
-
- gSubKeys[] and gSBox[] are eventually used in the
- encryption and decryption methods.
-
-
- Use (12, 8) Reed-Solomon code over GF(256) to produce
- a key S-box 32-bit entity from 2 key material 32-bit
- entities.
-
- @param k0 first 32-bit entity
- @param k1 second 32-bit entity
- @return Remainder polynomial Generated using RS code
-
-
- Reed-Solomon code parameters: (12,8) reversible code:
-
-
- G(x) = x^4 + (a+1/a)x^3 + ax^2 + (a+1/a)x + 1
-
- where a = primitive root of field generator 0x14D
-
-
-
-
- Base class for signature implementations
-
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
- True if signature was successfully verified; otherwise false .
-
-
-
- Creates the signature.
-
- The input.
- Signed input data.
-
-
-
- Implements DSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The DSA key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
- Invalid signature.
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
- Invalid DSA key.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements ECDSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The ECDSA key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Implements ECDSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The ED25519Key key.
- is null .
-
-
-
- Verifies the signature.
-
- The input.
- The signature.
-
- true if signature was successfully verified; otherwise false .
-
- Invalid signature.
-
-
-
- Creates the signature.
-
- The input.
-
- Signed input data.
-
- Invalid ED25519Key key.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Computes a Hash-based Message Authentication Code (HMAC) by using the hash function.
-
-
-
-
- Initializes a with the specified key.
-
- The key.
-
-
-
- Initializes a with the specified key and size of the computed hash code.
-
- The key.
- The size, in bits, of the computed hash code.
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Finalizes the hash computation after the last data is processed by the cryptographic stream object.
-
-
- The computed hash code.
-
-
-
-
- Implements RSA digital signature algorithm.
-
-
-
-
- Initializes a new instance of the class.
-
- The RSA key.
-
-
-
- Hashes the specified input.
-
- The input.
-
- Hashed data.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Base class of stream cipher algorithms.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- is null .
-
-
-
- Base class for symmetric cipher implementations.
-
-
-
-
- Gets the key.
-
-
-
-
- Initializes a new instance of the class.
-
- The key.
- is null .
-
-
-
- Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.
-
- The input data to encrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write encrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes encrypted.
-
-
-
-
- Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.
-
- The input data to decrypt.
- The offset into the input byte array from which to begin using data.
- The number of bytes in the input byte array to use as data.
- The output to which to write decrypted data.
- The offset into the output byte array from which to begin writing data.
-
- The number of bytes decrypted.
-
-
-
-
- Contains DSA private and public key
-
-
-
-
- Gets the P.
-
-
-
-
- Gets the Q.
-
-
-
-
- Gets the G.
-
-
-
-
- Gets public key Y.
-
-
-
-
- Gets private key X.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
- The p.
- The q.
- The g.
- The y.
- The x.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains ECDSA (ecdsa-sha2-nistp{256,384,521}) private and public key
-
-
-
-
- Gets the SSH name of the ECDSA Key
-
-
-
-
- Gets the HashAlgorithm to use
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Gets ECDsa Object
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- The curve name
- Value of publickey
- Value of privatekey
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains ED25519 private and public key
-
-
-
-
- Gets the Key String.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets the PublicKey Bytes
-
-
-
-
- Gets the PrivateKey Bytes
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- pk data.
- sk data.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Base class for asymmetric cipher algorithms
-
-
-
-
- Specifies array of big integers that represent private key
-
-
-
-
- Gets the key specific digital signature.
-
-
-
-
- Gets or sets the public key.
-
-
- The public.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Signs the specified data with the key.
-
- The data to sign.
-
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data to verify.
- The signature to verify against.
- True is signature was successfully verifies; otherwise false .
-
-
-
- Contains RSA private and public key
-
-
-
-
- Gets the modulus.
-
-
-
-
- Gets the exponent.
-
-
-
-
- Gets the D.
-
-
-
-
- Gets the P.
-
-
-
-
- Gets the Q.
-
-
-
-
- Gets the DP.
-
-
-
-
- Gets the DQ.
-
-
-
-
- Gets the inverse Q.
-
-
-
-
- Gets the length of the key.
-
-
- The length of the key.
-
-
-
-
- Gets the digital signature.
-
-
-
-
- Gets or sets the public.
-
-
- The public.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
- DER encoded private key data.
-
-
-
- Initializes a new instance of the class.
-
- The modulus.
- The exponent.
- The d.
- The p.
- The q.
- The inverse Q.
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Base class for SSH host algorithms.
-
-
-
-
- Gets the host key name.
-
-
-
-
- Gets the host key data.
-
-
-
-
- Initializes a new instance of the class.
-
- The host key name.
-
-
-
- Signs the specified data.
-
- The data.
- Signed data.
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
- True is signature was successfully verifies; otherwise false .
-
-
-
- Represents a key exchange algorithm.
-
-
-
-
- Occurs when the host key is received.
-
-
-
-
- Gets the name of the algorithm.
-
-
- The name of the algorithm.
-
-
-
-
- Gets the exchange hash.
-
-
- The exchange hash.
-
-
-
-
- Starts the key exchange algorithm.
-
- The session.
- Key exchange init message.
-
-
-
- Finishes the key exchange algorithm.
-
-
-
-
- Creates the client-side cipher to use.
-
-
- The client cipher.
-
-
-
-
- Creates the server-side cipher to use.
-
-
- The server cipher.
-
-
-
-
- Creates the server-side hash algorithm to use.
-
-
- The server hash algorithm.
-
-
-
-
- Creates the client-side hash algorithm to use.
-
-
- The client hash algorithm.
-
-
-
-
- Creates the compression algorithm to use to deflate data.
-
-
- The compression method to deflate data.
-
-
-
-
- Creates the compression algorithm to use to inflate data.
-
-
- The compression method to inflate data.
-
-
-
-
- Represents base class for different key exchange algorithm implementations
-
-
-
-
- Gets or sets the session.
-
-
- The session.
-
-
-
-
- Gets or sets key exchange shared key.
-
-
- The shared key.
-
-
-
-
- Gets the exchange hash.
-
- The exchange hash.
-
-
-
- Occurs when host key received.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Creates the server side cipher to use.
-
- Server cipher.
-
-
-
- Creates the client side cipher to use.
-
- Client cipher.
-
-
-
- Creates the server side hash algorithm to use.
-
- Hash algorithm
-
-
-
- Creates the client side hash algorithm to use.
-
- Hash algorithm
-
-
-
- Creates the compression algorithm to use to deflate data.
-
- Compression method.
-
-
-
- Creates the compression algorithm to use to inflate data.
-
- Compression method.
-
-
-
- Determines whether the specified host key can be trusted.
-
- The host algorithm.
-
- true if the specified host can be trusted; otherwise, false .
-
-
-
-
- Validates the exchange hash.
-
- true if exchange hash is valid; otherwise false.
-
-
-
- Calculates key exchange hash value.
-
- Key exchange hash.
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Sends SSH message to the server
-
- The message.
-
-
-
- Generates the session key.
-
- The shared key.
- The exchange hash.
- The key.
- The size.
-
-
-
-
- Generates the session key.
-
- The shared key.
- The exchange hash.
- The p.
- The session id.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Represents base class for Diffie Hellman key exchange algorithm
-
-
-
-
- Specifies key exchange group number.
-
-
-
-
- Specifies key exchange prime number.
-
-
-
-
- Specifies client payload
-
-
-
-
- Specifies server payload
-
-
-
-
- Specifies client exchange number.
-
-
-
-
- Specifies server exchange number.
-
-
-
-
- Specifies random generated number.
-
-
-
-
- Specifies host key data.
-
-
-
-
- Specifies signature data.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Validates the exchange hash.
-
-
- true if exchange hash is valid; otherwise false.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Populates the client exchange value.
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Represents "diffie-hellman-group14-sha1" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc2409#section-6.2
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group14-sha256" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc2409#section-6.2
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group16-sha512" algorithm implementation.
-
-
-
-
- https://tools.ietf.org/html/rfc3526#section-5
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Represents "diffie-hellman-group1-sha1" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Represents "diffie-hellman-group-exchange-sha1" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Represents "diffie-hellman-group-exchange-sha256" algorithm implementation.
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- Data to hash.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman-group-exchange" algorithms.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Represents "diffie-hellman-group1-sha1" algorithm implementation.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman" SHA-256 group algorithm implementations.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Base class for "diffie-hellman" SHA-512 group algorithm implementations.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets the group prime.
-
-
- The group prime.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Specifies client payload
-
-
-
-
- Specifies server payload
-
-
-
-
- Specifies client exchange.
-
-
-
-
- Specifies server exchange.
-
-
-
-
- Specifies host key data.
-
-
-
-
- Specifies signature data.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Calculates key exchange hash value.
-
-
- Key exchange hash.
-
-
-
-
- Validates the exchange hash.
-
-
- true if exchange hash is valid; otherwise false.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Gets the parameter of the curve.
-
-
- The parameter of the curve.
-
-
-
-
- Starts key exchange algorithm
-
- The session.
- Key exchange init message.
-
-
-
- Finishes key exchange algorithm.
-
-
-
-
- Handles the server DH reply message.
-
- The host key.
- The server exchange value.
- The signature.
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets algorithm name.
-
-
-
-
- Gets Curve Parameter.
-
-
-
-
- Gets the size, in bits, of the computed hash code.
-
-
- The size, in bits, of the computed hash code.
-
-
-
-
- Hashes the specified data bytes.
-
- The hash data.
-
- Hashed bytes
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Implements key support for host algorithm.
-
-
-
-
- Gets the key.
-
-
-
-
- Gets the public key data.
-
-
-
-
- Initializes a new instance of the class.
-
- Host key name.
- Host key.
-
-
-
- Initializes a new instance of the class.
-
- Host key name.
- Host key.
- Host key encoded data.
-
-
-
- Signs the specified data.
-
- The data.
-
- Signed data.
-
-
-
-
- Verifies the signature.
-
- The data.
- The signature.
-
- True is signature was successfully verifies; otherwise false .
-
-
-
-
- Gets or sets the name of the algorithm as UTF-8 encoded byte array.
-
-
- The name of the algorithm.
-
-
-
-
- Gets or sets the signature.
-
-
- The signature.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Called when type specific data need to be loaded.
-
-
-
-
- Called when type specific data need to be saved.
-
-
-
-
- Basic factory for creating new services.
-
-
-
-
- Defines the number of times an authentication attempt with any given
- can result in before it is disregarded.
-
-
-
-
- Creates a .
-
-
- A .
-
-
-
-
- Creates a new with the specified .
-
- The to use for creating a new session.
-
- An for the specified .
-
- is null .
-
-
-
- Creates a new in a given and with
- the specified operation timeout and encoding.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
- The encoding.
- The factory to use for creating SFTP messages.
-
- An .
-
-
-
-
- Create a new .
-
-
- A .
-
-
-
-
- Negotiates a key exchange algorithm, and creates a for the negotiated
- algorithm.
-
- A of the key exchange algorithms supported by the client where key is the name of the algorithm, and value is the type implementing this algorithm.
- The names of the key exchange algorithms supported by the SSH server.
-
- A that was negotiated between client and server.
-
- is null .
- is null .
- No key exchange algorithms are supported by both client and server.
-
-
-
- Creates a shell stream.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
- The size of the buffer.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates an that encloses a path in double quotes, and escapes
- any embedded double quote with a backslash.
-
-
- An that encloses a path in double quotes, and escapes any
- embedded double quote with a backslash.
- with a shell.
-
-
-
-
- Creates a new in a given
- and with the specified operation timeout.
-
- The to create the in.
- The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
-
- An .
-
-
-
-
- Provides functionality to connect and interact with SSH server.
-
-
-
-
- Specifies an infinite waiting period.
-
-
- The value of this field is -1 millisecond.
-
-
-
-
- Specifies an infinite waiting period.
-
-
- The value of this field is -1 .
-
-
-
-
- Specifies maximum packet size defined by the protocol.
-
-
- 68536 (64 KB + 3000 bytes).
-
-
-
-
- Holds the initial local window size for the channels.
-
-
- 2147483647 (2^31 - 1) bytes.
-
-
- We currently do not define a maximum (remote) window size.
-
-
-
-
- Holds the maximum size of channel data packets that we receive.
-
-
- 64 KB.
-
-
-
- This is the maximum size (in bytes) we support for the data (payload) of a
- SSH_MSG_CHANNEL_DATA message we receive.
-
-
- We currently do not enforce this limit.
-
-
-
-
-
- Controls how many authentication attempts can take place at the same time.
-
-
- Some server may restrict number to prevent authentication attacks
-
-
-
-
- Holds metada about session messages
-
-
-
-
- Holds a that is signaled when the message listener loop has completed.
-
-
-
-
- Specifies outbound packet number
-
-
-
-
- Specifies incoming packet number
-
-
-
-
- WaitHandle to signal that last service request was accepted
-
-
-
-
- WaitHandle to signal that exception was thrown by another thread.
-
-
-
-
- WaitHandle to signal that key exchange was completed.
-
-
-
-
- WaitHandle to signal that key exchange is in progress.
-
-
-
-
- Exception that need to be thrown by waiting thread
-
-
-
-
- Specifies whether connection is authenticated
-
-
-
-
- Specifies whether user issued Disconnect command or not
-
-
-
-
- Holds the factory to use for creating new services.
-
-
-
-
- Holds connection socket.
-
-
-
-
- Holds an object that is used to ensure only a single thread can read from
- at any given time.
-
-
-
-
- Holds an object that is used to ensure only a single thread can write to
- at any given time.
-
-
- This is also used to ensure that is
- incremented atomatically.
-
-
-
-
- Holds an object that is used to ensure only a single thread can dispose
- at any given time.
-
-
- This is also used to ensure that will not be disposed
- while performing a given operation or set of operations on .
-
-
-
-
- Gets the session semaphore that controls session channels.
-
-
- The session semaphore.
-
-
-
-
- Gets the next channel number.
-
-
- The next channel number.
-
-
-
-
- Gets a value indicating whether the session is connected.
-
-
- true if the session is connected; otherwise, false .
-
-
- This methods returns true in all but the following cases:
-
- -
-
The is disposed.
-
- -
-
The SSH_MSG_DISCONNECT message - which is used to disconnect from the server - has been sent.
-
- -
-
The client has not been authenticated successfully.
-
- -
-
The listener thread - which is used to receive messages from the server - has stopped.
-
- -
-
The socket used to communicate with the server is no longer connected.
-
-
-
-
-
-
- Gets the session id.
-
-
- The session id, or null if the client has not been authenticated.
-
-
-
-
- Gets the client init message.
-
- The client init message.
-
-
-
- Gets or sets the server version string.
-
- The server version.
-
-
-
- Gets or sets the client version string.
-
- The client version.
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when session has been disconnected from the server.
-
-
-
-
- Occurs when host key received.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message is received from the server.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when a message is received from the SSH server.
-
-
-
-
- Occurs when a message is received from the SSH server.
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Occurs when message received
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
-
-
- Connects to the server.
-
- Socket connection to the SSH server or proxy server could not be established, or an error occurred while resolving the hostname.
- SSH session could not be established.
- Authentication of SSH session failed.
- Failed to establish proxy connection.
-
-
-
- Disconnects from the server.
-
-
- This sends a SSH_MSG_DISCONNECT message to the server, waits for the
- server to close the socket on its end and subsequently closes the client socket.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the connection timeout.
-
- The wait handle.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
- When neither handles are signaled in time and the session is not closing, then the
- session is disconnected.
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified to receive a signal, using a
- to specify the time interval.
-
- The that should be signaled.
- A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely.
- When this method returns , contains the .
-
- A .
-
-
-
-
- Waits for the specified handle or the exception handle for the receive thread
- to signal within the specified timeout.
-
- The wait handle.
- The time to wait for any of the handles to become signaled.
- A received package was invalid or failed the message integrity check.
- None of the handles are signaled in time and the session is not disconnecting.
- A socket error was signaled while receiving messages from the server.
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends an SSH packet to the server.
-
- A byte array containing the packet to send.
- The offset of the packet.
- The length of the packet.
- Client is not connected to the server.
-
-
- The send is performed in a dispose lock to avoid
- and/or when sending the packet.
-
-
- This method is only to be used when the connection is established, as the locking
- overhead is not required while establising the connection.
-
-
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Receives the message from the server.
-
-
- The incoming SSH message, or null if the connection with the SSH server was closed.
-
-
- We need no locking here since all messages are read by a single thread.
-
-
-
-
- Called when received.
-
- message.
-
-
-
- Called when received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Called when message received.
-
- message.
-
-
-
- Registers SSH message with the session.
-
- The name of the message to register with the session.
-
-
-
- Unregister SSH message from the session.
-
- The name of the message to unregister with the session.
-
-
-
- Loads a message from a given buffer.
-
- An array of bytes from which to construct the message.
- The zero-based byte offset in at which to begin reading.
- The number of bytes to load.
-
- A message constructed from .
-
- The type of the message is not supported.
-
-
-
- Establishes a socket connection to the specified host and port.
-
- The host name of the server to connect to.
- The port to connect to.
- The connection failed to establish within the configured .
- An error occurred trying to establish the connection.
-
-
-
- Performs a blocking read on the socket until bytes are received.
-
- The to read from.
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to read.
-
- The number of bytes read.
-
- The socket is closed.
- The read has timed-out.
- The read failed.
-
-
-
- Gets a value indicating whether the socket is connected.
-
-
- true if the socket is connected; otherwise, false .
-
-
-
- As a first check we verify whether is
- true . However, this only returns the state of the socket as of
- the last I/O operation.
-
-
- Therefore we use the combination of with mode
- and to verify if the socket is still connected.
-
-
- The MSDN doc mention the following on the return value of
- with mode :
-
- -
-
true if data is available for reading;
-
- -
-
true if the connection has been closed, reset, or terminated; otherwise, returns false .
-
-
-
-
- Conclusion: when the return value is true - but no data is available for reading - then
- the socket is no longer connected.
-
-
- When a is used from multiple threads, there's a race condition
- between the invocation of and the moment
- when the value of is obtained. To workaround this issue
- we synchronize reads from the .
-
-
-
-
-
- Performs a blocking read on the socket until bytes are received.
-
- The to read from.
- An array of type that is the storage location for the received data.
- The position in parameter to store the received data.
- The number of bytes to read.
-
- The number of bytes read.
-
- The read has timed-out.
- The read failed.
-
-
-
- Performs a blocking read on the socket until a line is read.
-
- The to read from.
- A that represents the time to wait until a line is read.
- The read has timed-out.
- An error occurred when trying to access the socket.
-
- The line read from the socket, or null when the remote server has shutdown and all data has been received.
-
-
-
-
- Shuts down and disposes the socket.
-
-
-
-
- Listens for incoming message from the server and handles them. This method run as a task on separate thread.
-
-
-
-
- https://tools.ietf.org/html/rfc1929
-
-
-
-
- Raises the event.
-
- The .
-
-
-
- Resets connection-specific information to ensure state of a previous connection
- does not affect new connections.
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Gets or sets the connection info.
-
- The connection info.
-
-
-
- Create a new SSH session channel.
-
-
- A new SSH session channel.
-
-
-
-
- Create a new channel for a locally forwarded TCP/IP port.
-
-
- A new channel for a locally forwarded TCP/IP port.
-
-
-
-
- Creates a "forwarded-tcpip" SSH channel.
-
-
- A new "forwarded-tcpip" SSH channel.
-
-
-
-
- Sends a message to the server.
-
- The message to send.
- The client is not connected.
- The operation timed out.
- The size of the packet exceeds the maximum size defined by the protocol.
-
-
-
- Sends a message to the server.
-
- The message to send.
-
- true if the message was sent to the server; otherwise, false .
-
- The size of the packet exceeds the maximum size defined by the protocol.
-
- This methods returns false when the attempt to send the message results in a
- or a .
-
-
-
-
- Represents the result of a wait operations.
-
-
-
-
- The was signaled within the specified interval.
-
-
-
-
- The was not signaled within the specified interval.
-
-
-
-
- The session is in a disconnected state.
-
-
-
-
- The session is in a failed state.
-
-
-
-
- Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
-
-
-
-
- Holds the instance that is used to communicate to the
- SFTP server.
-
-
-
-
- Holds the operation timeout.
-
-
-
-
- Holds the size of the buffer.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout to wait until an operation completes. The default value is negative
- one (-1) milliseconds, which indicates an infinite timeout period.
-
- The method was called after the client was disposed.
- represents a value that is less than -1 or greater than milliseconds.
-
-
-
- Gets or sets the maximum size of the buffer in bytes.
-
-
- The size of the buffer. The default buffer size is 32768 bytes (32 KB).
-
-
-
- For write operations, this limits the size of the payload for
- individual SSH_FXP_WRITE messages. The actual size is always
- capped at the maximum packet size supported by the peer
- (minus the size of protocol fields).
-
-
- For read operations, this controls the size of the payload which
- is requested from the peer in a SSH_FXP_READ message. The peer
- will send the requested number of bytes in a SSH_FXP_DATA message,
- possibly split over multiple SSH_MSG_CHANNEL_DATA messages.
-
-
- To optimize the size of the SSH packets sent by the peer,
- the actual requested size will take into account the size of the
- SSH_FXP_DATA protocol fields.
-
-
- The size of the each indivual SSH_FXP_DATA message is limited to the
- local maximum packet size of the channel, which is set to 64 KB
- for SSH.NET. However, the peer can limit this even further.
-
-
- The method was called after the client was disposed.
-
-
-
- Gets remote working directory.
-
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Gets sftp protocol version.
-
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Gets the current SFTP session.
-
-
- The current SFTP session.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid. -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
- is null .
- is invalid. -or- is null contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid. -or- is nunull ll or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
- is null .
- is invalid. -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , the connection info will be disposed when this
- instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , the connection info will be disposed when this
- instance is disposed.
-
-
-
-
- Changes remote directory to path.
-
- New directory path.
- is null .
- Client is not connected.
- Permission to change directory denied by remote host. -or- A SSH command was denied by the server.
- was not found on the remote host.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Changes permissions of file(s) to specified mode.
-
- File(s) path, may match multiple files.
- The mode.
- is null .
- Client is not connected.
- Permission to change permission on the path(s) was denied by the remote host. -or- A SSH command was denied by the server.
- was not found on the remote host.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates remote directory specified by path.
-
- Directory path to create.
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to create the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Deletes remote directory specified by path.
-
- Directory to be deleted path.
- is null or contains only whitespace characters.
- Client is not connected.
- was not found on the remote host.
- Permission to delete the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Deletes remote file specified by path.
-
- File to be deleted path.
- is null or contains only whitespace characters.
- Client is not connected.
- was not found on the remote host.
- Permission to delete the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Renames remote file from old path to new path.
-
- Path to the old file location.
- Path to the new file location.
- is null . -or- or is null .
- Client is not connected.
- Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Renames remote file from old path to new path.
-
- Path to the old file location.
- Path to the new file location.
- if set to true then perform a posix rename.
- is null . -or- or is null .
- Client is not connected.
- Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a symbolic link from old path to new path.
-
- The old path.
- The new path.
- is null . -or- is null or contains only whitespace characters.
- Client is not connected.
- Permission to create the symbolic link was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Retrieves list of files in remote directory.
-
- The path.
- The list callback.
-
- A list of files.
-
- is null .
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Begins an asynchronous operation of retrieving list of files in remote directory.
-
- The path.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The list callback.
-
- An that references the asynchronous operation.
-
- The method was called after the client was disposed.
-
-
-
- Ends an asynchronous operation of retrieving list of files in remote directory.
-
- The pending asynchronous SFTP request.
-
- A list of files.
-
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
-
-
-
- Gets reference to remote file or directory.
-
- The path.
-
- A reference to file object.
-
- Client is not connected.
- was not found on the remote host.
- is null .
- The method was called after the client was disposed.
-
-
-
- Checks whether file or directory exists;
-
- The path.
-
- true if directory or file exists; otherwise false .
-
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
-
- Downloads remote file specified by the path into the stream.
-
- File to download.
- Stream to write the file into.
- The download callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- was not found on the remote host. ///
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
- The method to be called when the asynchronous write operation is completed.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous file downloading into the stream.
-
- The path.
- The output.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The download callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Ends an asynchronous file downloading into the stream.
-
- The pending asynchronous SFTP request.
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- Client is not connected.
- Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server.
- The path was not found on the remote host.
- A SSH error where is the message from the remote host.
-
-
-
- Uploads stream into remote file.
-
- Data input stream.
- Remote file path.
- The upload callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Uploads stream into remote file.
-
- Data input stream.
- Remote file path.
- if set to true then existing file will be overwritten.
- The upload callback.
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- The method to be called when the asynchronous write operation is completed.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The upload callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- Client is not connected.
- Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- If the remote file already exists, it is overwritten and truncated.
-
-
-
-
-
- Begins an asynchronous uploading the stream into remote file.
-
- Data input stream.
- Remote file path.
- Specified whether an existing file can be overwritten.
- The method to be called when the asynchronous write operation is completed.
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
- The upload callback.
-
- An that references the asynchronous operation.
-
- is null .
- is null or contains only whitespace characters.
- The method was called after the client was disposed.
-
-
- Method calls made by this method to , may under certain conditions result in exceptions thrown by the stream.
-
-
- When refers to an existing file, set to true to overwrite and truncate that file.
- If is false , the upload will fail and will throw an
- .
-
-
-
-
-
- Ends an asynchronous uploading the stream into remote file.
-
- The pending asynchronous SFTP request.
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- Client is not connected.
- The directory of the file was not found on the remote host.
- Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server.
- A SSH error where is the message from the remote host.
-
-
-
- Gets status using statvfs@openssh.com request.
-
- The path.
-
- A instance that contains file status information.
-
- Client is not connected.
- is null .
- The method was called after the client was disposed.
-
-
-
- Appends lines to a file, creating the file if it does not already exist.
-
- The file to append the lines to. The file is created if it does not already exist.
- The lines to append to the file.
- isnull -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM)
-
-
-
-
- Appends lines to a file by using a specified encoding, creating the file if it does not already exist.
-
- The file to append the lines to. The file is created if it does not already exist.
- The lines to append to the file.
- The character encoding to use.
- is null . -or- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Appends the specified string to the file, creating the file if it does not already exist.
-
- The file to append the specified string to.
- The string to append to the file.
- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
-
-
- Appends the specified string to the file, creating the file if it does not already exist.
-
- The file to append the specified string to.
- The string to append to the file.
- The character encoding to use.
- is null . -or- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a that appends UTF-8 encoded text to the specified file,
- creating the file if it does not already exist.
-
- The path to the file to append to.
-
- A that appends text to a file using UTF-8 encoding without a
- Byte-Order Mark (BOM).
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates a that appends text to a file using the specified
- encoding, creating the file if it does not already exist.
-
- The path to the file to append to.
- The character encoding to use.
-
- A that appends text to a file using the specified encoding.
-
- is null . -or- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Creates or overwrites a file in the specified path.
-
- The path and name of the file to create.
-
- A that provides read/write access to the file specified in path.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- If the target file already exists, it is first truncated to zero bytes.
-
-
-
-
- Creates or overwrites the specified file.
-
- The path and name of the file to create.
- The maximum number of bytes buffered for reads and writes to the file.
-
- A that provides read/write access to the file specified in path.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
- If the target file already exists, it is first truncated to zero bytes.
-
-
-
-
- Creates or opens a file for writing UTF-8 encoded text.
-
- The file to be opened for writing.
-
- A that writes text to a file using UTF-8 encoding without
- a Byte-Order Mark (BOM).
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Creates or opens a file for writing text using the specified encoding.
-
- The file to be opened for writing.
- The character encoding to use.
-
- A that writes to a file using the specified encoding.
-
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Deletes the specified file or directory.
-
- The name of the file or directory to be deleted. Wildcard characters are not supported.
- is null .
- Client is not connected.
- was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time the specified file or directory was last accessed.
-
- The file or directory for which to obtain access date and time information.
-
- A structure set to the date and time that the specified file or directory was last accessed.
- This value is expressed in local time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
-
- The file or directory for which to obtain access date and time information.
-
- A structure set to the date and time that the specified file or directory was last accessed.
- This value is expressed in UTC time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time the specified file or directory was last written to.
-
- The file or directory for which to obtain write date and time information.
-
- A structure set to the date and time that the specified file or directory was last written to.
- This value is expressed in local time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
-
- The file or directory for which to obtain write date and time information.
-
- A structure set to the date and time that the specified file or directory was last written to.
- This value is expressed in UTC time.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a on the specified path with read/write access.
-
- The file to open.
- A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
-
- An unshared that provides access to the specified file, with the specified mode and read/write access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a on the specified path, with the specified mode and access.
-
- The file to open.
- A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
- A value that specifies the operations that can be performed on the file.
-
- An unshared that provides access to the specified file, with the specified mode and access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens an existing file for reading.
-
- The file to be opened for reading.
-
- A read-only on the specified path.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens an existing UTF-8 encoded text file for reading.
-
- The file to be opened for reading.
-
- A on the specified path.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file for writing.
-
- The file to be opened for writing.
-
- An unshared object on the specified path with access.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
- If the file does not exist, it is created.
-
-
-
-
- Opens a binary file, reads the contents of the file into a byte array, and closes the file.
-
- The file to open for reading.
-
- A byte array containing the contents of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.
-
- The file to open for reading.
-
- A string array containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file, reads all lines of the file with the specified encoding, and closes the file.
-
- The file to open for reading.
- The encoding applied to the contents of the file.
-
- A string array containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.
-
- The file to open for reading.
-
- A string containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Opens a file, reads all lines of the file with the specified encoding, and closes the file.
-
- The file to open for reading.
- The encoding applied to the contents of the file.
-
- A string containing all lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Reads the lines of a file with the UTF-8 encoding.
-
- The file to read.
-
- The lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Read the lines of a file that has a specified encoding.
-
- The file to read.
- The encoding that is applied to the contents of the file.
-
- The lines of the file.
-
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Sets the date and time the specified file was last accessed.
-
- The file for which to set the access date and time information.
- A containing the value to set for the last access date and time of path. This value is expressed in local time.
-
-
-
- Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.
-
- The file for which to set the access date and time information.
- A containing the value to set for the last access date and time of path. This value is expressed in UTC time.
-
-
-
- Sets the date and time that the specified file was last written to.
-
- The file for which to set the date and time information.
- A containing the value to set for the last write date and time of path. This value is expressed in local time.
-
-
-
- Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.
-
- The file for which to set the date and time information.
- A containing the value to set for the last write date and time of path. This value is expressed in UTC time.
-
-
-
- Writes the specified byte array to the specified file, and closes the file.
-
- The file to write to.
- The bytes to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The lines to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Write the specified string array to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The string array to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes a collection of strings to the file using the specified encoding, and closes the file.
-
- The file to write to.
- The lines to write to the file.
- The character encoding to use.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string array to the file by using the specified encoding, and closes the file.
-
- The file to write to.
- The string array to write to the file.
- An object that represents the character encoding applied to the string array.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string to the file using the UTF-8 encoding, and closes the file.
-
- The file to write to.
- The string to write to the file.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- The characters are written to the file using UTF-8 encoding without a Byte-Order Mark (BOM).
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Writes the specified string to the file using the specified encoding, and closes the file.
-
- The file to write to.
- The string to write to the file.
- The encoding to apply to the string.
- is null .
- Client is not connected.
- The specified path is invalid, or its directory was not found on the remote host.
- The method was called after the client was disposed.
-
-
- If the target file already exists, it is overwritten. It is not first truncated to zero bytes.
-
-
- If the target file does not exist, it is created.
-
-
-
-
-
- Gets the of the file on the path.
-
- The path to the file.
-
- The of the file on the path.
-
- is null .
- Client is not connected.
- was not found on the remote host.
- The method was called after the client was disposed.
-
-
-
- Sets the specified of the file on the specified path.
-
- The path to the file.
- The desired .
- is null .
- Client is not connected.
- The method was called after the client was disposed.
-
-
-
- Synchronizes the directories.
-
- The source path.
- The destination path.
- The search pattern.
-
- A list of uploaded files.
-
- is null .
- is null or contains only whitespace.
- was not found on the remote host.
-
-
-
- Begins the synchronize directories.
-
- The source path.
- The destination path.
- The search pattern.
- The async callback.
- The state.
-
- An that represents the asynchronous directory synchronization.
-
- is null .
- is null or contains only whitespace.
-
-
-
- Ends the synchronize directories.
-
- The async result.
-
- A list of uploaded files.
-
- The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
- The destination path was not found on the remote host.
-
-
-
- Internals the list directory.
-
- The path.
- The list callback.
-
- A list of files in the specfied directory.
-
- is null .
- Client not connected.
-
-
-
- Internals the download file.
-
- The path.
- The output.
- An that references the asynchronous request.
- The download callback.
- is null .
- is null or contains whitespace.
- Client not connected.
-
-
-
- Internals the upload file.
-
- The input.
- The path.
- The flags.
- An that references the asynchronous request.
- The upload callback.
- is null .
- is null or contains whitespace.
- Client not connected.
-
-
-
- Called when client is connected to the server.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- SSH_FXF_READ
-
-
-
-
- SSH_FXF_WRITE
-
-
-
-
- SSH_FXF_APPEND
-
-
-
-
- SSH_FXF_CREAT
-
-
-
-
- SSH_FXF_TRUNC
-
-
-
-
- SSH_FXF_EXCL
-
-
-
-
- Gets the SFTP protocol version.
-
-
- The SFTP protocol version.
-
-
-
-
- Gets the remote working directory.
-
-
- The remote working directory.
-
-
-
-
- Changes the current working directory to the specified path.
-
- The new working directory.
-
-
-
- Resolves a given path into an absolute path on the server.
-
- The path to resolve.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_FSTAT request.
-
- The handle.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_LSTAT request.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_MKDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing a file handle.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_OPENDIR request
-
- The path.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs posix-rename@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_READ request.
-
- The handle.
- The offset.
- The length.
- data array; null if EOF
-
-
-
- Begins an asynchronous read using a SSH_FXP_READ request.
-
- The handle to the file to read from.
- The offset in the file to start reading from.
- The number of bytes to read.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing the data read.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_READDIR request
-
- The handle.
-
-
-
-
- Performs SSH_FXP_REALPATH request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_REALPATH request.
-
- An that represents an asynchronous call.
-
- The absolute path.
-
- is null .
-
-
-
- Performs SSH_FXP_REMOVE request.
-
- The path.
-
-
-
- Performs SSH_FXP_RENAME request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_RMDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_SETSTAT request.
-
- The path.
- The attributes.
-
-
-
- Performs statvfs@openssh.com extended request.
-
- The path.
- if set to true [null on error].
-
-
-
-
- Performs SSH_FXP_SYMLINK request.
-
- The linkpath.
- The targetpath.
-
-
-
- Performs SSH_FXP_FSETSTAT request.
-
- The handle.
- The attributes.
-
-
-
- Performs SSH_FXP_WRITE request.
-
- The handle.
- The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
- The buffer holding the data to write.
- the zero-based offset in at which to begin taking bytes to write.
- The length (in bytes) of the data to write.
- The wait event handle if needed.
- The callback to invoke when the write has completed.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous close.
-
- An that represents an asynchronous call.
- is null .
-
-
-
- Calculates the optimal size of the buffer to read data from the channel.
-
- The buffer size configured on the client.
-
- The optimal size of the buffer to read data from the channel.
-
-
-
-
- Calculates the optimal size of the buffer to write data on the channel.
-
- The buffer size configured on the client.
- The file handle.
-
- The optimal size of the buffer to write data on the channel.
-
-
- Currently, we do not take the remote window size into account.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The protocol version.
- The request id.
- Specifies the path name of the new link to create.
- Specifies the path of a target object to which the newly created link will refer. In the case of a symbolic link, this path may not exist.
- if set to false the link should be a hard link, or a second directory entry referring to the same file or directory object.
- The status action.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Gets the zero-based offset (in bytes) relative to the beginning of the file that the write
- must start at.
-
-
- The zero-based offset (in bytes) relative to the beginning of the file that the write must
- start at.
-
-
-
-
- Gets the buffer holding the data to write.
-
-
- The buffer holding the data to write.
-
-
-
-
- Gets the zero-based offset in at which to begin taking bytes to
- write.
-
-
- The zero-based offset in at which to begin taking bytes to write.
-
-
-
-
- Gets the length (in bytes) of the data to write.
-
-
- The length (in bytes) of the data to write.
-
-
-
-
- Encapsulates the results of an asynchronous download operation.
-
-
-
-
- Gets or sets a value indicating whether to cancel asynchronous download operation.
-
-
- true if download operation to be canceled; otherwise, false .
-
-
- Download operation will be canceled after finishing uploading current buffer.
-
-
-
-
- Gets the number of downloaded bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- Number of downloaded bytes.
-
-
-
- Represents SFTP file information
-
-
-
-
- Gets the file attributes.
-
-
-
-
- Initializes a new instance of the class.
-
- The SFTP session.
- Full path of the directory or file.
- Attributes of the directory or file.
- or is null .
-
-
-
- Gets the full path of the directory or file.
-
-
-
-
- For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists.
- Otherwise, the Name property gets the name of the directory.
-
-
-
-
- Gets or sets the time the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the time, in coordinated universal time (UTC), the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the size, in bytes, of the current file.
-
-
- The size of the current file in bytes.
-
-
-
-
- Gets or sets file user id.
-
-
- File user id.
-
-
-
-
- Gets or sets file group id.
-
-
- File group id.
-
-
-
-
- Gets a value indicating whether file represents a socket.
-
-
- true if file represents a socket; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a symbolic link.
-
-
- true if file represents a symbolic link; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a regular file.
-
-
- true if file represents a regular file; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a block device.
-
-
- true if file represents a block device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a directory.
-
-
- true if file represents a directory; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a character device.
-
-
- true if file represents a character device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a named pipe.
-
-
- true if file represents a named pipe; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can read from this file.
-
-
- true if owner can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can write into this file.
-
-
- true if owner can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the owner can execute this file.
-
-
- true if owner can execute this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can read from this file.
-
-
- true if group members can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can write into this file.
-
-
- true if group members can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the group members can execute this file.
-
-
- true if group members can execute this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can read from this file.
-
-
- true if others can read from this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can write into this file.
-
-
- true if others can write into this file; otherwise, false .
-
-
-
-
- Gets or sets a value indicating whether the others can execute this file.
-
-
- true if others can execute this file; otherwise, false .
-
-
-
-
- Sets file permissions.
-
- The mode.
-
-
-
- Permanently deletes a file on remote machine.
-
-
-
-
- Moves a specified file to a new location on remote machine, providing the option to specify a new file name.
-
- The path to move the file to, which can specify a different file name.
- is null .
-
-
-
- Updates file status on the server.
-
-
-
-
- Returns a that represents this instance.
-
-
- A that represents this instance.
-
-
-
-
- Contains SFTP file attributes.
-
-
-
-
- Gets or sets the time the current file or directory was last accessed.
-
-
- The time that the current file or directory was last accessed.
-
-
-
-
- Gets or sets the time when the current file or directory was last written to.
-
-
- The time the current file was last written.
-
-
-
-
- Gets or sets the size, in bytes, of the current file.
-
-
- The size of the current file in bytes.
-
-
-
-
- Gets or sets file user id.
-
-
- File user id.
-
-
-
-
- Gets or sets file group id.
-
-
- File group id.
-
-
-
-
- Gets a value indicating whether file represents a socket.
-
-
- true if file represents a socket; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a symbolic link.
-
-
- true if file represents a symbolic link; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a regular file.
-
-
- true if file represents a regular file; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a block device.
-
-
- true if file represents a block device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a directory.
-
-
- true if file represents a directory; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a character device.
-
-
- true if file represents a character device; otherwise, false .
-
-
-
-
- Gets a value indicating whether file represents a named pipe.
-
-
- true if file represents a named pipe; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can read from this file.
-
-
- true if owner can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can write into this file.
-
-
- true if owner can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the owner can execute this file.
-
-
- true if owner can execute this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can read from this file.
-
-
- true if group members can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can write into this file.
-
-
- true if group members can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the group members can execute this file.
-
-
- true if group members can execute this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can read from this file.
-
-
- true if others can read from this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can write into this file.
-
-
- true if others can write into this file; otherwise, false .
-
-
-
-
- Gets a value indicating whether the others can execute this file.
-
-
- true if others can execute this file; otherwise, false .
-
-
-
-
- Gets or sets the extensions.
-
-
- The extensions.
-
-
-
-
- Sets the permissions.
-
- The mode.
-
-
-
- Returns a byte array representing the current .
-
-
- A byte array representing the current .
-
-
-
-
- Holds the size of the file, when available.
-
-
-
-
- Holds a value indicating whether EOF has already been signaled by the SSH server.
-
-
-
-
- Holds a value indicating whether the client has read up to the end of the file.
-
-
-
-
- Initializes a new instance with the specified handle,
- and the maximum number of pending reads.
-
-
-
- The size of a individual read-ahead chunk.
- The maximum number of pending reads.
- The size of the file, if known; otherwise, null .
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Returns a value indicating whether the read-ahead loop should be continued.
-
-
- true if the read-ahead loop should be continued; otherwise, false .
-
-
-
-
- Exposes a around a remote SFTP file, supporting both synchronous and asynchronous read and write operations.
-
-
-
-
- Gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- Indicates whether timeout properties are usable for .
-
-
- true in all cases.
-
-
-
-
- Gets the length in bytes of the stream.
-
- A long value representing the length of the stream in bytes.
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
- IO operation failed.
-
-
-
- Gets or sets the position within the current stream.
-
- The current position within the stream.
- An I/O error occurs.
- The stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Gets the name of the path that was used to construct the current .
-
-
- The name of the path that was used to construct the current .
-
-
-
-
- Gets the operating system file handle for the file that the current encapsulates.
-
-
- The operating system file handle for the file that the current encapsulates.
-
-
-
-
- Gets or sets the operation timeout.
-
-
- The timeout.
-
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Clears all buffers for this stream and causes any buffered data to be written to the file.
-
- An I/O error occurs.
- Stream is closed.
-
-
-
- Reads a sequence of bytes from the current stream and advances the position within the stream by the
- number of bytes read.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested
- if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
-
- The sum of and is larger than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support reading.
- Methods were called after the stream was closed.
-
-
- This method attempts to read up to bytes. This either from the buffer, from the
- server (using one or more SSH_FXP_READ requests) or using a combination of both.
-
-
- The read loop is interrupted when either bytes are read, the server returns zero
- bytes (EOF) or less bytes than the read buffer size.
-
-
- When a server returns less number of bytes than the read buffer size, this may indicate that EOF has
- been reached. A subsequent (SSH_FXP_READ ) server request is necessary to make sure EOF has effectively
- been reached. Breaking out of the read loop avoids reading from the server twice to determine EOF: once in
- the read loop, and once upon the next or invocation.
-
-
-
-
-
- Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
-
-
- The unsigned byte cast to an , or -1 if at the end of the stream.
-
- The stream does not support reading.
- Methods were called after the stream was closed.
- Read operation failed.
-
-
-
- Sets the position within the current stream.
-
- A byte offset relative to the parameter.
- A value of type indicating the reference point used to obtain the new position.
-
- The new position within the current stream.
-
- An I/O error occurs.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- Sets the length of the current stream.
-
- The desired length of the current stream in bytes.
- An I/O error occurs.
- The stream does not support both writing and seeking.
- Methods were called after the stream was closed.
- must be greater than zero.
-
-
- Buffers are first flushed.
-
-
- If the specified value is less than the current length of the stream, the stream is truncated and - if the
- current position is greater than the new length - the current position is moved to the last byte of the stream.
-
-
- If the given value is greater than the current length of the stream, the stream is expanded and the current
- position remains the same.
-
-
-
-
-
- Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- An array of bytes. This method copies bytes from to the current stream.
- The zero-based byte offset in at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- The sum of and is greater than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
-
-
-
- Writes a byte to the current position in the stream and advances the position within the stream by one byte.
-
- The byte to write to the stream.
- An I/O error occurs.
- The stream does not support writing, or the stream is already closed.
- Methods were called after the stream was closed.
-
-
-
- Releases the unmanaged resources used by the and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Flushes the read data from the buffer.
-
-
-
-
- Flush any buffered write data to the file.
-
-
-
-
- Setups the read.
-
-
-
-
- Setups the write.
-
-
-
-
- Contains File system information exposed by statvfs@openssh.com request.
-
-
-
-
- Gets the file system block size.
-
-
- The file system block size.
-
-
-
-
- Gets the fundamental file system size of the block.
-
-
- The fundamental file system block size.
-
-
-
-
- Gets the total blocks.
-
-
- The total blocks.
-
-
-
-
- Gets the free blocks.
-
-
- The free blocks.
-
-
-
-
- Gets the available blocks.
-
-
- The available blocks.
-
-
-
-
- Gets the total nodes.
-
-
- The total nodes.
-
-
-
-
- Gets the free nodes.
-
-
- The free nodes.
-
-
-
-
- Gets the available nodes.
-
-
- The available nodes.
-
-
-
-
- Gets the sid.
-
-
- The sid.
-
-
-
-
- Gets a value indicating whether this instance is read only.
-
-
- true if this instance is read only; otherwise, false .
-
-
-
-
- Gets a value indicating whether [supports set uid].
-
-
- true if [supports set uid]; otherwise, false .
-
-
-
-
- Gets the max name lenght.
-
-
- The max name lenght.
-
-
-
-
- Initializes a new instance of the class.
-
- The bsize.
- The frsize.
- The blocks.
- The bfree.
- The bavail.
- The files.
- The ffree.
- The favail.
- The sid.
- The flag.
- The namemax.
-
-
-
- Encapsulates the results of an asynchronous directory list operation.
-
-
-
-
- Gets the number of files read so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- The files read.
-
-
-
- Gets the size of the message in bytes.
-
-
- The size of the messages in bytes.
-
-
-
-
- Writes the current message to the specified .
-
- The to write the message to.
-
-
-
- SSH_FXP_INIT
-
-
-
-
- SSH_FXP_VERSION
-
-
-
-
- SSH_FXP_OPEN
-
-
-
-
- SSH_FXP_CLOSE
-
-
-
-
- SSH_FXP_READ
-
-
-
-
- SSH_FXP_WRITE
-
-
-
-
- SSH_FXP_LSTAT
-
-
-
-
- SSH_FXP_FSTAT
-
-
-
-
- SSH_FXP_SETSTAT
-
-
-
-
- SSH_FXP_FSETSTAT
-
-
-
-
- SSH_FXP_OPENDIR
-
-
-
-
- SSH_FXP_READDIR
-
-
-
-
- SSH_FXP_REMOVE
-
-
-
-
- SSH_FXP_MKDIR
-
-
-
-
- SSH_FXP_RMDIR
-
-
-
-
- SSH_FXP_REALPATH
-
-
-
-
- SSH_FXP_STAT
-
-
-
-
- SSH_FXP_RENAME
-
-
-
-
- SSH_FXP_READLINK
-
-
-
-
- SSH_FXP_SYMLINK
-
-
-
-
- SSH_FXP_LINK
-
-
-
-
- SSH_FXP_BLOCK
-
-
-
-
- SSH_FXP_UNBLOCK
-
-
-
-
- SSH_FXP_STATUS
-
-
-
-
- SSH_FXP_HANDLE
-
-
-
-
- SSH_FXP_DATA
-
-
-
-
- SSH_FXP_NAME
-
-
-
-
- SSH_FXP_ATTRS
-
-
-
-
- SSH_FXP_EXTENDED
-
-
-
-
- SSH_FXP_EXTENDED_REPLY
-
-
-
-
- Gets the character encoding to use.
-
-
-
-
- Gets the remote working directory.
-
-
- The remote working directory.
-
-
-
-
- Gets the SFTP protocol version.
-
-
- The SFTP protocol version.
-
-
-
-
- Gets the next request id for sftp session.
-
-
-
-
- Changes the current working directory to the specified path.
-
- The new working directory.
-
-
-
- Resolves a given path into an absolute path on the server.
-
- The path to resolve.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_OPEN request
-
- The path.
- The flags.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous open.
-
- An that represents an asynchronous call.
-
- A array representing a file handle.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
-
-
-
- Performs SSH_FXP_CLOSE request.
-
- The handle.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous close.
-
- An that represents an asynchronous call.
- is null .
-
-
-
- Begins an asynchronous read using a SSH_FXP_READ request.
-
- The handle to the file to read from.
- The offset in the file to start reading from.
- The number of bytes to read.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous read.
-
- An that represents an asynchronous call.
-
- A array representing the data read.
-
-
- If all available data has been read, the method completes
- immediately and returns zero bytes.
-
- is null .
-
-
-
- Performs SSH_FXP_READ request.
-
- The handle.
- The offset.
- The length.
- data array; null if EOF
-
-
-
- Performs SSH_FXP_WRITE request.
-
- The handle.
- The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
- The buffer holding the data to write.
- the zero-based offset in at which to begin taking bytes to write.
- The length (in bytes) of the data to write.
- The wait event handle if needed.
- The callback to invoke when the write has completed.
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_LSTAT request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_LSTAT request.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_FSTAT request.
-
- The handle.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_SETSTAT request.
-
- The path.
- The attributes.
-
-
-
- Performs SSH_FXP_FSETSTAT request.
-
- The handle.
- The attributes.
-
-
-
- Performs SSH_FXP_OPENDIR request
-
- The path.
- if set to true returns null instead of throwing an exception.
- File handle.
-
-
-
- Performs SSH_FXP_READDIR request
-
- The handle.
-
-
-
-
- Performs SSH_FXP_REMOVE request.
-
- The path.
-
-
-
- Performs SSH_FXP_MKDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_RMDIR request.
-
- The path.
-
-
-
- Performs SSH_FXP_REALPATH request
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- The absolute path.
-
-
-
-
- Performs SSH_FXP_REALPATH request.
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous SSH_FXP_REALPATH request.
-
- An that represents an asynchronous call.
-
- The absolute path.
-
- is null .
-
-
-
- Performs SSH_FXP_STAT request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
- File attributes
-
-
-
-
- Performs SSH_FXP_STAT request
-
- The path.
- The delegate that is executed when completes.
- An object that contains any additional user-defined data.
-
- A that represents the asynchronous call.
-
-
-
-
- Handles the end of an asynchronous stat.
-
- An that represents an asynchronous call.
-
- The file attributes.
-
- is null .
-
-
-
- Performs SSH_FXP_RENAME request.
-
- The old path.
- The new path.
-
-
-
- Performs SSH_FXP_READLINK request.
-
- The path.
- if set to true returns null instead of throwing an exception.
-
-
-
-
- Performs SSH_FXP_SYMLINK request.
-
- The linkpath.
- The targetpath.
-
-
-
- Performs posix-rename@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Performs statvfs@openssh.com extended request.
-
- The path.
- if set to true [null on error].
-
-
-
-
- Performs fstatvfs@openssh.com extended request.
-
- The file handle.
- if set to true [null on error].
-
-
-
-
-
- Performs hardlink@openssh.com extended request.
-
- The old path.
- The new path.
-
-
-
- Calculates the optimal size of the buffer to read data from the channel.
-
- The buffer size configured on the client.
-
- The optimal size of the buffer to read data from the channel.
-
-
-
-
- Calculates the optimal size of the buffer to write data on the channel.
-
- The buffer size configured on the client.
- The file handle.
-
- The optimal size of the buffer to write data on the channel.
-
-
- Currently, we do not take the remote window size into account.
-
-
-
-
- Encapsulates the results of an asynchronous directory synchronization operation.
-
-
-
-
- Gets the number of files read so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- The files read.
-
-
-
- Encapsulates the results of an asynchronous upload operation.
-
-
-
-
- Gets or sets a value indicating whether to cancel asynchronous upload operation
-
-
- true if upload operation to be canceled; otherwise, false .
-
-
- Upload operation will be canceled after finishing uploading current buffer.
-
-
-
-
- Gets the number of uploaded bytes.
-
-
-
-
- Initializes a new instance of the class.
-
- The async callback.
- The state.
-
-
-
- Updates asynchronous operation status information.
-
- Number of uploaded bytes.
-
-
-
- SSH_FX_OK
-
-
-
-
- SSH_FX_EOF
-
-
-
-
- SSH_FX_NO_SUCH_FILE
-
-
-
-
- SSH_FX_PERMISSION_DENIED
-
-
-
-
- SSH_FX_FAILURE
-
-
-
-
- SSH_FX_BAD_MESSAGE
-
-
-
-
- SSH_FX_NO_CONNECTION
-
-
-
-
- SSH_FX_CONNECTION_LOST
-
-
-
-
- SSH_FX_OP_UNSUPPORTED
-
-
-
-
- SSH_FX_INVALID_HANDLE
-
-
-
-
- SSH_FX_NO_SUCH_PATH
-
-
-
-
- SSH_FX_FILE_ALREADY_EXISTS
-
-
-
-
- SSH_FX_WRITE_PROTECT
-
-
-
-
- SSH_FX_NO_MEDIA
-
-
-
-
- SSH_FX_NO_SPACE_ON_FILESYSTEM
-
-
-
-
- SSH_FX_QUOTA_EXCEEDED
-
-
-
-
- SSH_FX_UNKNOWN_PRINCIPAL
-
-
-
-
- SSH_FX_LOCK_CONFLICT
-
-
-
-
- SSH_FX_DIR_NOT_EMPTY
-
-
-
-
- SSH_FX_NOT_A_DIRECTORY
-
-
-
-
- SSH_FX_INVALID_FILENAME
-
-
-
-
- SSH_FX_LINK_LOOP
-
-
-
-
- SSH_FX_CANNOT_DELETE
-
-
-
-
- SSH_FX_INVALID_PARAMETER
-
-
-
-
- SSH_FX_FILE_IS_A_DIRECTORY
-
-
-
-
- SSH_FX_BYTE_RANGE_LOCK_CONFLICT
-
-
-
-
- SSH_FX_BYTE_RANGE_LOCK_REFUSED
-
-
-
-
- SSH_FX_DELETE_PENDING
-
-
-
-
- SSH_FX_FILE_CORRUPT
-
-
-
-
- SSH_FX_OWNER_INVALID
-
-
-
-
- SSH_FX_GROUP_INVALID
-
-
-
-
- SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK
-
-
-
-
- Represents instance of the SSH shell object
-
-
-
-
- Gets a value indicating whether this shell is started.
-
-
- true if started is started; otherwise, false .
-
-
-
-
- Occurs when shell is starting.
-
-
-
-
- Occurs when shell is started.
-
-
-
-
- Occurs when shell is stopping.
-
-
-
-
- Occurs when shell is stopped.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal modes.
- Size of the buffer for output stream.
-
-
-
- Starts this shell.
-
- Shell is started.
-
-
-
- Stops this shell.
-
- Shell is not started.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Contains operation for working with SSH Shell.
-
-
-
-
- Occurs when data was received.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Gets a value that indicates whether data is available on the to be read.
-
-
- true if data is available to be read; otherwise, false .
-
-
-
-
- Gets the number of bytes that will be written to the internal buffer.
-
-
- The number of bytes that will be written to the internal buffer.
-
-
-
-
- Initializes a new instance.
-
- The SSH session.
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The terminal mode values.
- The size of the buffer.
- The channel could not be opened.
- The pseudo-terminal request was not accepted by the server.
- The request to start a shell was not accepted by the server.
-
-
-
- Gets a value indicating whether the current stream supports reading.
-
-
- true if the stream supports reading; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
- true if the stream supports seeking; otherwise, false .
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
-
-
- true if the stream supports writing; otherwise, false .
-
-
-
-
- Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
-
- An I/O error occurs.
- Methods were called after the stream was closed.
-
-
-
- Gets the length in bytes of the stream.
-
- A long value representing the length of the stream in bytes.
- A class derived from Stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Gets or sets the position within the current stream.
-
-
- The current position within the stream.
-
- An I/O error occurs.
- The stream does not support seeking.
- Methods were called after the stream was closed.
-
-
-
- Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
-
- The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
-
- The sum of and is larger than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support reading.
- Methods were called after the stream was closed.
-
-
-
- This method is not supported.
-
- A byte offset relative to the parameter.
- A value of type indicating the reference point used to obtain the new position.
-
- The new position within the current stream.
-
- An I/O error occurs.
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- This method is not supported.
-
- The desired length of the current stream in bytes.
- An I/O error occurs.
- The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.
- Methods were called after the stream was closed.
-
-
-
- Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- An array of bytes. This method copies bytes from to the current stream.
- The zero-based byte offset in at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
- The sum of and is greater than the buffer length.
- is null .
- or is negative.
- An I/O error occurs.
- The stream does not support writing.
- Methods were called after the stream was closed.
-
-
-
- Expects the specified expression and performs action when one is found.
-
- The expected expressions and actions to perform.
-
-
-
- Expects the specified expression and performs action when one is found.
-
- Time to wait for input.
- The expected expressions and actions to perform, if the specified time elapsed and expected condition have not met, that method will exit without executing any action.
-
-
-
- Begins the expect.
-
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The callback.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The callback.
- The state.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Begins the expect.
-
- The timeout.
- The callback.
- The state.
- The expect actions.
-
- An that references the asynchronous operation.
-
-
-
-
- Ends the execute.
-
- The async result.
- Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.
-
-
-
- Expects the expression specified by text.
-
- The text to expect.
-
- Text available in the shell that ends with expected text.
-
-
-
-
- Expects the expression specified by text.
-
- The text to expect.
- Time to wait for input.
-
- The text available in the shell that ends with expected text, or null if the specified time has elapsed.
-
-
-
-
- Expects the expression specified by regular expression.
-
- The regular expression to expect.
-
- The text available in the shell that contains all the text that ends with expected expression.
-
-
-
-
- Expects the expression specified by regular expression.
-
- The regular expression to expect.
- Time to wait for input.
-
- The text available in the shell that contains all the text that ends with expected expression,
- or null if the specified time has elapsed.
-
-
-
-
- Reads the line from the shell. If line is not available it will block the execution and will wait for new line.
-
-
- The line read from the shell.
-
-
-
-
- Reads a line from the shell. If line is not available it will block the execution and will wait for new line.
-
- Time to wait for input.
-
- The line read from the shell, or null when no input is received for the specified timeout.
-
-
-
-
- Reads text available in the shell.
-
-
- The text available in the shell.
-
-
-
-
- Writes the specified text to the shell.
-
- The text to be written to the shell.
-
- If is null , nothing is written.
-
-
-
-
- Writes the line to the shell.
-
- The line to be written to the shell.
-
- If is null , only the line terminator is written.
-
-
-
-
- Releases the unmanaged resources used by the and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Provides client connection to SSH server.
-
-
-
-
- Holds the list of forwarded ports
-
-
-
-
- Holds a value indicating whether the current instance is disposed.
-
-
- true if the current instance is disposed; otherwise, false .
-
-
-
-
- Gets the list of forwarded ports.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
-
-
-
-
-
-
- is null .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication password.
- is null .
- is invalid, or is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication password.
-
-
-
- is null .
- is invalid, or is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Connection port.
- Authentication username.
- Authentication private key file(s) .
-
-
-
-
- is null .
- is invalid, -or- is null or contains only whitespace characters.
- is not within and .
-
-
-
- Initializes a new instance of the class.
-
- Connection host.
- Authentication username.
- Authentication private key file(s) .
-
-
-
-
- is null .
- is invalid, -or- is null or contains only whitespace characters.
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Initializes a new instance of the class.
-
- The connection info.
- Specified whether this instance owns the connection info.
- The factory to use for creating new services.
- is null .
- is null .
-
- If is true , then the
- connection info will be disposed when this instance is disposed.
-
-
-
-
- Called when client is disconnecting from the server.
-
-
-
-
- Adds the forwarded port.
-
- The port.
-
-
-
-
- Forwarded port is already added to a different client.
- is null .
- Client is not connected.
-
-
-
- Stops and removes the forwarded port from the list.
-
- Forwarded port.
- is null .
-
-
-
- Creates the command to be executed.
-
- The command text.
- object.
- Client is not connected.
-
-
-
- Creates the command to be executed with specified encoding.
-
- The command text.
- The encoding to use for results.
- object which uses specified encoding.
- This method will change current default encoding.
- Client is not connected.
- or is null .
-
-
-
- Creates and executes the command.
-
- The command text.
- Returns an instance of with execution results.
- This method internally uses asynchronous calls.
-
-
-
-
- CommandText property is empty.
- Invalid Operation - An existing channel was used to execute this command.
- Asynchronous operation is already in progress.
- Client is not connected.
- is null .
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
- Size of the internal read buffer.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The input.
- The output.
- The extended output.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding to use to send the input.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal mode.
- Size of the internal read buffer.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding.
- The input.
- The output.
- The extended output.
- Name of the terminal.
- The columns.
- The rows.
- The width.
- The height.
- The terminal modes.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell.
-
- The encoding.
- The input.
- The output.
- The extended output.
-
- Returns a representation of a object.
-
- Client is not connected.
-
-
-
- Creates the shell stream.
-
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The size of the buffer.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Creates the shell stream.
-
- The TERM environment variable.
- The terminal width in columns.
- The terminal width in rows.
- The terminal height in pixels.
- The terminal height in pixels.
- The size of the buffer.
- The terminal mode values.
-
- The created instance.
-
- Client is not connected.
-
-
- The TERM environment variable contains an identifier for the text window's capabilities.
- You can get a detailed list of these cababilities by using the ‘infocmp’ command.
-
-
- The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- to the drawable area of the window.
-
-
-
-
-
- Stops forwarded ports.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Represents SSH command that can be executed.
-
-
-
-
- Gets the command text.
-
-
-
-
- Gets or sets the command timeout.
-
-
- The command timeout.
-
-
-
-
-
-
-
- Gets the command exit status.
-
-
-
-
-
-
-
- Gets the output stream.
-
-
-
-
-
-
-
- Gets the extended output stream.
-
-
-
-
-
-
-
- Gets the command execution result.
-
-
-
-
-
-
-
- Gets the command execution error.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- The session.
- The command text.
- The encoding to use for the results.
- Either , is null .
-
-
-
- Begins an asynchronous command execution.
-
-
- An that represents the asynchronous command execution, which could still be pending.
-
-
-
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- An optional asynchronous callback, to be called when the command execution is complete.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- An optional asynchronous callback, to be called when the command execution is complete.
- A user-provided object that distinguishes this particular asynchronous read request from other requests.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Asynchronous operation is already in progress.
- Invalid operation.
- CommandText property is empty.
- Client is not connected.
- Operation has timed out.
- Asynchronous operation is already in progress.
- CommandText property is empty.
-
-
-
- Begins an asynchronous command execution.
-
- The command text.
- An optional asynchronous callback, to be called when the command execution is complete.
- A user-provided object that distinguishes this particular asynchronous read request from other requests.
-
- An that represents the asynchronous command execution, which could still be pending.
-
- Client is not connected.
- Operation has timed out.
-
-
-
- Waits for the pending asynchronous command execution to complete.
-
- The reference to the pending asynchronous request to finish.
- Command execution result.
-
-
-
- Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.
- is null .
-
-
-
- Executes command specified by property.
-
- Command execution result
-
-
-
-
-
- Client is not connected.
- Operation has timed out.
-
-
-
- Cancels command execution in asynchronous scenarios.
-
-
-
-
- Executes the specified command text.
-
- The command text.
- Command execution result
- Client is not connected.
- Operation has timed out.
-
-
- Command '{0}' has timed out.
- The actual command will be included in the exception message.
-
-
-
- Unsubscribes the current from channel events, and disposes
- the .
-
- The channel.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Releases unmanaged resources and performs other cleanup operations before the
- is reclaimed by garbage collection.
-
-
-
-
- Defines the highest message number that is currently supported.
-
-
-
-
- Defines the total number of supported messages.
-
-
-
-
- Disables and deactivate all messages.
-
-
-
-
- Base class for SSH subsystem implementations
-
-
-
-
- Holds the number of system wait handles that are returned as the leading entries in the array returned
- in .
-
-
-
-
- Gets or set the number of seconds to wait for an operation to complete.
-
-
- The number of seconds to wait for an operation to complete, or -1 to wait indefinitely.
-
-
-
-
- Occurs when an error occurred.
-
-
-
-
- Occurs when the server has disconnected from the session.
-
-
-
-
- Gets the channel associated with this session.
-
-
- The channel associated with this session.
-
-
-
-
- Gets a value indicating whether this session is open.
-
-
- true if this session is open; otherwise, false .
-
-
-
-
- Initializes a new instance of the SubsystemSession class.
-
- The session.
- Name of the subsystem.
- The number of milliseconds to wait for a given operation to complete, or -1 to wait indefinitely.
- or is null .
-
-
-
- Connects the subsystem using a new SSH channel session.
-
- The session is already connected.
- The method was called after the session was disposed.
- The channel session could not be opened, or the subsystem could not be executed.
-
-
-
- Disconnects the subsystem channel.
-
-
-
-
- Sends data to the subsystem.
-
- The data to be sent.
-
-
-
- Called when channel is open.
-
-
-
-
- Called when data is received.
-
- The data.
-
-
-
- Raises the error.
-
- The error.
-
-
-
- Waits a specified time for a given to get signaled.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The handle to wait for.
- To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
-
- true if received a signal within the specified timeout;
- otherwise, false .
-
- The connection was closed by the server.
- The channel was closed.
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
-
-
- Blocks the current thread until the specified gets signaled, using a
- 32-bit signed integer to specify the time interval in milliseconds.
-
- The first handle to wait for.
- The second handle to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- 0 if received a signal within the specified timeout, and 1
- if received a signal within the specified timeout.
-
- The connection was closed by the server.
- The channel was closed.
- The handle did not get signaled within the specified timeout.
-
-
- The blocking wait is also interrupted when either the established channel is closed, the current
- session is disconnected or an unexpected occurred while processing a channel
- or session event.
-
-
- When both and are signaled during the call,
- then 0 is returned.
-
-
-
-
-
- Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
- integer to specify the time interval.
-
- A array - constructed using - containing the objects to wait for.
- To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
-
- The array index of the first non-system object that satisfied the wait.
-
- The connection was closed by the server.
- The channel was closed.
- No object satified the wait and a time interval equivalent to has passed.
-
- For the return value, the index of the first non-system object is considered to be zero.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- The first to wait for.
- The second to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Creates a array that is composed of system objects and the specified
- elements.
-
- A array containing the objects to wait for.
-
- A array that is composed of system objects and the specified elements.
-
-
-
-
- Unsubscribes the current from session events.
-
- The session.
-
- Does nothing when is null .
-
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-
-
-
-
- Releases unmanaged and - optionally - managed resources
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Finalizes an instance of the class.
-
-
-
-