From d7c1516ec29c1734042102f7d677ae0ce06cd39d Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:30:11 +0800 Subject: [PATCH] bug fix for test shadowsocks --- v2rayN/v2rayN/Global.cs | 3 ++- v2rayN/v2rayN/Handler/CoreConfigSingbox.cs | 2 +- v2rayN/v2rayN/Handler/LazyConfig.cs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index bfd07739..52e090e4 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -158,6 +158,7 @@ namespace v2rayN public static readonly List SsSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" }; public static readonly List SsSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" }; public static readonly List SsSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" }; + public static readonly List SsSecuritysInSingbox = new() { "aes-256-gcm", "aes-192-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20" }; public static readonly List Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; public static readonly List Networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" }; public static readonly List KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; @@ -172,7 +173,7 @@ namespace v2rayN public static readonly List AllowInsecures = new() { "true", "false", "" }; public static readonly List DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" }; public static readonly List Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" }; - public static readonly List Alpns = new() { "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1", "" }; + public static readonly List Alpns = new() { "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1", "" }; public static readonly List LogLevels = new() { "debug", "info", "warning", "error", "none" }; public static readonly List InboundTags = new() { "socks", "http", "socks2", "http2" }; public static readonly List RuleProtocols = new() { "http", "tls", "bittorrent" }; diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index e44ffe7e..195b1757 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -931,7 +931,7 @@ namespace v2rayN.Handler continue; } if (item.configType == EConfigType.Shadowsocks - && !Global.SsSecuritysInXray.Contains(item.security)) + && !Global.SsSecuritysInSingbox.Contains(item.security)) { continue; } diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index 0e16af1e..26d68863 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -164,15 +164,18 @@ namespace v2rayN.Handler public List GetShadowsocksSecuritys(ProfileItem profileItem) { - if (GetCoreType(profileItem, EConfigType.Shadowsocks) == ECoreType.v2fly) + var coreType = GetCoreType(profileItem, EConfigType.Shadowsocks); + switch (coreType) { - return Global.SsSecuritys; - } - if (GetCoreType(profileItem, EConfigType.Shadowsocks) == ECoreType.Xray) - { - return Global.SsSecuritysInXray; - } + case ECoreType.v2fly: + return Global.SsSecuritys; + case ECoreType.Xray: + return Global.SsSecuritysInXray; + + case ECoreType.sing_box: + return Global.SsSecuritysInSingbox; + } return Global.SsSecuritysInSagerNet; }