diff --git a/ProxySuper.Core/Models/Projects/HysteriaSettings.cs b/ProxySuper.Core/Models/Projects/HysteriaSettings.cs new file mode 100644 index 0000000..4f7f9ed --- /dev/null +++ b/ProxySuper.Core/Models/Projects/HysteriaSettings.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.Models.Projects +{ + public class HysteriaSettings : IProjectSettings + { + public string Domain { get; set; } = ""; + + public string Obfs { get; set; } = ""; + + public string Email { get; set; } = ""; + + public string Protocol { get; set; } = "udp"; + + public int Port { get; set; } = 36712; + + public int UpMbps { get; set; } = 300; + + public int DownMbps { get; set; } = 300; + + public List FreePorts + { + get + { + return new List { Port }; + } + } + } +} diff --git a/ProxySuper.Core/Models/Projects/ProjectType.cs b/ProxySuper.Core/Models/Projects/ProjectType.cs index 15b3e48..ec2a37d 100644 --- a/ProxySuper.Core/Models/Projects/ProjectType.cs +++ b/ProxySuper.Core/Models/Projects/ProjectType.cs @@ -8,5 +8,6 @@ Brook = 3, V2ray = 4, MTProtoGo = 5, + Hysteria = 6, } } diff --git a/ProxySuper.Core/Models/Projects/RayType.cs b/ProxySuper.Core/Models/Projects/RayType.cs index 5f73e69..5ae31f4 100644 --- a/ProxySuper.Core/Models/Projects/RayType.cs +++ b/ProxySuper.Core/Models/Projects/RayType.cs @@ -10,6 +10,7 @@ VLESS_WS = 102, VLESS_H2 = 103, VLESS_KCP = 104, + VLESS_QUIC = 105, VLESS_gRPC = 110, // VMESS 201开头 @@ -17,6 +18,7 @@ VMESS_WS = 202, VMESS_H2 = 203, VMESS_KCP = 204, + VMESS_QUIC = 205, // Trojan 301开头 Trojan_TCP = 301, @@ -26,5 +28,5 @@ ShadowsocksAEAD = 401 } - + } diff --git a/ProxySuper.Core/Models/Projects/V2raySettings.cs b/ProxySuper.Core/Models/Projects/V2raySettings.cs index fa0bf1c..ed95c10 100644 --- a/ProxySuper.Core/Models/Projects/V2raySettings.cs +++ b/ProxySuper.Core/Models/Projects/V2raySettings.cs @@ -9,6 +9,15 @@ namespace ProxySuper.Core.Models.Projects { public partial class V2raySettings : IProjectSettings { + public static List DisguiseTypes = new List { + "none", + "srtp", + "utp", + "wechat-video", + "dtls", + "wireguard", + }; + public V2raySettings() { WithTLS = true; @@ -16,8 +25,11 @@ namespace ProxySuper.Core.Models.Projects var guid = Guid.NewGuid().ToString(); Port = 443; VLESS_KCP_Port = 2001; - VLESS_gRPC_Port = 2002; + VLESS_QUIC_Port = 2002; + VLESS_gRPC_Port = 2003; + VMESS_KCP_Port = 3001; + VMESS_QUIC_Port = 3002; ShadowSocksPort = 4001; UUID = guid; @@ -26,12 +38,19 @@ namespace ProxySuper.Core.Models.Projects VLESS_WS_Path = "/" + Utils.RandomString(6); VLESS_KCP_Type = "none"; VLESS_KCP_Seed = guid; - VLESS_gRPC_ServiceName = "/" + Utils.RandomString(7); + VLESS_QUIC_Key = ""; + VLESS_QUIC_Type = "none"; + VLESS_QUIC_Security = "none"; + VLESS_QUIC_Type = "none"; + VLESS_gRPC_ServiceName = Utils.RandomString(7); VMESS_WS_Path = "/" + Utils.RandomString(8); VMESS_TCP_Path = "/" + Utils.RandomString(9); VMESS_KCP_Seed = guid; + VMESS_QUIC_Key = ""; VMESS_KCP_Type = "none"; + VMESS_QUIC_Security = "none"; + VMESS_QUIC_Type = "none"; TrojanPassword = guid; @@ -81,8 +100,6 @@ namespace ProxySuper.Core.Models.Projects } } - //public ProjectType Type { get; set; } = ProjectType.Xray; - /// /// 是否安装证书, /// 上传自有证书时选False,则不会自动安装证书。 diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs index 945cadf..4ff476b 100644 --- a/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs +++ b/ProxySuper.Core/Models/Projects/V2raySettings_SS.cs @@ -19,6 +19,9 @@ namespace ProxySuper.Core.Models.Projects /// public int ShadowSocksPort { get; set; } + /// + /// share link + /// public string ShadowSocksShareLink { get diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs index 8bb677b..0d34927 100644 --- a/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs +++ b/ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs @@ -1,4 +1,7 @@ using ProxySuper.Core.Services; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Documents; namespace ProxySuper.Core.Models.Projects { @@ -57,6 +60,37 @@ namespace ProxySuper.Core.Models.Projects } } + /// + /// vless quic security + /// + public string VLESS_QUIC_Security { get; set; } + + /// + /// vless quic type + /// + public string VLESS_QUIC_Type { get; set; } + + /// + /// vless quic port + /// + public int VLESS_QUIC_Port { get; set; } + + /// + /// vless quic key + /// + public string VLESS_QUIC_Key { get; set; } + + /// + /// vless quic ShareLink + /// + public string VLESS_QUIC_ShareLink + { + get + { + return ShareLink.Build(RayType.VLESS_QUIC, this); + } + } + /// /// grpc port /// diff --git a/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs b/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs index d0e2e21..7475494 100644 --- a/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs +++ b/ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs @@ -61,5 +61,36 @@ namespace ProxySuper.Core.Models.Projects return ShareLink.Build(RayType.VMESS_KCP, this); } } + + /// + /// vmess quic security + /// + public string VMESS_QUIC_Security { get; set; } + + /// + /// vmess quic type + /// + public string VMESS_QUIC_Type { get; set; } + + /// + /// vmess quic port + /// + public int VMESS_QUIC_Port { get; set; } + + /// + /// vmess quic key + /// + public string VMESS_QUIC_Key { get; set; } + + /// + /// vmess quic ShareLink + /// + public string VMESS_QUIC_ShareLink + { + get + { + return ShareLink.Build(RayType.VMESS_QUIC, this); + } + } } } diff --git a/ProxySuper.Core/Models/Projects/XraySettings.cs b/ProxySuper.Core/Models/Projects/XraySettings.cs index e1ed4cc..2abc078 100644 --- a/ProxySuper.Core/Models/Projects/XraySettings.cs +++ b/ProxySuper.Core/Models/Projects/XraySettings.cs @@ -9,6 +9,13 @@ namespace ProxySuper.Core.Models.Projects { public class XraySettings : V2raySettings { + public static List FlowList = new List { "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443", "xtls-rprx-splice", "xtls-rprx-splice-udp443" }; + public static List UTLSList = new List { "", "chrome", "firefox", "safari", "randomized" }; + + public string UTLS { get; set; } = UTLSList[1]; + + public string Flow { get; set; } = FlowList[2]; + /// /// vless xtls shareLink /// diff --git a/ProxySuper.Core/Models/Record.cs b/ProxySuper.Core/Models/Record.cs index b48001e..54629f5 100644 --- a/ProxySuper.Core/Models/Record.cs +++ b/ProxySuper.Core/Models/Record.cs @@ -51,6 +51,9 @@ namespace ProxySuper.Core.Models [JsonProperty("mtProtoGoSettings")] public MTProtoGoSettings MTProtoGoSettings { get; set; } + [JsonProperty] + public HysteriaSettings HysteriaSettings { get; set; } + [JsonIgnore] public ProjectType Type @@ -67,6 +70,8 @@ namespace ProxySuper.Core.Models if (MTProtoGoSettings != null) return ProjectType.MTProtoGo; + if (HysteriaSettings != null) return ProjectType.Hysteria; + return ProjectType.Brook; } } diff --git a/ProxySuper.Core/ProxySuper.Core.csproj b/ProxySuper.Core/ProxySuper.Core.csproj index 2b7140f..5f54766 100644 --- a/ProxySuper.Core/ProxySuper.Core.csproj +++ b/ProxySuper.Core/ProxySuper.Core.csproj @@ -32,8 +32,11 @@ 4 - - ..\packages\MvvmCross.7.1.2\lib\net461\MvvmCross.dll + + ..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\MvvmCross.8.0.2\lib\net461\MvvmCross.dll False @@ -41,17 +44,31 @@ - - ..\packages\QRCoder.1.4.1\lib\net40\QRCoder.dll + + ..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll - - ..\packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll + + ..\packages\SSH.NET.2020.0.2\lib\net40\Renci.SshNet.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + ..\packages\System.Console.4.3.1\lib\net46\System.Console.dll + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + @@ -73,6 +90,7 @@ + @@ -90,6 +108,7 @@ + @@ -105,6 +124,8 @@ + + @@ -123,6 +144,7 @@ + diff --git a/ProxySuper.Core/Services/HysteriaService.cs b/ProxySuper.Core/Services/HysteriaService.cs new file mode 100644 index 0000000..3c5b48b --- /dev/null +++ b/ProxySuper.Core/Services/HysteriaService.cs @@ -0,0 +1,168 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ProxySuper.Core.Models.Hosts; +using ProxySuper.Core.Models.Projects; +using Renci.SshNet.Messages; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace ProxySuper.Core.Services +{ + public class HysteriaService : ServiceBase + { + public HysteriaService(Host host, HysteriaSettings settings) : base(host, settings) + { + } + + + public void Install() + { + try + { + Progress.Step = "安装Hysteria"; + Progress.Percentage = 0; + + + Progress.Desc = "检测系统环境"; + EnsureRootUser(); + EnsureSystemEnv(); + Progress.Percentage = 20; + + Progress.Desc = "安装必要的系统工具"; + InstallSystemTools(); + Progress.Percentage = 40; + + Progress.Desc = "配置防火墙"; + ConfigFirewalld(); + Progress.Percentage = 50; + + Progress.Step = "检测网络环境"; + EnsureNetwork(); + Progress.Percentage = 60; + + + Progress.Desc = "检测域名是否绑定本机IP"; + ValidateDomain(); + Progress.Percentage = 80; + + Progress.Step = "上传Hysteria配置文件"; + UploadConfigFile(); + Progress.Step = "安装Hysteria服务"; + InstallHysteria(); + + Progress.Percentage = 100; + Progress.Step = "安装Hysteria成功"; + Progress.Desc = "安装Hysteria成功"; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + public void Uninstall() + { + Task.Factory.StartNew(() => + { + try + { + Progress.Step = "卸载Hysteria"; + Progress.Percentage = 0; + + Progress.Desc = "停止Hysteria服务"; + RunCmd("systemctl stop Hysteria"); + RunCmd("systemctl disable Hysteria"); + Progress.Percentage = 30; + + Progress.Desc = "删除Hysteria相关文件"; + RunCmd("rm -rf /etc/systemd/system/Hysteria.service"); + RunCmd("rm -rf /usr/bin/Hysteria"); + Progress.Percentage = 80; + + Progress.Desc = "重置防火墙设置"; + ResetFirewalld(); + + Progress.Percentage = 100; + Progress.Desc = "卸载完成"; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + }); + } + + private string HysteriaServiceTemp = @" + [Unit] + Description=hysteria service + After=network.target syslog.target + Wants=network.target + + [Service] + Type=simple + ExecStart=##run_cmd## + + [Install] + WantedBy=multi-user.target"; + + private void InstallHysteria() + { + Progress.Desc = "执行Hysteria安装文件"; + string url = "https://github.com/apernet/hysteria/releases/download/v1.3.3/hysteria-linux-386"; + string targetPath = "/user/bin/hysteria/hysteria-linux-386"; + + if (ArchType == ArchType.arm) + { + url = url.Replace("hysteria-linux-386", "hysteria-linux-arm"); + targetPath = targetPath.Replace("hysteria-linux-386", "hysteria-linux-arm"); + } + + RunCmd($"curl -L {url} -o /usr/bin/hysteria"); + RunCmd("chmod +x /usr/bin/hysteria"); + + Progress.Desc = "设置Hysteria服务"; + var cmd = targetPath + " server"; + var hysteriaService = HysteriaServiceTemp.Replace("##run_cmd##", cmd); + + RunCmd("rm -rf /etc/systemd/system/hysteria.service"); + RunCmd("touch /etc/systemd/system/hysteria.service"); + + RunCmd($"echo \"{hysteriaService}\" > /etc/systemd/system/hysteria.service"); + RunCmd("sudo chmod 777 /etc/systemd/system/hysteria.service"); + + + Progress.Desc = "启动Hysteria服务"; + RunCmd("systemctl enable hysteria"); + RunCmd("systemctl restart hysteria"); + } + + private const string ConfigFilePath = @"Templates\Hysteria\config.json"; + private void UploadConfigFile() + { + var text = File.ReadAllText(ConfigFilePath, Encoding.UTF8); + var json = JsonConvert.DeserializeObject(text); + var obj = JToken.FromObject(json) as dynamic; + + + obj["listen"] = Settings.Port; + obj["acme"]["domains"][0] = Settings.Domain; + obj["email"] = Settings.Email; + obj["obfs"] = Settings.Obfs; + + var configJson = JsonConvert.SerializeObject( + obj, + Formatting.Indented, + new JsonSerializerSettings() + { + NullValueHandling = NullValueHandling.Ignore + }); + + WriteToFile(configJson, "/user/bin/hysteria/config.json"); + } + } +} diff --git a/ProxySuper.Core/Services/ShareLink.cs b/ProxySuper.Core/Services/ShareLink.cs index b892100..4edf80e 100644 --- a/ProxySuper.Core/Services/ShareLink.cs +++ b/ProxySuper.Core/Services/ShareLink.cs @@ -78,12 +78,14 @@ namespace ProxySuper.Core.Services case RayType.VLESS_TCP_XTLS: case RayType.VLESS_WS: case RayType.VLESS_KCP: + case RayType.VLESS_QUIC: case RayType.VLESS_gRPC: case RayType.Trojan_TCP: return BuildVlessShareLink(xrayType, settings); case RayType.VMESS_TCP: case RayType.VMESS_WS: case RayType.VMESS_KCP: + case RayType.VMESS_QUIC: return BuildVmessShareLink(xrayType, settings); case RayType.ShadowsocksAEAD: return BuildShadowSocksShareLink(settings); @@ -142,6 +144,15 @@ namespace ProxySuper.Core.Services vmess.path = settings.VMESS_KCP_Seed; vmess.tls = ""; break; + case RayType.VMESS_QUIC: + vmess.ps = "vmess-quic"; + vmess.port = settings.VMESS_QUIC_Port.ToString(); + vmess.net = "quic"; + vmess.type = settings.VMESS_QUIC_Type; + vmess.path = settings.VMESS_QUIC_Key; + vmess.host = settings.VMESS_QUIC_Security; + vmess.tls = "tls"; + break; default: return string.Empty; } @@ -162,8 +173,6 @@ namespace ProxySuper.Core.Services var _path = "/"; var _host = settings.Domain; var _descriptiveText = string.Empty; - var _headerType = "none"; - var _seed = string.Empty; switch (xrayType) { @@ -187,12 +196,17 @@ namespace ProxySuper.Core.Services case RayType.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 RayType.VLESS_QUIC: + _protocol = "vless"; + _port = settings.VLESS_QUIC_Port; + _type = "quic"; + _security = "tls"; + _descriptiveText = "vless-quic"; + break; case RayType.VLESS_gRPC: _protocol = "vless"; _type = "grpc"; @@ -213,18 +227,32 @@ namespace ProxySuper.Core.Services if (xrayType != RayType.Trojan_TCP) { // 4.3 传输层相关段 - parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}"; + parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}"; // kcp if (xrayType == RayType.VLESS_KCP) { - parametersURL += $"&seed={_seed}"; + parametersURL += $"&seed={settings.VLESS_KCP_Seed}&headerType={settings.VLESS_KCP_Type}"; + } + + if (xrayType == RayType.VLESS_QUIC) + { + parametersURL += $"&quicSecurity={settings.VLESS_QUIC_Security}"; + if (settings.VLESS_QUIC_Security != "none") + { + parametersURL += $"&key={HttpUtility.UrlEncode(settings.VLESS_QUIC_Key)}"; + } + parametersURL += $"&headerType={settings.VLESS_QUIC_Type}"; } // 4.4 TLS 相关段 - if (xrayType == RayType.VLESS_TCP_XTLS) + if (settings is XraySettings) { - parametersURL += "&flow=xtls-rprx-direct"; + if (xrayType == RayType.VLESS_TCP_XTLS) + { + var xraySettings = settings as XraySettings; + parametersURL += $"&flow={xraySettings.Flow}"; + } } diff --git a/ProxySuper.Core/Services/V2rayConfigBuilder.cs b/ProxySuper.Core/Services/V2rayConfigBuilder.cs index c450b5f..9a54e55 100644 --- a/ProxySuper.Core/Services/V2rayConfigBuilder.cs +++ b/ProxySuper.Core/Services/V2rayConfigBuilder.cs @@ -187,6 +187,7 @@ namespace ProxySuper.Core.Services } #endregion + #region VLESS GRPC if (parameters.Types.Contains(RayType.VLESS_gRPC)) { var gRPCInBound = GetBound("VLESS_gRPC.json"); @@ -196,7 +197,9 @@ namespace ProxySuper.Core.Services gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain; xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound)); } + #endregion + #region VLESS KCP if (parameters.Types.Contains(RayType.VLESS_KCP)) { var kcpBound = GetBound("VLESS_KCP.json"); @@ -206,7 +209,22 @@ namespace ProxySuper.Core.Services kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed; xrayConfig.inbounds.Add(JToken.FromObject(kcpBound)); } + #endregion + #region VLESS QUIC + if (parameters.Types.Contains(RayType.VLESS_QUIC)) + { + var quicBound = GetBound("VLESS_QUIC.json"); + quicBound.port = parameters.VLESS_QUIC_Port; + SetClients(quicBound, uuidList); + quicBound.streamSettings.quicSettings.security = parameters.VLESS_QUIC_Security; + quicBound.streamSettings.quicSettings.key = parameters.VLESS_QUIC_Key; + quicBound.streamSettings.quicSettings.header.type = parameters.VLESS_QUIC_Type; + xrayConfig.inbounds.Add(JToken.FromObject(quicBound)); + } + #endregion + + #region VMESS KCP if (parameters.Types.Contains(RayType.VMESS_KCP)) { var kcpBound = GetBound("VMESS_KCP.json"); @@ -216,7 +234,22 @@ namespace ProxySuper.Core.Services kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed; xrayConfig.inbounds.Add(JToken.FromObject(kcpBound)); } + #endregion + #region VMESS QUIC + if (parameters.Types.Contains(RayType.VMESS_QUIC)) + { + var quicBound = GetBound("VMESS_QUIC.json"); + quicBound.port = parameters.VMESS_QUIC_Port; + SetClients(quicBound, uuidList); + quicBound.streamSettings.quicSettings.security = parameters.VMESS_QUIC_Security; + quicBound.streamSettings.quicSettings.key = parameters.VMESS_QUIC_Key; + quicBound.streamSettings.quicSettings.header.type = parameters.VMESS_QUIC_Type; + xrayConfig.inbounds.Add(JToken.FromObject(quicBound)); + } + #endregion + + #region Shadowsocks if (parameters.Types.Contains(RayType.ShadowsocksAEAD)) { var ssBound = GetBound("Shadowsocks-AEAD.json"); @@ -225,6 +258,7 @@ namespace ProxySuper.Core.Services ssBound.settings.method = parameters.ShadowSocksMethod; xrayConfig.inbounds.Add(JToken.FromObject(ssBound)); } + #endregion return JsonConvert.SerializeObject( xrayConfig, diff --git a/ProxySuper.Core/Services/XrayConfigBuilder.cs b/ProxySuper.Core/Services/XrayConfigBuilder.cs index 752fdef..83fd110 100644 --- a/ProxySuper.Core/Services/XrayConfigBuilder.cs +++ b/ProxySuper.Core/Services/XrayConfigBuilder.cs @@ -91,7 +91,7 @@ namespace ProxySuper.Core.Services return caddyStr; } - private static void SetClients(dynamic bound, List uuidList, bool withXtls = false) + private static void SetClients(dynamic bound, List uuidList, bool withXtls = false, string flow = "") { bound.settings.clients.Clear(); uuidList.ForEach(id => @@ -103,14 +103,13 @@ namespace ProxySuper.Core.Services } else { - obj = new { id = id, flow = "xtls-rprx-direct" }; + obj = new { id = id, flow = flow }; } bound.settings.clients.Add(JToken.FromObject(obj)); }); } - public static string BuildXrayConfig(XraySettings parameters) { var uuidList = new List(); @@ -126,7 +125,7 @@ namespace ProxySuper.Core.Services dest = FullbackPort })); xrayConfig.inbounds.Add(baseBound); - SetClients(baseBound, uuidList, withXtls: true); + SetClients(baseBound, uuidList, withXtls: true, flow: parameters.Flow); #region Fullbacks @@ -190,6 +189,7 @@ namespace ProxySuper.Core.Services } #endregion + #region VLESS GRPC if (parameters.Types.Contains(RayType.VLESS_gRPC)) { var gRPCInBound = GetBound("VLESS_gRPC.json"); @@ -199,7 +199,9 @@ namespace ProxySuper.Core.Services gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain; xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound)); } + #endregion + #region VLESS KCP if (parameters.Types.Contains(RayType.VLESS_KCP)) { var kcpBound = GetBound("VLESS_KCP.json"); @@ -209,7 +211,22 @@ namespace ProxySuper.Core.Services kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed; xrayConfig.inbounds.Add(JToken.FromObject(kcpBound)); } + #endregion + #region VLESS QUIC + if (parameters.Types.Contains(RayType.VLESS_QUIC)) + { + var quicBound = GetBound("VLESS_QUIC.json"); + quicBound.port = parameters.VLESS_QUIC_Port; + SetClients(quicBound, uuidList); + quicBound.streamSettings.quicSettings.security = parameters.VLESS_QUIC_Security; + quicBound.streamSettings.quicSettings.key = parameters.VLESS_QUIC_Key; + quicBound.streamSettings.quicSettings.header.type = parameters.VLESS_QUIC_Type; + xrayConfig.inbounds.Add(JToken.FromObject(quicBound)); + } + #endregion + + #region VMESS KCP if (parameters.Types.Contains(RayType.VMESS_KCP)) { var kcpBound = GetBound("VMESS_KCP.json"); @@ -219,7 +236,22 @@ namespace ProxySuper.Core.Services kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed; xrayConfig.inbounds.Add(JToken.FromObject(kcpBound)); } + #endregion + #region VMESS QUIC + if (parameters.Types.Contains(RayType.VMESS_QUIC)) + { + var quicBound = GetBound("VMESS_QUIC.json"); + quicBound.port = parameters.VMESS_QUIC_Port; + SetClients(quicBound, uuidList); + quicBound.streamSettings.quicSettings.security = parameters.VMESS_QUIC_Security; + quicBound.streamSettings.quicSettings.key = parameters.VMESS_QUIC_Key; + quicBound.streamSettings.quicSettings.header.type = parameters.VMESS_QUIC_Type; + xrayConfig.inbounds.Add(JToken.FromObject(quicBound)); + } + #endregion + + #region Shadowsocks if (parameters.Types.Contains(RayType.ShadowsocksAEAD)) { var ssBound = GetBound("Shadowsocks-AEAD.json"); @@ -228,6 +260,7 @@ namespace ProxySuper.Core.Services ssBound.settings.method = parameters.ShadowSocksMethod; xrayConfig.inbounds.Add(JToken.FromObject(ssBound)); } + #endregion return JsonConvert.SerializeObject( xrayConfig, diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs index 2ba60a8..5c5c1ec 100644 --- a/ProxySuper.Core/ViewModels/HomeViewModel.cs +++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs @@ -108,6 +108,8 @@ namespace ProxySuper.Core.ViewModels public IMvxCommand AddBrookCommand => new MvxAsyncCommand(AddBrookRecord); + public IMvxCommand AddHysteriaCommand => new MvxAsyncCommand(AddHysteriaRecord); + public IMvxCommand RemoveCommand => new MvxAsyncCommand(DeleteRecord); public IMvxCommand EditCommand => new MvxAsyncCommand(EditRecord); @@ -204,6 +206,21 @@ namespace ProxySuper.Core.ViewModels SaveToJson(); } + public async Task AddHysteriaRecord() + { + Record record = new Record(); + record.Id = Utils.GetTickID(); + record.Host = new Host(); + record.HysteriaSettings = new HysteriaSettings(); + + var result = await _navigationService.Navigate(record); + if (result == null) return; + + Records.Add(result); + + SaveToJson(); + } + public async Task EditRecord(string id) { diff --git a/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs b/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs new file mode 100644 index 0000000..7bd40c4 --- /dev/null +++ b/ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs @@ -0,0 +1,68 @@ +using MvvmCross.Commands; +using MvvmCross.Navigation; +using MvvmCross.ViewModels; +using ProxySuper.Core.Models; +using ProxySuper.Core.Models.Hosts; +using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Navigation; + +namespace ProxySuper.Core.ViewModels +{ + public class HysteriaEditorViewModel : MvxViewModel + { + public string Id { get; set; } + + public Host Host { get; set; } + + public HysteriaSettings Settings { get; set; } + + public IMvxNavigationService NavigationService { get; } + + public IMvxCommand SaveCommand => new MvxCommand(() => Save()); + + public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall); + + public HysteriaEditorViewModel(IMvxNavigationService mvxNavigationService) + { + NavigationService = mvxNavigationService; + } + + public override void Prepare(Record parameter) + { + var record = Utils.DeepClone(parameter); + + Id = record.Id; + Host = record.Host; + Settings = record.HysteriaSettings; + } + + public void Save() + { + NavigationService.Close(this, new Record + { + Id = Id, + Host = Host, + HysteriaSettings = Settings, + }); + } + + public void SaveAndInstall() + { + var record = new Record + { + Id = Id, + Host = Host, + HysteriaSettings = Settings, + }; + + NavigationService.Close(this, record); + NavigationService.Navigate(record); + } + } +} diff --git a/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs b/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs new file mode 100644 index 0000000..3977e0d --- /dev/null +++ b/ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs @@ -0,0 +1,66 @@ +using MvvmCross.Commands; +using MvvmCross.ViewModels; +using ProxySuper.Core.Models; +using ProxySuper.Core.Models.Hosts; +using ProxySuper.Core.Models.Projects; +using ProxySuper.Core.Services; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySuper.Core.ViewModels +{ + public class HysteriaInstallViewModel : MvxViewModel + { + public Host _host { get; set; } + + public HysteriaSettings _settings { get; set; } + + public HysteriaService _service { get; set; } + + public override void Prepare(Record parameter) + { + _host = parameter.Host; + _settings = parameter.HysteriaSettings; + } + + public override Task Initialize() + { + _service = new HysteriaService(_host, _settings); + _service.Progress.StepUpdate = () => RaisePropertyChanged("Progress"); + _service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs"); + _service.Connect(); + return base.Initialize(); + } + + public override void ViewDestroy(bool viewFinishing = true) + { + _service.Disconnect(); + this.SaveInstallLog(); + base.ViewDestroy(viewFinishing); + } + + public ProjectProgress Progress => _service.Progress; + + public string Logs => _service.Progress.Logs; + + public IMvxCommand InstallCommand => new MvxCommand(_service.Install); + + public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall); + + + private void SaveInstallLog() + { + if (!Directory.Exists("Logs")) + { + Directory.CreateDirectory("Logs"); + } + + var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".hysteria.txt"); + File.WriteAllText(fileName, Logs); + } + } +} diff --git a/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs b/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs index f381366..6dc287d 100644 --- a/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs +++ b/ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs @@ -42,6 +42,14 @@ namespace ProxySuper.Core.ViewModels } } + public bool Checked_VLESS_QUIC + { + get + { + return Settings.Types.Contains(RayType.VLESS_QUIC); + } + } + public bool Checked_VLESS_gRPC { get @@ -74,6 +82,14 @@ namespace ProxySuper.Core.ViewModels } } + public bool Checked_VMESS_QUIC + { + get + { + return Settings.Types.Contains(RayType.VMESS_QUIC); + } + } + public bool Checked_Trojan_TCP { get diff --git a/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs b/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs index dc490d9..f0d0181 100644 --- a/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs +++ b/ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs @@ -64,12 +64,34 @@ namespace ProxySuper.Core.ViewModels } } - - - - public partial class V2rayEditorViewModel { + public List KcpTypes => V2raySettings.DisguiseTypes; + + public List QuicTypes => V2raySettings.DisguiseTypes; + + /// + /// https://www.v2ray.com/chapter_02/transport/quic.html + /// + public List QuicSecurities => new List { + "none", + "aes-128-gcm", + "chacha20-poly1305" + }; + + /// + /// https://www.v2ray.com/chapter_02/protocols/shadowsocks.html + /// + public List ShadowSocksMethods => new List { + "aes-256-cfb", + "aes-128-cfb", + "chacha20", + "chacha20-ietf", + "aes-256-gcm", + "aes-128-gcm", + "chacha20-poly1305" + }; + public IMvxCommand RandomUuid => new MvxCommand(() => GetUuid()); public bool WithTLS @@ -112,17 +134,6 @@ namespace ProxySuper.Core.ViewModels } } - public int ShadowSocksPort - { - get => Settings.ShadowSocksPort; - set - { - Settings.ShadowSocksPort = value; - RaisePropertyChanged("ShadowSocksPort"); - } - } - - public string UUID { get => Settings.UUID; @@ -166,12 +177,12 @@ namespace ProxySuper.Core.ViewModels } } + #region Torjan public string TrojanPassword { get => Settings.TrojanPassword; set => Settings.TrojanPassword = value; } - public bool Checked_Trojan_TCP { get @@ -196,9 +207,18 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.Trojan_TCP, Settings); } + #endregion - private List _ssMethods = new List { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" }; - public List ShadowSocksMethods => _ssMethods; + #region ShadowSocks + public int ShadowSocksPort + { + get => Settings.ShadowSocksPort; + set + { + Settings.ShadowSocksPort = value; + RaisePropertyChanged("ShadowSocksPort"); + } + } public bool CheckedShadowSocks { @@ -209,6 +229,7 @@ namespace ProxySuper.Core.ViewModels RaisePropertyChanged("CheckedShadowSocks"); } } + public string ShadowSocksPassword { get => Settings.ShadowSocksPassword; @@ -230,6 +251,7 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.ShadowsocksAEAD, Settings); } + #endregion private void CheckBoxChanged(bool value, RayType type) @@ -258,11 +280,11 @@ namespace ProxySuper.Core.ViewModels } /// - /// VMESS + /// VMESS SETTINGS /// public partial class V2rayEditorViewModel { - // vmess tcp + #region VMESS TCP public bool Checked_VMESS_TCP { get => Settings.Types.Contains(RayType.VMESS_TCP); @@ -281,8 +303,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_TCP, Settings); } + #endregion - // vmess ws + #region VMESS WS public bool Checked_VMESS_WS { get => Settings.Types.Contains(RayType.VMESS_WS); @@ -301,8 +324,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_WS, Settings); } + #endregion - // vmess kcp + #region VMESS KCP public string VMESS_KCP_Seed { get => Settings.VMESS_KCP_Seed; @@ -333,18 +357,69 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_KCP, Settings); } + #endregion + #region VMESS QUIC + public bool Checked_VMESS_QUIC + { + get => Settings.Types.Contains(RayType.VMESS_QUIC); + set + { + CheckBoxChanged(value, RayType.VMESS_QUIC); + RaisePropertyChanged(nameof(Checked_VMESS_QUIC)); + } + } + public string VMESS_QUIC_Key + { + get => Settings.VMESS_QUIC_Key; + set + { + Settings.VMESS_QUIC_Key = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Key)); + } + } + public string VMESS_QUIC_Security + { + get => Settings.VMESS_QUIC_Security; + set + { + Settings.VMESS_QUIC_Security = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Security)); + } + } + public string VMESS_QUIC_Type + { + get => Settings.VMESS_QUIC_Type; + set + { + Settings.VMESS_QUIC_Type = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Type)); + } + } + public int VMESS_QUIC_Port + { + get => Settings.VMESS_QUIC_Port; + set + { + Settings.VMESS_QUIC_Port = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Port)); + } + } + public string VMESS_QUIC_ShareLink + { + get => ShareLink.Build(RayType.VMESS_QUIC, Settings); + } + #endregion - private List _kcpTypes = new List { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard", }; - public List KcpTypes => _kcpTypes; } + /// - /// VLESS + /// VLESS SETTINGS /// public partial class V2rayEditorViewModel { - // vless tcp + #region VLESS TCP public bool Checked_VLESS_TCP { get => Settings.Types.Contains(RayType.VLESS_TCP); @@ -358,9 +433,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_TCP, Settings); } + #endregion - - // vless ws + #region VLESS WS public string VLESS_WS_Path { get => Settings.VLESS_WS_Path; @@ -382,8 +457,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_WS, Settings); } + #endregion - // vless kcp + #region VLESS KCP public string VLESS_KCP_Seed { get => Settings.VLESS_KCP_Seed; @@ -414,8 +490,60 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_KCP, Settings); } + #endregion - // vless grpc + #region VLESS QUIC + public bool Checked_VLESS_QUIC + { + get => Settings.Types.Contains(RayType.VLESS_QUIC); + set + { + CheckBoxChanged(value, RayType.VLESS_QUIC); + RaisePropertyChanged(nameof(Checked_VLESS_QUIC)); + } + } + public string VLESS_QUIC_Key + { + get => Settings.VLESS_QUIC_Key; set + { + Settings.VLESS_QUIC_Key = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Key)); + } + } + public string VLESS_QUIC_Security + { + get => Settings.VLESS_QUIC_Security; + set + { + Settings.VLESS_QUIC_Security = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Security)); + } + } + public string VLESS_QUIC_Type + { + get => Settings.VLESS_QUIC_Type; + set + { + Settings.VLESS_QUIC_Type = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Type)); + } + } + public int VLESS_QUIC_Port + { + get => Settings.VLESS_QUIC_Port; + set + { + Settings.VLESS_QUIC_Port = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Port)); + } + } + public string VLESS_QUIC_ShareLink + { + get => ShareLink.Build(RayType.VLESS_QUIC, Settings); + } + #endregion + + #region VLESS gRPC public string VLESS_gRPC_ServiceName { get => Settings.VLESS_gRPC_ServiceName; @@ -439,5 +567,6 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_gRPC, Settings); } + #endregion } } diff --git a/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs index 57d19aa..7d25e5e 100644 --- a/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs +++ b/ProxySuper.Core/ViewModels/XrayConfigViewModel.cs @@ -13,6 +13,16 @@ namespace ProxySuper.Core.ViewModels Settings = parameter; } + public string Flow + { + get { return Settings.Flow; } + } + + public string UTLS + { + get { return Settings.UTLS; } + } + public bool Checked_VLESS_TCP_XTLS { get @@ -45,6 +55,14 @@ namespace ProxySuper.Core.ViewModels } } + public bool Checked_VLESS_QUIC + { + get + { + return Settings.Types.Contains(RayType.VLESS_QUIC); + } + } + public bool Checked_VLESS_gRPC { get @@ -77,6 +95,14 @@ namespace ProxySuper.Core.ViewModels } } + public bool Checked_VMESS_QUIC + { + get + { + return Settings.Types.Contains(RayType.VMESS_QUIC); + } + } + public bool Checked_Trojan_TCP { get diff --git a/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs b/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs index d9c281d..963dc91 100644 --- a/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs +++ b/ProxySuper.Core/ViewModels/XrayEditorViewModel.cs @@ -65,6 +65,30 @@ namespace ProxySuper.Core.ViewModels public partial class XrayEditorViewModel { + public List UTLSList { get => XraySettings.UTLSList; } + + public List KcpTypes => V2raySettings.DisguiseTypes; + + public List QuicTypes => V2raySettings.DisguiseTypes; + + public List QuicSecurities => new List + { + "none", + "aes-128-gcm", + "chacha20-poly1305" + }; + + public List ShadowSocksMethods => new List + { + "2022-blake3-aes-128-gcm", + "2022-blake3-aes-256-gcm", + "2022-blake3-chacha20-poly1305", + "aes-256-gcm", + "aes-128-gcm", + "chacha20-poly1305", + "none" + }; + public IMvxCommand RandomUuid => new MvxCommand(() => GetUuid()); public bool WithTLS @@ -87,6 +111,17 @@ namespace ProxySuper.Core.ViewModels } } + + public string UTLS + { + get => Settings.UTLS; + set + { + Settings.UTLS = value; + RaisePropertyChanged(nameof(UTLS)); + } + } + public int VLESS_KCP_Port { get => Settings.VLESS_KCP_Port; @@ -107,17 +142,6 @@ namespace ProxySuper.Core.ViewModels } } - public int ShadowSocksPort - { - get => Settings.ShadowSocksPort; - set - { - Settings.ShadowSocksPort = value; - RaisePropertyChanged("ShadowSocksPort"); - } - } - - public string UUID { get => Settings.UUID; @@ -161,6 +185,7 @@ namespace ProxySuper.Core.ViewModels } } + #region Trojan public string TrojanPassword { get => Settings.TrojanPassword; @@ -191,9 +216,18 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.Trojan_TCP, Settings); } + #endregion - private List _ssMethods = new List { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" }; - public List ShadowSocksMethods => _ssMethods; + #region ShadowSocks + public int ShadowSocksPort + { + get => Settings.ShadowSocksPort; + set + { + Settings.ShadowSocksPort = value; + RaisePropertyChanged("ShadowSocksPort"); + } + } public bool CheckedShadowSocks { @@ -225,7 +259,7 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.ShadowsocksAEAD, Settings); } - + #endregion private void CheckBoxChanged(bool value, RayType type) { @@ -242,8 +276,6 @@ namespace ProxySuper.Core.ViewModels } } - - private void GetUuid() { UUID = Guid.NewGuid().ToString(); @@ -257,7 +289,7 @@ namespace ProxySuper.Core.ViewModels /// public partial class XrayEditorViewModel { - // vmess tcp + #region VMESS TCP public bool Checked_VMESS_TCP { get => Settings.Types.Contains(RayType.VMESS_TCP); @@ -276,8 +308,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_TCP, Settings); } + #endregion - // vmess ws + #region VMESS WS public bool Checked_VMESS_WS { get => Settings.Types.Contains(RayType.VMESS_WS); @@ -296,8 +329,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_WS, Settings); } + #endregion - // vmess kcp + #region VMESS KCP public string VMESS_KCP_Seed { get => Settings.VMESS_KCP_Seed; @@ -328,10 +362,60 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VMESS_KCP, Settings); } + #endregion + #region VMESS QUIC + public bool Checked_VMESS_QUIC + { + get => Settings.Types.Contains(RayType.VMESS_QUIC); + set + { + CheckBoxChanged(value, RayType.VMESS_QUIC); + RaisePropertyChanged(nameof(Checked_VMESS_QUIC)); + } + } + public string VMESS_QUIC_Key + { + get => Settings.VMESS_QUIC_Key; + set + { + Settings.VMESS_QUIC_Key = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Key)); + } + } + public string VMESS_QUIC_Security + { + get => Settings.VMESS_QUIC_Security; + set + { + Settings.VMESS_QUIC_Security = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Security)); + } + } + public string VMESS_QUIC_Type + { + get => Settings.VMESS_QUIC_Type; + set + { + Settings.VMESS_QUIC_Type = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Type)); + } + } + public int VMESS_QUIC_Port + { + get => Settings.VMESS_QUIC_Port; + set + { + Settings.VMESS_QUIC_Port = value; + RaisePropertyChanged(nameof(VMESS_QUIC_Port)); + } + } + public string VMESS_QUIC_ShareLink + { + get => ShareLink.Build(RayType.VMESS_QUIC, Settings); + } + #endregion - private List _kcpTypes = new List { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard", }; - public List KcpTypes => _kcpTypes; } /// @@ -339,8 +423,19 @@ namespace ProxySuper.Core.ViewModels /// public partial class XrayEditorViewModel { + #region VLESS XTLS - // vless xtls + public List FlowList { get => XraySettings.FlowList; } + + public string Flow + { + get => Settings.Flow; + set + { + Settings.Flow = value; + RaisePropertyChanged(nameof(Flow)); + } + } public bool Checked_VLESS_TCP_XTLS { get => Settings.Types.Contains(RayType.VLESS_TCP_XTLS); @@ -354,8 +449,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_TCP_XTLS, Settings); } + #endregion - // vless tcp + #region VLESS TCP public bool Checked_VLESS_TCP { get => Settings.Types.Contains(RayType.VLESS_TCP); @@ -369,9 +465,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_TCP, Settings); } + #endregion - - // vless ws + #region VLESS WS public string VLESS_WS_Path { get => Settings.VLESS_WS_Path; @@ -393,12 +489,68 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_WS, Settings); } + #endregion - // vless kcp + #region VLESS QUIC + public string VLESS_QUIC_Key + { + get => Settings.VLESS_QUIC_Key; set + { + Settings.VLESS_QUIC_Key = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Key)); + } + } + public bool Checked_VLESS_QUIC + { + get => Settings.Types.Contains(RayType.VLESS_QUIC); + set + { + CheckBoxChanged(value, RayType.VLESS_QUIC); + RaisePropertyChanged(nameof(Checked_VLESS_QUIC)); + } + } + public string VLESS_QUIC_Security + { + get => Settings.VLESS_QUIC_Security; + set + { + Settings.VLESS_QUIC_Security = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Security)); + } + } + public string VLESS_QUIC_Type + { + get => Settings.VLESS_QUIC_Type; + set + { + Settings.VLESS_QUIC_Type = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Type)); + } + } + public int VLESS_QUIC_Port + { + get => Settings.VLESS_QUIC_Port; + set + { + Settings.VLESS_QUIC_Port = value; + RaisePropertyChanged(nameof(VLESS_QUIC_Port)); + } + } + public string VLESS_QUIC_ShareLink + { + get => ShareLink.Build(RayType.VLESS_QUIC, Settings); + } + #endregion + + #region VLESS KCP public string VLESS_KCP_Seed { get => Settings.VLESS_KCP_Seed; - set => Settings.VLESS_KCP_Seed = value; + set + { + Settings.VLESS_KCP_Seed = value; + RaisePropertyChanged(nameof(VLESS_KCP_Seed)); + } } public string VLESS_KCP_Type { @@ -425,8 +577,9 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_KCP, Settings); } + #endregion - // vless grpc + #region VLESS gRPC public string VLESS_gRPC_ServiceName { get => Settings.VLESS_gRPC_ServiceName; @@ -450,6 +603,7 @@ namespace ProxySuper.Core.ViewModels { get => ShareLink.Build(RayType.VLESS_gRPC, Settings); } + #endregion } } diff --git a/ProxySuper.Core/app.config b/ProxySuper.Core/app.config new file mode 100644 index 0000000..0703d68 --- /dev/null +++ b/ProxySuper.Core/app.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ProxySuper.Core/packages.config b/ProxySuper.Core/packages.config index 7880216..3943ce6 100644 --- a/ProxySuper.Core/packages.config +++ b/ProxySuper.Core/packages.config @@ -1,7 +1,12 @@  - - - + + + + + + + + \ No newline at end of file diff --git a/ProxySuper.WPF/App.config b/ProxySuper.WPF/App.config index ecdcf8a..66da88e 100644 --- a/ProxySuper.WPF/App.config +++ b/ProxySuper.WPF/App.config @@ -1,6 +1,18 @@ - + - + + + + + + + + + + + + + diff --git a/ProxySuper.WPF/App.xaml b/ProxySuper.WPF/App.xaml index 1a171b3..ff48f9e 100644 --- a/ProxySuper.WPF/App.xaml +++ b/ProxySuper.WPF/App.xaml @@ -6,6 +6,7 @@ xmlns:ui="http://schemas.modernwpf.com/2019" StartupUri="MainWindow.xaml"> + diff --git a/ProxySuper.WPF/App.xaml.cs b/ProxySuper.WPF/App.xaml.cs index 52c5e57..1eb4bc6 100644 --- a/ProxySuper.WPF/App.xaml.cs +++ b/ProxySuper.WPF/App.xaml.cs @@ -11,7 +11,7 @@ namespace ProxySuper.WPF { protected override void RegisterSetup() { - this.RegisterSetupType>(); + this.RegisterSetupType(); } } } diff --git a/ProxySuper.WPF/Controls/V2raySettingsControl.xaml b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml index 5c63f27..3043116 100644 --- a/ProxySuper.WPF/Controls/V2raySettingsControl.xaml +++ b/ProxySuper.WPF/Controls/V2raySettingsControl.xaml @@ -11,322 +11,462 @@ - - - - - + + + + + + + + + - - - + + + - - - + + + - - - + + + - - + + + + + - - - + + + + + - - - + + + - - - + + + + + - - - + + + + + - + + + + + + + - - - - - - - - - - - - - - - -