Przeglądaj źródła

Merge pull request #51 from Mattraks/Fixes

fix work with haproxy
fw876 5 lat temu
rodzic
commit
ff6f04627c

+ 1 - 1
luci-app-ssr-plus/Makefile

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-ssr-plus
 PKG_VERSION:=178
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 include $(INCLUDE_DIR)/package.mk
 

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

@@ -70,7 +70,7 @@ get_host_ip() {
 			[ -z "$ip" ] && ip=$(wget -q -O- http://119.29.29.29/d?dn=$1 | awk -F ';' '{print $1}')
 		fi
 	fi
-	echo ${ip:="127.0.0.1"}
+	echo ${ip:="ERROR"}
 }
 
 clean_log() {
@@ -123,7 +123,9 @@ find_bin() {
 
 gen_config_file() {
 	local hostip=$(get_host_ip $(uci_get_by_name $1 server))
-	if [ "$hostip" != "127.0.0.1" ]; then
+	if [ "$hostip" == "ERROR" ]; then
+		hostip=$(uci_get_by_name $1 ip)
+	else
 		uci_set_by_name $1 ip $hostip
 	fi
 	[ "$2" == "0" -a "$kcp_flag" == "1" ] && hostip="127.0.0.1"
@@ -139,7 +141,6 @@ gen_config_file() {
 		fastopen="false"
 	fi
 	local type=$(uci_get_by_name $1 type)
-	
 	case "$type" in
 	ss)
 		cat <<-EOF >$config_file

+ 3 - 3
luci-app-ssr-plus/root/usr/bin/ssr-monitor

@@ -35,7 +35,7 @@ get_host_ip() {
 			[ -z "$ip" ] && ip=$(wget -q -O- http://119.29.29.29/d?dn=$1 | awk -F ';' '{print $1}')
 		fi
 	fi
-	echo ${ip:="127.0.0.1"}
+	echo ${ip:="ERROR"}
 }
 
 server_process_count=$1
@@ -51,7 +51,7 @@ fi
 i=0
 GLOBAL_SERVER=$(uci_get_by_type global global_server)
 server=$(get_host_ip $(uci_get_by_name $GLOBAL_SERVER server))
-[ "$server" == "127.0.0.1" ] && hostip=$(uci_get_by_name $GLOBAL_SERVER ip)
+[ "$server" == "ERROR" ] && hostip=$(uci_get_by_name $GLOBAL_SERVER ip)
 lkcp_port=$(uci_get_by_name $GLOBAL_SERVER kcp_port)
 server_port=$(uci_get_by_name $GLOBAL_SERVER server_port)
 password=$(uci_get_by_name $GLOBAL_SERVER kcp_password)
@@ -133,7 +133,7 @@ while [ "1" == "1" ]; do #死循环
 			else
 				kill -9 $(ps | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1
 			fi
-			(/usr/sbin/pdnsd -c /var/etc/pdnsd.conf &)
+			(/usr/sbin/pdnsd -c /var/etc/pdnsd.conf >/dev/null 2>&1 &)
 		fi
 	fi
 	#dns2socks