From 79b6e5da43d5294b751b4672a7aeeb83ba15cf00 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Tue, 13 Oct 2020 09:45:30 +0800 Subject: [PATCH] feat: Mode.SupportSocks5Auth --- Netch/Models/Mode.cs | 9 ++++++++- Netch/Servers/Socks5/S5Controller.cs | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Netch/Models/Mode.cs b/Netch/Models/Mode.cs index 9f081164..b17c2c98 100644 --- a/Netch/Models/Mode.cs +++ b/Netch/Models/Mode.cs @@ -33,6 +33,12 @@ namespace Netch.Models /// public int Type = 0; + public bool SupportSocks5Auth => Type switch + { + 0 => false, + _ => false + }; + /// /// 绕过中国(0. 不绕过 1. 绕过) /// @@ -67,7 +73,8 @@ namespace Netch.Models if (mode == null) { Logging.Warning($"{relativePath} file included in {Remark} not found"); - }else if (mode == this) + } + else if (mode == this) { Logging.Warning("Can't self-reference"); } diff --git a/Netch/Servers/Socks5/S5Controller.cs b/Netch/Servers/Socks5/S5Controller.cs index 3b56b234..44ce714f 100644 --- a/Netch/Servers/Socks5/S5Controller.cs +++ b/Netch/Servers/Socks5/S5Controller.cs @@ -12,7 +12,8 @@ namespace Netch.Servers.Socks5 public bool Start(Server s, Mode mode) { - if (((Socks5) s).Auth()) + var server = (Socks5) s; + if (server.Auth() && !mode.SupportSocks5Auth) { File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode)); if (StartInstanceAuto("-config ..\\data\\last.json"))