diff --git a/ProxySU_Core/Models/Developers/ConfigBuilder.cs b/ProxySU_Core/Models/Developers/ConfigBuilder.cs index 9088f36..5587e62 100644 --- a/ProxySU_Core/Models/Developers/ConfigBuilder.cs +++ b/ProxySU_Core/Models/Developers/ConfigBuilder.cs @@ -129,6 +129,25 @@ namespace ProxySU_Core.Models.Developers 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"); @@ -159,6 +178,16 @@ namespace ProxySU_Core.Models.Developers 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"); @@ -172,16 +201,6 @@ namespace ProxySU_Core.Models.Developers xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound)); } - 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.ShadowsocksAEAD)) { diff --git a/ProxySU_Core/Models/ShareLink.cs b/ProxySU_Core/Models/ShareLink.cs index 60a6bc0..e56adee 100644 --- a/ProxySU_Core/Models/ShareLink.cs +++ b/ProxySU_Core/Models/ShareLink.cs @@ -135,6 +135,13 @@ namespace ProxySU_Core.Models _headerType = settings.VLESS_KCP_Type; _seed = settings.VLESS_KCP_Seed; _port = settings.VLESS_KCP_Port; + _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"; diff --git a/ProxySU_Core/Models/XraySettings.cs b/ProxySU_Core/Models/XraySettings.cs index 153a978..2664d7c 100644 --- a/ProxySU_Core/Models/XraySettings.cs +++ b/ProxySU_Core/Models/XraySettings.cs @@ -17,15 +17,17 @@ namespace ProxySU_Core.Models { var guid = Guid.NewGuid().ToString(); Port = 443; - VLESS_KCP_Port = 10445; - VMESS_KCP_Port = 10443; - ShadowSocksPort = 11443; + 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_gRPC_ServiceName = "xray_gRPC"; VMESS_WS_Path = "/vmessws"; VMESS_TCP_Path = "/vmesstcp"; @@ -45,18 +47,6 @@ namespace ProxySU_Core.Models /// public int Port { get; set; } - /// - /// vless kcp端口 - /// - public int VLESS_KCP_Port { get; set; } - - /// - /// vmess kcp端口 - /// - public int VMESS_KCP_Port { get; set; } - - // ss端口 - public int ShadowSocksPort { get; set; } /// /// UUID @@ -64,6 +54,8 @@ namespace ProxySU_Core.Models public string UUID { get; set; } #region vless + + /// /// vless ws路径 /// @@ -83,6 +75,22 @@ namespace ProxySU_Core.Models /// 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 @@ -110,6 +118,11 @@ namespace ProxySU_Core.Models /// vmess kcp type /// public string VMESS_KCP_Type { get; set; } + + /// + /// vmess kcp端口 + /// + public int VMESS_KCP_Port { get; set; } #endregion #region Trojan @@ -134,6 +147,11 @@ namespace ProxySU_Core.Models /// ss method /// public string ShadowsocksMethod { get; set; } + + /// + /// ss端口 + /// + public int ShadowSocksPort { get; set; } #endregion @@ -194,6 +212,7 @@ namespace ProxySU_Core.Models VLESS_WS = 102, VLESS_H2 = 103, VLESS_KCP = 104, + VLESS_gRPC = 110, // vmess 201开头 VMESS_TCP = 201, diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj index 0ba925f..08c97c6 100644 --- a/ProxySU_Core/ProxySU_Core.csproj +++ b/ProxySU_Core/ProxySU_Core.csproj @@ -183,9 +183,18 @@ ServerInfoControl.xaml + + ShadowSocksEditorControl.xaml + + + TrojanEditorControl.xaml + VlessEditorControl.xaml + + VmessEditorControl.xaml + TerminalWindow.xaml @@ -286,6 +295,7 @@ PreserveNewest + PreserveNewest @@ -391,10 +401,22 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json new file mode 100644 index 0000000..9c71c0a --- /dev/null +++ b/ProxySU_Core/Templates/xray/server/05_inbounds/VLESS_gRPC.json @@ -0,0 +1,19 @@ +{ + "port": 2002, + "protocol": "vless", + "settings": { + "clients": [ + { + "id": "" + } + ], + "decryption": "none" + }, + "streamSettings": { + "network": "grpc", + "grpcSettings": { + "serviceName": "" + } + } +} +} diff --git a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs index b3fec33..bba9ff3 100644 --- a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs +++ b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs @@ -188,6 +188,9 @@ namespace ProxySU_Core.ViewModels } + /// + /// VMESS + /// public partial class XraySettingsViewModel { // vmess tcp @@ -267,7 +270,9 @@ namespace ProxySU_Core.ViewModels public List KcpTypes => _kcpTypes; } - + /// + /// VLESS + /// public partial class XraySettingsViewModel { @@ -345,10 +350,10 @@ namespace ProxySU_Core.ViewModels } public bool Checked_VLESS_KCP { - get => settings.Types.Contains(XrayType.VMESS_KCP); + get => settings.Types.Contains(XrayType.VLESS_KCP); set { - CheckBoxChanged(value, XrayType.VMESS_KCP); + CheckBoxChanged(value, XrayType.VLESS_KCP); Notify("Checked_VLESS_KCP"); } } @@ -356,6 +361,31 @@ namespace ProxySU_Core.ViewModels { 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/RecordEditor/RecordEditorWindow.xaml b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml index 9f2ef97..593625b 100644 --- a/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml +++ b/ProxySU_Core/Views/RecordEditor/RecordEditorWindow.xaml @@ -42,13 +42,13 @@ - + - + - + diff --git a/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml new file mode 100644 index 0000000..2b9a0de --- /dev/null +++ b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml.cs b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml.cs new file mode 100644 index 0000000..4a3dee0 --- /dev/null +++ b/ProxySU_Core/Views/RecordEditor/ShadowSocksEditorControl.xaml.cs @@ -0,0 +1,28 @@ +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 +{ + /// + /// ShadowSocksEditorControl.xaml 的交互逻辑 + /// + public partial class ShadowSocksEditorControl : UserControl + { + public ShadowSocksEditorControl() + { + InitializeComponent(); + } + } +} diff --git a/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml new file mode 100644 index 0000000..42cfd08 --- /dev/null +++ b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml.cs b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml.cs new file mode 100644 index 0000000..025a360 --- /dev/null +++ b/ProxySU_Core/Views/RecordEditor/TrojanEditorControl.xaml.cs @@ -0,0 +1,28 @@ +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 +{ + /// + /// TrojanEditorControl.xaml 的交互逻辑 + /// + public partial class TrojanEditorControl : UserControl + { + public TrojanEditorControl() + { + InitializeComponent(); + } + } +} diff --git a/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml b/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml index 64dae20..8a8bbb0 100644 --- a/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml +++ b/ProxySU_Core/Views/RecordEditor/VlessEditorControl.xaml @@ -24,6 +24,8 @@ + + @@ -49,12 +51,19 @@ Style="{StaticResource MahApps.Styles.CheckBox}" IsChecked="{Binding Path=Settings.Checked_VLESS_WS}" /> + + + @@ -125,10 +134,27 @@ - + + + + + +