mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-08 12:07:37 +08:00
feat: change extip to public ip (#4301)
also change ark parms for epic to use publicip
This commit is contained in:
parent
6b9393f949
commit
7b374249ea
@ -19,7 +19,7 @@ altsavedirectoryname="${defaultmap}"
|
||||
maxplayers="70"
|
||||
|
||||
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
|
||||
startparameters="${defaultmap}?AltSaveDirectoryName=${altsavedirectoryname}?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port} -automanagedmods -crossplay -PublicIPForEpic=${ip}"
|
||||
startparameters="${defaultmap}?AltSaveDirectoryName=${altsavedirectoryname}?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port} -automanagedmods -crossplay -PublicIPForEpic=${publicip}"
|
||||
|
||||
#### LinuxGSM Settings ####
|
||||
|
||||
|
@ -14,7 +14,7 @@ port="7777"
|
||||
queryport="7780"
|
||||
|
||||
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
|
||||
startparameters="/Game/Maps/Final_Maps/Derailed?Game=/Script/ShooterGame.WartideGameMode?listen -log -broadcastip=\"${extip}\" -PORT=${port} -QueryPort=${queryport} -defgameini=\"${servercfgfullpath}\""
|
||||
startparameters="/Game/Maps/Final_Maps/Derailed?Game=/Script/ShooterGame.WartideGameMode?listen -log -broadcastip=\"${publicip}\" -PORT=${port} -QueryPort=${queryport} -defgameini=\"${servercfgfullpath}\""
|
||||
|
||||
#### LinuxGSM Settings ####
|
||||
|
||||
|
@ -58,9 +58,9 @@ fi
|
||||
echo -e "${lightblue}Game Server IP:\t${default}${ip}:${port}"
|
||||
|
||||
# External server IP.
|
||||
if [ "${extip}" ]; then
|
||||
if [ "${ip}" != "${extip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
|
||||
if [ "${publicip}" ]; then
|
||||
if [ "${ip}" != "${publicip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${publicip}:${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -44,7 +44,7 @@ declare -A server_details=(
|
||||
['HTTP Password']="${httppassword}"
|
||||
['HTTP Port']="${httpport}"
|
||||
['HTTP User']="${httpuser}"
|
||||
['Internet IP']="${extip}"
|
||||
['Internet IP']="${publicip}"
|
||||
['LAN Port']="${lanport}"
|
||||
['Master Port']="${masterport}"
|
||||
['Master']="${master}"
|
||||
|
@ -2378,30 +2378,30 @@ fi
|
||||
|
||||
# External IP address
|
||||
# Cache external IP address for 24 hours
|
||||
if [ -f "${tmpdir}/extip.txt" ]; then
|
||||
if [ "$(find "${tmpdir}/extip.txt" -mmin +1440)" ]; then
|
||||
rm -f "${tmpdir:?}/extip.txt"
|
||||
if [ -f "${tmpdir}/publicip.txt" ]; then
|
||||
if [ "$(find "${tmpdir}/publicip.txt" -mmin +1440)" ]; then
|
||||
rm -f "${tmpdir:?}/publicip.txt"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${tmpdir}/extip.txt" ]; then
|
||||
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)"
|
||||
if [ ! -f "${tmpdir}/publicip.txt" ]; then
|
||||
publicip="$(curl --connect-timeout 10 -s https://api.ipify.org 2> /dev/null)"
|
||||
exitcode=$?
|
||||
# if curl passes add extip to externalip.txt
|
||||
# if curl passes add publicip to externalip.txt
|
||||
if [ "${exitcode}" == "0" ]; then
|
||||
echo "${extip}" > "${tmpdir}/extip.txt"
|
||||
echo "${publicip}" > "${tmpdir}/publicip.txt"
|
||||
else
|
||||
echo "Unable to get external IP address"
|
||||
fi
|
||||
else
|
||||
extip="$(cat "${tmpdir}/extip.txt")"
|
||||
publicip="$(cat "${tmpdir}/publicip.txt")"
|
||||
fi
|
||||
|
||||
# Alert IP address
|
||||
if [ "${displayip}" ]; then
|
||||
alertip="${displayip}"
|
||||
elif [ "${extip}" ]; then
|
||||
alertip="${extip}"
|
||||
elif [ "${publicip}" ]; then
|
||||
alertip="${publicip}"
|
||||
else
|
||||
alertip="${ip}"
|
||||
fi
|
||||
@ -2421,7 +2421,7 @@ if [ -z "${displaymasterserver}" ]; then
|
||||
if [ -n "${ip}" ] && [ -n "${port}" ]; then
|
||||
if [ "${steammaster}" == "true" ] || [ "${commandname}" == "DEV-QUERY-RAW" ]; then
|
||||
# Query external IP first as most liky to succeed.
|
||||
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${extip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" --arg port3 "${port3}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber) or .gameport == ($port3|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)"
|
||||
masterserver="$(curl --connect-timeout 10 -m 3 -s "https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${publicip}&format=json" | jq --arg port "${port}" --arg queryport "${queryport}" --arg port3 "${port3}" 'if .response.servers != null then .response.servers[] | select((.gameport == ($port|tonumber) or .gameport == ($queryport|tonumber) or .gameport == ($port3|tonumber))) | .addr else empty end' | wc -l 2> /dev/null)"
|
||||
if [ "${masterserver}" == "0" ]; then
|
||||
# Loop though server IP addresses if external IP fails.
|
||||
for queryip in "${queryips[@]}"; do
|
||||
|
@ -166,8 +166,8 @@ fn_info_message_server_resource() {
|
||||
echo -e "${lightblue}Link Speed:\t${default}${netlink}"
|
||||
fi
|
||||
echo -e "${lightblue}IP:\t${default}${ip}"
|
||||
if [ "${ip}" != "${extip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${extip}"
|
||||
if [ "${ip}" != "${publicip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${publicip}"
|
||||
fi
|
||||
} | column -s $'\t' -t
|
||||
}
|
||||
@ -274,9 +274,9 @@ fn_info_message_gameserver() {
|
||||
echo -e "${lightblue}Server IP:\t${default}${ip}:${port}"
|
||||
|
||||
# Internet ip
|
||||
if [ -n "${extip}" ]; then
|
||||
if [ "${ip}" != "${extip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
|
||||
if [ -n "${publicip}" ]; then
|
||||
if [ "${ip}" != "${publicip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${publicip}:${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user