Skip to content

Commit

Permalink
Reintroduction of the MULTIHOME parameter (#384)
Browse files Browse the repository at this point in the history
* Reintroduction of the MULTIHOME parameter
* Simplify multihome check + support completely disabling it

---------

Co-authored-by: Robert Thomas <[email protected]>
  • Loading branch information
Chaos02 and wolveix authored Jan 24, 2025
1 parent d55afb9 commit b38a1b1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ENV AUTOSAVENUM="5" \
MAXOBJECTS="2162688" \
MAXPLAYERS="4" \
MAXTICKRATE="30" \
MULTIHOME="::" \
PGID="1000" \
PUID="1000" \
SERVERGAMEPORT="7777" \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ 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 |
| `SERVERGAMEPORT` | `7777` | set the game's port |
| `SERVERIP` | `0.0.0.0` | set the game's ip (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
28 changes: 28 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,33 @@ else
DISABLESEASONALEVENTS=""
fi

# Validate and set multihome address for network connections (useful for v6-only networks).
if [[ "$MULTIHOME" != "" ]]; then
if [[ "$MULTIHOME" != "" ]] && [[ "$MULTIHOME" != "::" ]]; then
# IPv4 regex matches addresses from 0.0.0.0 to 255.255.255.255.
IPv4='^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$'

# IPv6 regex supports full and shortened formats like 2001:db8::1.
IPv6='^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$'

if [[ "$MULTIHOME" =~ $IPv4 ]]; then
printf "Multihome will accept IPv4 connections only\n"
elif [[ "$MULTIHOME" =~ $IPv6 ]]; then
printf "Multihome will accept IPv6 connections only\n"
else
printf "Invalid multihome address: %s (defaulting to ::)\n" "$MULTIHOME"
MULTIHOME="::"
fi
fi

if [[ "$MULTIHOME" == "::" ]]; then
printf "Multihome will accept IPv4 and IPv6 connections\n"
fi

printf "Setting multihome to %s\n" "$MULTIHOME"
MULTIHOME="-multihome=$MULTIHOME"
fi

ini_args=(
"-ini:Engine:[/Script/FactoryGame.FGSaveSession]:mNumRotatingAutosaves=$AUTOSAVENUM"
"-ini:Engine:[/Script/Engine.GarbageCollectionSettings]:gc.MaxObjectsInEditor=$MAXOBJECTS"
Expand All @@ -58,6 +85,7 @@ ini_args=(
"-ini:Game:[/Script/Engine.GameSession]:MaxPlayers=$MAXPLAYERS"
"-ini:GameUserSettings:[/Script/Engine.GameSession]:MaxPlayers=$MAXPLAYERS"
"$DISABLESEASONALEVENTS"
"$MULTIHOME"
)

if [[ "${SKIPUPDATE,,}" != "false" ]] && [ ! -f "/config/gamefiles/FactoryServer.sh" ]; then
Expand Down

0 comments on commit b38a1b1

Please sign in to comment.