Skip to content

Commit

Permalink
Adjusted multihome to be consistent with the repo
Browse files Browse the repository at this point in the history
Added FIXME for @Chaos02 to check
  • Loading branch information
wolveix committed Dec 16, 2024
1 parent 10f2109 commit 785a3a6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ENV AUTOSAVENUM="5" \
MAXOBJECTS="2162688" \
MAXPLAYERS="4" \
MAXTICKRATE="30" \
MULTIHOME="::" \
PGID="1000" \
PUID="1000" \
ROOTLESS="false" \
Expand All @@ -19,8 +20,7 @@ ENV AUTOSAVENUM="5" \
STEAMAPPID="1690800" \
STEAMBETA="false" \
TIMEOUT="30" \
VMOVERRIDE="false" \
MULTIHOME="::"
VMOVERRIDE="false"

# hadolint ignore=DL3008
RUN set -x \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ helm install satisfactory k8s-at-home/satisfactory -f values.yaml
| `MAXOBJECTS` | `2162688` | set the object limit for your server |
| `MAXPLAYERS` | `4` | set the player limit for your server |
| `MAXTICKRATE` | `30` | set the maximum sim tick rate for your server |
| `MULTIHOME` | `::` | set the server's listening interface (usually not needed) |
| `PGID` | `1000` | set the group ID of the user the server will run as |
| `PUID` | `1000` | set the user ID of the user the server will run as |
| `ROOTLESS` | `false` | run the container as a non-root user |
| `SERVERGAMEPORT` | `7777` | set the game's port |
| `MULTIHOME` | `::` | set the servers listening interfaces (usually not needed) |
| `SERVERSTREAMING` | `true` | toggle whether the game utilizes asset streaming |
| `SKIPUPDATE` | `false` | avoid updating the game on container start/restart |
| `STEAMBETA` | `false` | set experimental game version |
Expand Down
42 changes: 21 additions & 21 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,6 @@ if ! [[ "$MAXTICKRATE" =~ $NUMCHECK ]] ; then
fi
printf "Setting max tick rate to %s\\n" "$MAXTICKRATE"

if [[ "$MULTIHOME" != "::" ]]; then
if [[ "$MULTIHOME" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
# Check if it's a valid IPv4 address (0-255 segments)
if echo "$MULTIHOME" | awk -F. '$1<=255 && $2<=255 && $3<=255 && $4<=255'; then
if [[ "$MULTIHOME" == "0.0.0.0" ]]; then
printf "Restricting Server to IPv4 on all interfaces\n"
else
printf "Setting custom IPv4 as Interface: %s\n" "$MULTIHOME"
fi
else
printf "Invalid IPv4 address: %s\n" "$MULTIHOME"
fi
elif [[ "$MULTIHOME" =~ ^([0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{1,4}$ ]]; then
printf "Setting custom IPv6 as Interface: %s\n" "$MULTIHOME"
else
# server handles this non-graciously
printf "Invalid IP address: %s\n" "$MULTIHOME"
exit 1
fi
fi

[[ "${SERVERSTREAMING,,}" == "true" ]] && SERVERSTREAMING="1" || SERVERSTREAMING="0"
printf "Setting server streaming to %s\\n" "$SERVERSTREAMING"

Expand All @@ -66,6 +45,27 @@ else
DISABLESEASONALEVENTS=""
fi

if [[ "$MULTIHOME" != "::" ]]; then
# Check if it's a valid IPv4 address (0-255 segments).
if [[ "$MULTIHOME" =~ ^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$ ]]; then
printf "Multihome will accept IPv4 connections only\\n"
# Check if it's a valid IPv6 address.
elif [[ "$MULTIHOME" =~ ^([0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{1,4}$ ]]; then
# FIXME: doesn't support IPv6 shorthand, e.g. 2041:0000:140F::875B:131B.
printf "Multihome will accept IPv6 connections only\\n"
else
printf "Invalid multihome address given: %s\n" "$MULTIHOME"
MULTIHOME="::"
fi
fi
# Secondary check needed if a failure condition occurs above.
if [[ "$MULTIHOME" == "::" ]]; then
printf "Multihome will accept IPv4 and IPv6 connections\\n"
fi
printf "Setting multihome to %s\\n" "$MULTIHOME"
ini_args=(
"-ini:Engine:[/Script/FactoryGame.FGSaveSession]:mNumRotatingAutosaves=$AUTOSAVENUM"
"-ini:Engine:[/Script/Engine.GarbageCollectionSettings]:gc.MaxObjectsInEditor=$MAXOBJECTS"
Expand Down

0 comments on commit 785a3a6

Please sign in to comment.