浏览代码

luci-app-ssr-plus: fix v2ray shunt issue

Signed-off-by: Tianling Shen <[email protected]>
Co-authored-by: Mattraks <[email protected]>
Tianling Shen 3 年之前
父节点
当前提交
f1572c3062
共有 1 个文件被更改,包括 15 次插入8 次删除
  1. 15 8
      luci-app-ssr-plus/root/etc/init.d/shadowsocksr

+ 15 - 8
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -409,13 +409,9 @@ start_shunt() {
 		echolog "shunt:$(get_name $type) Started!"
 		;;
 	v2ray)
-		if [ -n "$tmp_local_port" ]; then
-			local tmp_port=$tmp_local_port
-		else
-			local tmp_port=$tmp_shunt_local_port
-			gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port $tmp_port
-			ln_start_bin $(first_type xray v2ray) v2ray -config $shunt_config_file
-		fi
+		local tmp_port=${tmp_local_port:-$tmp_shunt_local_port}
+		gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port $tmp_port
+		ln_start_bin $(first_type xray v2ray) v2ray -config $shunt_config_file
 		ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q
 		echolog "shunt:$($(first_type xray v2ray) -version | head -1) Started!"
 		;;
@@ -492,8 +488,8 @@ start_local() {
 		if [ "$_local" == "2" ]; then
 			gen_config_file $LOCAL_SERVER $type 4 0 $local_port
 			ln_start_bin $(first_type xray v2ray) v2ray -config $local_config_file
-			echolog "Global_Socks5:$($(first_type "xray" "v2ray") -version | head -1) Started!"
 		fi
+		echolog "Global_Socks5:$($(first_type "xray" "v2ray") -version | head -1) Started!"
 		;;
 	trojan) #client
 		gen_config_file $LOCAL_SERVER $type 4 $local_port
@@ -638,6 +634,11 @@ load_config() {
 		start_local
 		local_enable=0
 		;;
+	$SHUNT_SERVER)
+		_local="3"
+		local_config_file=$TMP_PATH/tcp-udp-ssr-local.json
+		start_local
+		;;
 	*)
 		_local="2"
 		local_config_file=$TMP_PATH/tcp-udp-ssr-local.json
@@ -652,6 +653,12 @@ load_config() {
 		shunt="1"
 		SHUNT_SERVER=$GLOBAL_SERVER
 		;;
+	$LOCAL_SERVER)
+		shunt="$tmp_shunt_port"
+		shunt_config_file=$TMP_PATH/tcp-udp-ssr-local.json
+		shunt_dns_config_file=$TMP_PATH/shunt-dns-ssr-plus.json
+		start_shunt
+		;;
 	*)
 		shunt="$tmp_shunt_port"
 		shunt_config_file=$TMP_PATH/shunt-ssr-retcp.json