diff --git a/package/ctcgfw/luci-app-openclash/files/etc/config/openclash b/package/ctcgfw/luci-app-openclash/files/etc/config/openclash index 72e9b7c109..dcaf098074 100644 --- a/package/ctcgfw/luci-app-openclash/files/etc/config/openclash +++ b/package/ctcgfw/luci-app-openclash/files/etc/config/openclash @@ -21,7 +21,7 @@ config openclash 'config' option disable_masq_cache '0' option servers_update '0' option log_level 'silent' - option proxy_mode 'Rule' + option proxy_mode 'rule' option intranet_allowed '0' option enable_udp_proxy '1' option lan_ac_mode '0' diff --git a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/servers-config.lua b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/servers-config.lua index 4db030137a..e5ae9f222d 100644 --- a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/servers-config.lua +++ b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/servers-config.lua @@ -42,11 +42,42 @@ local encrypt_methods_ss = { "xchacha20-ietf-poly1305", } +local encrypt_methods_ssr = { + + "rc4-md5", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "chacha20-ietf", + "xchacha20", +} + local securitys = { - "auto", - "none", - "aes-128-gcm", - "chacha20-poly1305" + "auto", + "none", + "aes-128-gcm", + "chacha20-poly1305" +} + +local protocols = { + "origin", + "auth_sha1_v4", + "auth_aes128_md5", + "auth_aes128_sha1", + "auth_chain_a", + "auth_chain_b", +} + +local obfs = { + "plain", + "http_simple", + "http_post", + "random_head", + "tls1.2_ticket_auth", + "tls1.2_ticket_fastauth", } m = Map(openclash, translate("Edit Server")) @@ -79,6 +110,7 @@ end o = s:option(ListValue, "type", translate("Server Node Type")) o:value("ss", translate("Shadowsocks")) +o:value("ssr", translate("ShadowsocksR")) o:value("vmess", translate("Vmess")) o:value("trojan", translate("trojan")) o:value("snell", translate("Snell")) @@ -102,6 +134,7 @@ o = s:option(Value, "password", translate("Password")) o.password = true o.rmempty = false o:depends("type", "ss") +o:depends("type", "ssr") o:depends("type", "trojan") o = s:option(Value, "psk", translate("Psk")) @@ -113,11 +146,32 @@ for _, v in ipairs(encrypt_methods_ss) do o:value(v) end o.rmempty = true o:depends("type", "ss") +o = s:option(ListValue, "cipher_ssr", translate("Encrypt Method")) +for _, v in ipairs(encrypt_methods_ssr) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(ListValue, "protocol", translate("Protocol")) +for _, v in ipairs(protocols) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(Value, "protocol_param", translate("Protocol param(optional)")) +o:depends("type", "ssr") + o = s:option(ListValue, "securitys", translate("Encrypt Method")) for _, v in ipairs(securitys) do o:value(v) end o.rmempty = true o:depends("type", "vmess") +o = s:option(ListValue, "obfs_ssr", translate("Obfs")) +for _, v in ipairs(obfs) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(Value, "obfs_param", translate("Obfs param(optional)")) +o:depends("type", "ssr") + -- AlterId o = s:option(Value, "alterId", translate("AlterId")) o.datatype = "port" @@ -137,6 +191,7 @@ o.default = "false" o:value("true") o:value("false") o:depends("type", "ss") +o:depends("type", "ssr") o:depends("type", "vmess") o:depends("type", "socks5") o:depends("type", "trojan") diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh index c991c6fdeb..40f32e2488 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh @@ -539,6 +539,21 @@ do obfs_host="$(cfg_get "obfs-host:" "$single_server")" fi + if [ "$server_type" = "ssr" ]; then + #cipher + cipher="$(cfg_get "cipher:" "$single_server")" + #password + password="$(cfg_get "password:" "$single_server")" + #obfs: + obfs="$(cfg_get "obfs:" "$single_server")" + #protocol: + protocol="$(cfg_get "protocol:" "$single_server")" + #obfs-param: + obfs_param="$(cfg_get "obfs-param:" "$single_server")" + #protocol-param: + protocol_param="$(cfg_get "protocol-param:" "$single_server")" + fi + if [ "$server_type" = "vmess" ]; then #uuid: uuid="$(cfg_get "uuid:" "$single_server")" @@ -608,6 +623,7 @@ do if [ "$server_type" = "ss" ]; then ${uci_set}cipher="$cipher" + ${uci_set}password="$password" ${uci_set}obfs="$obfs" ${uci_set}host="$obfs_host" ${uci_set}path="$path" @@ -618,6 +634,16 @@ do fi [ -z "$obfs_host" ] && ${uci_set}host="$host" + if [ "$server_type" = "ssr" ]; then + ${uci_set}cipher_ssr="$cipher" + ${uci_set}password="$password" + ${uci_set}obfs_ssr="$obfs" + ${uci_set}obfs_param="$obfs_param" + ${uci_set}protocol="$protocol" + ${uci_set}protocol_param="$protocol_param" + + fi + if [ "$server_type" = "snell" ]; then ${uci_set}obfs_snell="$mode" [ -z "$mode" ] && ${uci_set}obfs_snell="none" @@ -692,6 +718,7 @@ do if [ "$server_type" = "ss" ]; then ${uci_set}cipher="$cipher" + ${uci_set}password="$password" ${uci_set}obfs="$obfs" ${uci_set}host="$obfs_host" ${uci_set}path="$path" @@ -702,6 +729,16 @@ do fi [ -z "$obfs_host" ] && ${uci_set}host="$host" + if [ "$server_type" = "ssr" ]; then + ${uci_set}cipher_ssr="$cipher" + ${uci_set}password="$password" + ${uci_set}obfs_ssr="$obfs" + ${uci_set}obfs_param="$obfs_param" + ${uci_set}protocol="$protocol" + ${uci_set}protocol_param="$protocol_param" + + fi + if [ "$server_type" = "snell" ]; then ${uci_set}obfs_snell="$mode" [ -z "$mode" ] && ${uci_set}obfs_snell="none" diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh index dde49017cb..b7ae5bae30 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh @@ -133,11 +133,16 @@ yml_servers_set() config_get "server" "$section" "server" "" config_get "port" "$section" "port" "" config_get "cipher" "$section" "cipher" "" + config_get "cipher_ssr" "$section" "cipher_ssr" "" config_get "password" "$section" "password" "" config_get "securitys" "$section" "securitys" "" config_get "udp" "$section" "udp" "" config_get "obfs" "$section" "obfs" "" + config_get "obfs_ssr" "$section" "obfs_ssr" "" + config_get "obfs_param" "$section" "obfs_param" "" config_get "obfs_vmess" "$section" "obfs_vmess" "" + config_get "protocol" "$section" "protocol" "" + config_get "protocol_param" "$section" "protocol_param" "" config_get "host" "$section" "host" "" config_get "mux" "$section" "mux" "" config_get "custom" "$section" "custom" "" @@ -185,7 +190,7 @@ yml_servers_set() fi if [ -z "$password" ]; then - if [ "$type" = "ss" ] || [ "$type" = "trojan" ]; then + if [ "$type" = "ss" ] || [ "$type" = "trojan" ] || [ "$type" = "ssr" ]; then return fi fi @@ -278,6 +283,35 @@ EOF fi fi fi + +#ssr +if [ "$type" = "ssr" ]; then +cat >> "$SERVER_FILE" <<-EOF +- name: "$name" + type: $type + server: $server + port: $port + cipher: $cipher_ssr + password: "$password" + obfs: "$obfs_ssr" + protocol: "$protocol" +EOF + if [ ! -z "$obfs_param" ]; then +cat >> "$SERVER_FILE" <<-EOF + obfs-param: $obfs_param +EOF + fi + if [ ! -z "$protocol_param" ]; then +cat >> "$SERVER_FILE" <<-EOF + protocol-param: $protocol_param +EOF + fi + if [ ! -z "$udp" ]; then +cat >> "$SERVER_FILE" <<-EOF + udp: $udp +EOF + fi +fi #vmess if [ "$type" = "vmess" ]; then diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh index 09e177d021..944fef817d 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh @@ -24,9 +24,6 @@ yml_other_set() if [ -z "$(grep '^- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ]; then sed -i '1,/^ \{0,\}- MATCH/{/^ \{0,\}- MATCH/s/^ \{0,\}- MATCH/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null fi - if [ -z "$(grep '^- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ]; then - sed -i '1,/^ \{0,\}- FINAL/{/^ \{0,\}- FINAL/s/^ \{0,\}- FINAL/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null - fi fi fi diff --git a/package/ctcgfw/luci-app-openclash/i18n/zh-cn/openclash.zh-cn.po b/package/ctcgfw/luci-app-openclash/i18n/zh-cn/openclash.zh-cn.po index ddd5cad403..c72332c9ae 100644 --- a/package/ctcgfw/luci-app-openclash/i18n/zh-cn/openclash.zh-cn.po +++ b/package/ctcgfw/luci-app-openclash/i18n/zh-cn/openclash.zh-cn.po @@ -6,7 +6,7 @@ msgid "OpenClash" msgstr "OpenClash" msgid "A Clash Client For OpenWrt" -msgstr "一个运行在OpenWrt上的Clash客户端,兼容Shadowsocks、Vmess、Trojan、Snell等协议,根据灵活的规则配置实现策略代理" +msgstr "一个运行在OpenWrt上的Clash客户端,兼容Shadowsocks、ShadowsocksR、Vmess、Trojan、Snell等协议,根据灵活的规则配置实现策略代理" msgid "Global Settings(Will Modify The Config File Or Subscribe According To The Settings On This Page)" msgstr "全局设置(将按照本页设置自动修改配置文件和获取订阅)" @@ -633,6 +633,18 @@ msgstr "密码" msgid "Encrypt Method" msgstr "加密方式" +msgid "Protocol" +msgstr "协议" + +msgid "Protocol param(optional)" +msgstr "传输协议参数(可选)" + +msgid "Obfs" +msgstr "混淆插件" + +msgid "Obfs param(optional)" +msgstr "混淆参数(可选)" + msgid "UDP Enable" msgstr "UDP支持"