Browse Source

luci-app-ssr-plus: add concurrency option for NaiveProxy

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 3 năm trước cách đây
mục cha
commit
f2fc5827e8

+ 2 - 1
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -557,8 +557,9 @@ o:depends({type = "v2ray", xtls = false})
 o = s:option(Value, "concurrency", translate("Concurrency"))
 o.datatype = "uinteger"
 o.rmempty = true
-o.default = "8"
+o.default = "4"
 o:depends("mux", "1")
+o:depends("type", "naiveproxy")
 
 -- [[ Cert ]]--
 o = s:option(Flag, "certificate", translate("Self-signed Certificate"))

+ 2 - 3
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -323,7 +323,7 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
 	naiveproxy)
 		case "$3" in
 		1)
-			lua /usr/share/shadowsocksr/gen_config.lua $1 redir $4 $5 >$config_file
+			lua /usr/share/shadowsocksr/gen_config.lua $1 redir $4 >$config_file
 			;;
 		3)
 			lua /usr/share/shadowsocksr/gen_config.lua $1 redir $4 >$config_file
@@ -560,8 +560,7 @@ Start_Run() {
 		echolog "Main node:$($(first_type $type) --version 2>&1 | head -1) , $threads Threads Started!"
 		;;
 	naiveproxy)
-		[ "$(uci_get_by_type global threads 0)" == "0" ] && threads=1
-		gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $threads
+		gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
 		ln_start_bin $(first_type naive) naive $tcp_config_file
 		echolog "Main node:$($(first_type naive) --version 2>&1 | head -1) , $threads Threads Started!"
 		;;

+ 1 - 1
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -227,7 +227,7 @@ local trojan = {
 local naiveproxy = {
 	proxy = (server.username and server.password and server.server and server.server_port) and "https://" .. server.username .. ":" .. server.password .. "@" .. server.server .. ":" .. server.server_port,
 	listen = (proto == "redir") and "redir" .. "://0.0.0.0:" .. tonumber(local_port) or "socks" .. "://0.0.0.0:" .. tonumber(local_port),
-	["insecure-concurrency"] = (socks_port ~= "0") and tonumber(socks_port) or "1"
+	["insecure-concurrency"] = tonumber(server.concurrency) or 1
 }
 local ss = {
 	server = (server.kcp_enable == "1") and "127.0.0.1" or server.server,