Explorar o código

Now gets internet IP for servers that are behind NAT

Daniel Gibbs %!s(int64=8) %!d(string=hai) anos
pai
achega
3e6463f7b0
Modificáronse 2 ficheiros con 10 adicións e 0 borrados
  1. 3 0
      lgsm/functions/info_distro.sh
  2. 7 0
      lgsm/functions/info_messages.sh

+ 3 - 0
lgsm/functions/info_distro.sh

@@ -133,3 +133,6 @@ if [ -d "${backupdir}" ]; then
 		lastbackupsize=$(du -h "${lastbackup}" | awk '{print $1}')
 	fi
 fi
+
+# External IP address
+extip=$(curl -m 3 ifconfig.co 2>/dev/null)

+ 7 - 0
lgsm/functions/info_messages.sh

@@ -134,6 +134,13 @@ fn_info_message_gameserver(){
 		# Server ip
 		echo -e "${blue}Server IP:\t${default}${ip}:${port}"
 
+		# External server ip
+		if [ -n "${extip}" ]; then
+			if [ "${ip}" != "${extip}"]; then
+				echo -e "${blue}Internet IP:\t${default}${extip}:${port}"
+			fi
+		fi
+
 		# Server password
 		if [ -n "${serverpassword}" ]; then
 			echo -e "${blue}Server password:\t${default}${serverpassword}"