diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml
index 7068d8b..ce5dca3 100644
--- a/ProxySU/MainWindow.xaml
+++ b/ProxySU/MainWindow.xaml
@@ -30,12 +30,12 @@
-
+
-
+
@@ -52,9 +52,10 @@
-
-
-
+
+
+
+
diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs
index d9b08d3..48f3c0c 100644
--- a/ProxySU/MainWindow.xaml.cs
+++ b/ProxySU/MainWindow.xaml.cs
@@ -25,14 +25,23 @@ namespace ProxySU
public partial class MainWindow : Window
{
public static string[] ReceiveConfigurationParameters { get; set; }
+ //ReceiveConfigurationParameters[0]----模板类型
+ //ReceiveConfigurationParameters[1]----服务端口
+ //ReceiveConfigurationParameters[2]----uuid
+ //ReceiveConfigurationParameters[3]----path
+ //ReceiveConfigurationParameters[4]----domain
+ //ReceiveConfigurationParameters[5]----mKCP伪装类型
public MainWindow()
{
InitializeComponent();
RadioButtonPasswordLogin.IsChecked = true;
RadioButtonNoProxy.IsChecked = true;
RadioButtonProxyNoLogin.IsChecked = true;
- ReceiveConfigurationParameters = new string[5];
+ RadioButtonSocks4.Visibility = Visibility.Collapsed;
+ ReceiveConfigurationParameters = new string[6];
+
}
+ //开始布署安装
//System.Diagnostics.Process exitProgram = System.Diagnostics.Process.GetProcessById(System.Diagnostics.Process.GetCurrentProcess().Id);
private void Button_Login_Click(object sender, RoutedEventArgs e)
@@ -140,7 +149,51 @@ namespace ProxySU
//using (var client = new SshClient(sshHostName, sshPort, sshUser, sshPassword))
//Action startSetUpAction = new Action(StartSetUpRemoteHost);
//string appConfig = TextBoxJsonPath.Text.ToString().Replace("\\","\\\\");
- string appConfig = ("");
+ //读取模板配置
+ //sed -i 's/PermitRootLogin no/PermitRootLogin yes/' /etc/v2ray/config.json
+ string appConfig="";
+ if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true)
+ {
+ MessageBox.Show("请先选择配置模板!");
+ return;
+ }
+ else if (String.Equals(ReceiveConfigurationParameters[0], "TCP"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\tcp_server_config.json";
+ }
+ else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS2Web"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\WebSocketTLSWeb_server_config.json";
+ }
+ else if (String.Equals(ReceiveConfigurationParameters[0], "TCPhttp"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\tcp_http_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"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\mkcp_server_config.json";
+ }
+
+ else if (String.Equals(ReceiveConfigurationParameters[0], "HTTP2"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\HTTP2_server_config.json";
+ }
+ else if (String.Equals(ReceiveConfigurationParameters[0], "TLS"))
+ {
+ //File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
+
+ appConfig = "TemplateConfg\\TLS_server_config.json";
+ }
Task task = new Task(() => StartSetUpRemoteHost(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing, appConfig));
task.Start();
}
@@ -401,18 +454,22 @@ namespace ProxySU
//下载官方安装脚本安装
-
- client.RunCommand("curl -o /tmp/go.sh https://install.direct/go.sh");
- client.RunCommand("bash /tmp/go.sh");
- client.RunCommand("mv /etc/v2ray/config.json /etc/v2ray/config.json.1");
+ //client.RunCommand("curl -o /tmp/go.sh https://install.direct/go.sh");
+ //client.RunCommand("bash /tmp/go.sh");
+ //client.RunCommand("mv /etc/v2ray/config.json /etc/v2ray/config.json.1");
+ client.RunCommand("mkdir /etc/v2ray");
//上传配置文件
currentStatus = "程序安装完毕,配置文件上传中......";
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
Thread.Sleep(2000);
UploadConfig(connectionInfo, appConfig);
-
+ client.RunCommand("sed -i 's/##port##/" + ReceiveConfigurationParameters[1] + "/' /etc/v2ray/config.json");
+ client.RunCommand("sed -i 's/##uuid##/"+ ReceiveConfigurationParameters[2] + "/' /etc/v2ray/config.json");
+ client.RunCommand("sed -i 's/##path##/" + ReceiveConfigurationParameters[3] + "/' /etc/v2ray/config.json");
+ //client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' /etc/v2ray/config.json");
+ client.RunCommand("sed -i 's/##mkcpHeaderType##/" + ReceiveConfigurationParameters[5] + "/' /etc/v2ray/config.json");
currentStatus = "安装成功";
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
@@ -467,6 +524,7 @@ namespace ProxySU
{
sftpClient.Connect();
//MessageBox.Show("sftp信息1" + sftpClient.ConnectionInfo.ServerVersion.ToString());
+ //sftpClient.UploadFile(File.OpenRead("TemplateConfg\tcp_server_config.json"), "/etc/v2ray/config.json", true);
sftpClient.UploadFile(File.OpenRead(uploadConfig), "/etc/v2ray/config.json", true);
//MessageBox.Show("sftp信息" + sftpClient.ConnectionInfo.ServerVersion.ToString());
sftpClient.Disconnect();
@@ -600,32 +658,6 @@ namespace ProxySU
}
}
- //private void ButtonSetConfiguration_Click(object sender, RoutedEventArgs e)
- //{
- // if (RadioButtonGuideConfiguration.IsChecked == true)
- // {
- // MessageBox.Show("还未完善,敬请期待!");
- // }
- // else if (RadioButtonTemplateConfiguration.IsChecked == true)
- // {
- // var openFileDialog = new Microsoft.Win32.OpenFileDialog()
- // {
- // Filter = "Cert Files (*.json)|*.json"
- // };
- // var result = openFileDialog.ShowDialog();
- // if (result == true)
- // {
- // TextBoxJsonPath.Text = openFileDialog.FileName;
- // }
- // }
- // else
- // {
- // MessageBox.Show("还未完善,敬请期待!");
- // }
- // //MessageBox.Show(TextBoxJsonPath.Text.ToString());
- // //string appConfig = TextBoxJsonPath.Text.ToString().Replace("\\", "\\\\");
- // //MessageBox.Show(appConfig);
- //}
}
}
diff --git a/ProxySU/TemplateConfiguration.xaml b/ProxySU/TemplateConfiguration.xaml
index 9422b27..1af4b89 100644
--- a/ProxySU/TemplateConfiguration.xaml
+++ b/ProxySU/TemplateConfiguration.xaml
@@ -33,7 +33,6 @@
-
diff --git a/ProxySU/TemplateConfiguration.xaml.cs b/ProxySU/TemplateConfiguration.xaml.cs
index f2ad14c..a79fb54 100644
--- a/ProxySU/TemplateConfiguration.xaml.cs
+++ b/ProxySU/TemplateConfiguration.xaml.cs
@@ -47,32 +47,38 @@ namespace ProxySU
else if (RadioButtonMkcpNoCamouflage.IsChecked == true)
{
//传递模板类型
- MainWindow.ReceiveConfigurationParameters[0] = "MkcpNoCamouflage";
+ MainWindow.ReceiveConfigurationParameters[0] = "MkcpNone";
+ MainWindow.ReceiveConfigurationParameters[5] = "none";
}
else if (RadioButton2mKCP2SRTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
+ MainWindow.ReceiveConfigurationParameters[5] = "srtp";
}
else if (RadioButton2mKCPuTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
+ MainWindow.ReceiveConfigurationParameters[5] = "utp";
}
else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
+ MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
}
else if (RadioButton2mKCP2DTLS.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
+ MainWindow.ReceiveConfigurationParameters[5] = "dtls";
}
else if (RadioButton2mKCP2WireGuard.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
+ MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
}
else if (RadioButtonHTTP2.IsChecked == true)
{
diff --git a/ProxySU/bin/Release/ProxySU.exe b/ProxySU/bin/Release/ProxySU.exe
index 7ba497f..e286043 100644
Binary files a/ProxySU/bin/Release/ProxySU.exe and b/ProxySU/bin/Release/ProxySU.exe differ
diff --git a/ProxySU/bin/Release/Release.zip b/ProxySU/bin/Release/Release.zip
index 96e5390..bf2e814 100644
Binary files a/ProxySU/bin/Release/Release.zip and b/ProxySU/bin/Release/Release.zip differ
diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile
new file mode 100644
index 0000000..c9d7b03
--- /dev/null
+++ b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile
@@ -0,0 +1,9 @@
+##domain## {
+ root /var/www
+ tls ##email##
+ proxy / ##sites##
+ proxy ##path## localhost:10000 {
+ websocket
+ header_upstream -Origin
+ }
+}
\ No newline at end of file
diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.json
new file mode 100644
index 0000000..b323a4a
--- /dev/null
+++ b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.json
@@ -0,0 +1,29 @@
+{
+ "inbounds": [
+ {
+ "port": 10000,
+ "listen": "127.0.0.1",
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "##uuid##",
+ "alterId": 64
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "ws",
+ "wsSettings": {
+ "path": "##path##"
+ }
+ }
+ }
+ ],
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "settings": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ProxySU/bin/Release/TemplateConfg/mkcp_server_config.json b/ProxySU/bin/Release/TemplateConfg/mkcp_server_config.json
new file mode 100644
index 0000000..18805b3
--- /dev/null
+++ b/ProxySU/bin/Release/TemplateConfg/mkcp_server_config.json
@@ -0,0 +1,33 @@
+{
+ "inbounds": [
+ {
+ "port": ##port##,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "##uuid##",
+ "alterId": 64
+ }
+ ]
+ },
+ "streamSettings": {
+ "network": "mkcp",
+ "kcpSettings": {
+ "uplinkCapacity": 100,
+ "downlinkCapacity": 100,
+ "congestion": true,
+ "header": {
+ "type": "##mkcpHeaderType##"
+ }
+ }
+ }
+ }
+ ],
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "settings": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_http_server_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_http_server_config.json
new file mode 100644
index 0000000..035bac2
--- /dev/null
+++ b/ProxySU/bin/Release/TemplateConfg/tcp_http_server_config.json
@@ -0,0 +1,50 @@
+{
+ "inbounds": [
+ {
+ "port": 80,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "##uuid##",
+ "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"
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "settings": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_server_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_server_config.json
new file mode 100644
index 0000000..7244851
--- /dev/null
+++ b/ProxySU/bin/Release/TemplateConfg/tcp_server_config.json
@@ -0,0 +1,25 @@
+{
+ "inbounds": [
+
+ {
+ "port": ##port##,
+ "protocol": "vmess",
+ "settings": {
+ "clients": [
+ {
+ "id": "##uuid##",
+ "alterId": 64
+ }
+ ]
+ }
+ }
+ }
+
+ ],
+ "outbounds": [
+ {
+ "protocol": "freedom",
+ "settings": {}
+ }
+ ]
+}
\ No newline at end of file