Browse Source

Fix Get IP Bug

Mattraks 5 years ago
parent
commit
8c6641eeef
1 changed files with 8 additions and 3 deletions
  1. 8 3
      luci-app-ssr-plus/root/etc/init.d/shadowsocksr

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

@@ -587,10 +587,12 @@ check_server() {
 
 start_rules() {
 	local server=$(get_host_ip $(uci_get_by_name $GLOBAL_SERVER server))
-	[ "$server" == "127.0.0.1" ] && hostip=$(uci_get_by_name $GLOBAL_SERVER ip)
-	kcp_server=$server
+	if [ "$server" == "ERROR" ]; then
+		server=$(uci_get_by_name $GLOBAL_SERVER ip)
+	fi
 	local kcp_enable=$(uci_get_by_name $GLOBAL_SERVER kcp_enable 0)
 	if [ $kcp_enable == "1" ]; then
+		kcp_server=$server
 		kcp_flag=1
 	fi
 	local local_port=$(uci_get_by_name $GLOBAL_SERVER local_port)
@@ -638,7 +640,10 @@ start_rules() {
 		2) echo "-O" ;;
 		esac
 	}
-	netflix_ip=$(get_host_ip $(uci_get_by_name $NETFLIX_SERVER server 127.0.0.1))
+	netflix_ip=$(get_host_ip $(uci_get_by_name $NETFLIX_SERVER server))
+	if [ "$netflix_ip" == "ERROR" ]; then
+		netflix_ip=$(uci_get_by_name $NETFLIX_SERVER ip)
+	fi
 	/usr/bin/ssr-rules \
 	-s "$server" \
 	-l "$local_port" \