From ba058e4e4b4d2d3856a0ab190fa45a3e58738ce2 Mon Sep 17 00:00:00 2001 From: Howard Cheung Date: Tue, 23 Mar 2021 14:23:18 +0800 Subject: [PATCH] Add dummy cipher for ShadowsocksR nodes in Clash (#312) * dummy cipher for ssr in clash * remove unnecessary "dummy" * clash ssr with dummy cipher as source --- src/speedtestutil.cpp | 1 + src/subexport.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/speedtestutil.cpp b/src/speedtestutil.cpp index 7979891..0970476 100644 --- a/src/speedtestutil.cpp +++ b/src/speedtestutil.cpp @@ -1081,6 +1081,7 @@ void explodeClash(Node yamlnode, const std::string &custom_port, std::vector>= cipher; + if (cipher == "dummy") cipher = "none"; singleproxy["password"] >>= password; singleproxy["protocol"] >>= protocol; singleproxy["obfs"] >>= obfs; diff --git a/src/subexport.cpp b/src/subexport.cpp index bee5d6a..90b10fb 100644 --- a/src/subexport.cpp +++ b/src/subexport.cpp @@ -31,7 +31,7 @@ extern size_t gMaxAllowedRules; const string_array clashr_protocols = {"origin", "auth_sha1_v4", "auth_aes128_md5", "auth_aes128_sha1", "auth_chain_a", "auth_chain_b"}; const string_array clashr_obfs = {"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth", "tls1.2_ticket_fastauth"}; -const string_array clash_ssr_ciphers = {"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20"}; +const string_array clash_ssr_ciphers = {"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20", "none"}; /// rule type lists #define basic_types "DOMAIN", "DOMAIN-SUFFIX", "DOMAIN-KEYWORD", "IP-CIDR", "SRC-IP-CIDR", "GEOIP", "MATCH", "FINAL" @@ -1264,7 +1264,7 @@ void netchToClash(std::vector &nodes, YAML::Node &yamlnode, const stri protoparam = GetMember(json, "ProtocolParam"); obfsparam = GetMember(json, "OBFSParam"); singleproxy["type"] = "ssr"; - singleproxy["cipher"] = method; + singleproxy["cipher"] = method == "none" ? "dummy" : method; singleproxy["password"] = password; if(std::all_of(password.begin(), password.end(), ::isdigit) && !password.empty()) singleproxy["password"].SetTag("str");