diff --git a/ProxySU_Core/Models/Developers/ConfigBuilder.cs b/ProxySU_Core/Models/Developers/ConfigBuilder.cs
index 5587e62..66e5b6f 100644
--- a/ProxySU_Core/Models/Developers/ConfigBuilder.cs
+++ b/ProxySU_Core/Models/Developers/ConfigBuilder.cs
@@ -37,6 +37,8 @@ namespace ProxySU_Core.Models.Developers
public static int Trojan_TCP_Port = 1310;
public static int Trojan_WS_Port = 1311;
+ public static int FullbackPort = 8080;
+
public static dynamic LoadXrayConfig()
@@ -71,15 +73,7 @@ namespace ProxySU_Core.Models.Developers
{
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
-
- if (parameters.Port != 443)
- {
- caddyStr = caddyStr.Replace(":##port##", "");
- }
- else
- {
- caddyStr = caddyStr.Replace("##port##", 80.ToString());
- }
+ caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
{
@@ -109,7 +103,7 @@ namespace ProxySU_Core.Models.Developers
baseBound.port = parameters.Port;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
- dest = 80
+ dest = FullbackPort
}));
xrayConfig.inbounds.Add(baseBound);
baseBound.settings.clients[0].id = parameters.UUID;
@@ -129,7 +123,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
}
- if(parameters.Types.Contains(XrayType.VLESS_gRPC))
+ if (parameters.Types.Contains(XrayType.VLESS_gRPC))
{
var gRPCInBound = GetBound("VLESS_gRPC.json");
gRPCInBound.port = parameters.VLESS_gRPC_Port;
@@ -138,7 +132,7 @@ namespace ProxySU_Core.Models.Developers
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
}
- if(parameters.Types.Contains(XrayType.VLESS_KCP))
+ if (parameters.Types.Contains(XrayType.VLESS_KCP))
{
var kcpBound = GetBound("VLESS_KCP.json");
kcpBound.port = parameters.VLESS_KCP_Port;
@@ -193,6 +187,7 @@ namespace ProxySU_Core.Models.Developers
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,
diff --git a/ProxySU_Core/Models/Developers/XrayProject.cs b/ProxySU_Core/Models/Developers/XrayProject.cs
index 1a160b2..482ac4b 100644
--- a/ProxySU_Core/Models/Developers/XrayProject.cs
+++ b/ProxySU_Core/Models/Developers/XrayProject.cs
@@ -101,7 +101,7 @@ namespace ProxySU_Core.Models.Developers
}
}
- public void Uninstall()
+ public void UninstallProxy()
{
EnsureRootAuth();
WriteOutput("卸载Caddy");
@@ -149,13 +149,11 @@ namespace ProxySU_Core.Models.Developers
///
/// 重装Caddy
///
- public void ReinstallCaddy()
+ public void DoUninstallCaddy()
{
EnsureRootAuth();
- EnsureSystemEnv();
- InstallCaddy();
- UploadCaddyFile();
- WriteOutput("************ 重装Caddy完成 ************");
+ UninstallCaddy();
+ WriteOutput("************ 卸载Caddy完成 ************");
}
///
diff --git a/ProxySU_Core/Models/XraySettings.cs b/ProxySU_Core/Models/XraySettings.cs
index 69d5354..ed0efba 100644
--- a/ProxySU_Core/Models/XraySettings.cs
+++ b/ProxySU_Core/Models/XraySettings.cs
@@ -204,29 +204,4 @@ 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/Models/XrayType.cs b/ProxySU_Core/Models/XrayType.cs
new file mode 100644
index 0000000..6611113
--- /dev/null
+++ b/ProxySU_Core/Models/XrayType.cs
@@ -0,0 +1,34 @@
+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/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj
index e136d8a..9717368 100644
--- a/ProxySU_Core/ProxySU_Core.csproj
+++ b/ProxySU_Core/ProxySU_Core.csproj
@@ -89,6 +89,9 @@
..\packages\Newtonsoft.Json.12.0.3\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
@@ -96,6 +99,7 @@
+
@@ -126,6 +130,7 @@
+
diff --git a/ProxySU_Core/Templates/xray/caddy/base.caddyfile b/ProxySU_Core/Templates/xray/caddy/base.caddyfile
index e5105a3..7975d73 100644
--- a/ProxySU_Core/Templates/xray/caddy/base.caddyfile
+++ b/ProxySU_Core/Templates/xray/caddy/base.caddyfile
@@ -1,5 +1,9 @@
-##domain##:##port## {
+:##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/server/05_inbounds/Trojan_TCP.json b/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json
index 5f17571..8ea5ad9 100644
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json
+++ b/ProxySU_Core/Templates/xray/server/05_inbounds/Trojan_TCP.json
@@ -10,7 +10,7 @@
],
"fallbacks": [
{
- "dest": 80
+ "dest": 8080
}
]
},
diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json
index d223f32..9ae0b21 100644
--- a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json
+++ b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json
@@ -1,5 +1,6 @@
{
"port": 2002,
+ "listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml
index b6f62d9..701f8d7 100644
--- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml
+++ b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml
@@ -5,33 +5,43 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ProxySU_Core.Views.ClientInfo"
- xmlns:dev="clr-namespace:ProxySU_Core.Models.Developers"
+ xmlns:dev="clr-namespace:ProxySU_Core.Models.Developers"
+ xmlns:models="clr-namespace:ProxySU_Core.Models"
mc:Ignorable="d"
Title="查看配置" Height="500" Width="800">
-
+
+
+
+
+
+
-
-
+
-
+
@@ -39,41 +49,46 @@
-
-
+ -->
-
+
+ Tag="{x:Static models:XrayType.VMESS_WS}"
+ IsEnabled="{Binding Settings.Checked_VMESS_WS}"
+ Style="{StaticResource MaterialDesignNavigationRailTabItem}"
+ Header="VMESS-WebSocket-TLS">
+ Tag="{x:Static models:XrayType.VMESS_KCP}"
+ IsEnabled="{Binding Settings.Checked_VMESS_KCP}"
+ Style="{StaticResource MaterialDesignNavigationRailTabItem}"
+ Header="VMESS-mKCP">
@@ -81,9 +96,11 @@
@@ -94,9 +111,11 @@
@@ -105,5 +124,7 @@
+
+
diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs
index e1361ba..2eed951 100644
--- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs
+++ b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml.cs
@@ -1,7 +1,10 @@
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;
@@ -32,5 +35,71 @@ namespace ProxySU_Core.Views.ClientInfo
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);
+ var type = (XrayType)item.Tag;
+
+ 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;
+ }
}
}
diff --git a/ProxySU_Core/Views/MainWindow.xaml b/ProxySU_Core/Views/MainWindow.xaml
index 1423698..dab8d11 100644
--- a/ProxySU_Core/Views/MainWindow.xaml
+++ b/ProxySU_Core/Views/MainWindow.xaml
@@ -9,7 +9,7 @@
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
TextElement.FontSize="14"
- Title="ProxySU Core" Height="800" Width="1200">
+ Title="ProxySU Core" Height="670" Width="1050">
@@ -44,16 +44,18 @@
+ Padding="20">
-
-
+
-
-
+
+
-
-
+
+
@@ -144,8 +150,8 @@
-
-
+
+
diff --git a/ProxySU_Core/Views/MainWindow.xaml.cs b/ProxySU_Core/Views/MainWindow.xaml.cs
index 179c625..db8fc28 100644
--- a/ProxySU_Core/Views/MainWindow.xaml.cs
+++ b/ProxySU_Core/Views/MainWindow.xaml.cs
@@ -166,6 +166,19 @@ namespace ProxySU_Core
}
}
+ 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)
@@ -176,19 +189,6 @@ namespace ProxySU_Core
}
- 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);
- }
- }
-
- }
-
private void Connect(object sender, RoutedEventArgs e)
{
var project = DataGrid.SelectedItem as RecordViewModel;
diff --git a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml
index 593625b..17f36c8 100644
--- a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml
+++ b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml
@@ -51,186 +51,12 @@
-
-
-
+
diff --git a/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml
index 2b9a0de..71051ff 100644
--- a/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml
+++ b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml
@@ -17,47 +17,46 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml
index 42cfd08..2dfaddd 100644
--- a/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml
+++ b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml
@@ -17,29 +17,33 @@
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml
index a4c9a93..b1ab6ed 100644
--- a/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml
+++ b/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml
@@ -17,181 +17,143 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/RecordEditor/VmessEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/VmessEditorControl.xaml
index 60b8289..2a5da5d 100644
--- a/ProxySU_Core/Views/RecordEditor/VmessEditorControl.xaml
+++ b/ProxySU_Core/Views/RecordEditor/VmessEditorControl.xaml
@@ -17,152 +17,124 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml b/ProxySU_Core/Views/TerminalWindow.xaml
index fa870b8..7257ae7 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml
+++ b/ProxySU_Core/Views/TerminalWindow.xaml
@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:ProxySU_Core"
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
+ FontSize="15"
Title="主机控制台" Height="600" Width="800">
-
@@ -100,19 +101,22 @@
-
-
- Themezy
-
-
- One Page Love
-
-
- HTML5 UP
-
-
- template mo
-
+
+
+
+
+ Themezy
+
+
+ One Page Love
+
+
+ HTML5 UP
+
+
+ template mo
+
+
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml.cs b/ProxySU_Core/Views/TerminalWindow.xaml.cs
index b191556..e86cbbd 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml.cs
+++ b/ProxySU_Core/Views/TerminalWindow.xaml.cs
@@ -173,7 +173,7 @@ namespace ProxySU_Core
{
Task.Factory.StartNew(() =>
{
- project.Uninstall();
+ project.UninstallProxy();
});
}
@@ -193,11 +193,11 @@ namespace ProxySU_Core
fileDialog.ShowDialog();
}
- private void ReinstallCaddy(object sender, RoutedEventArgs e)
+ private void UninstallCaddy(object sender, RoutedEventArgs e)
{
Task.Factory.StartNew(() =>
{
- project.ReinstallCaddy();
+ project.DoUninstallCaddy();
});
}
diff --git a/ProxySU_Core/packages.config b/ProxySU_Core/packages.config
index 43548b5..003b776 100644
--- a/ProxySU_Core/packages.config
+++ b/ProxySU_Core/packages.config
@@ -7,5 +7,6 @@
+
\ No newline at end of file