Assign game port from host configured port ranges

Add host.factorio_port_range config to hosts that specify a pool of
ports that gets automatically assigned to instances which do not have a
game_port set on them.  This allows setting up a port range that's
forwarded to the host on the router and then configure that port range
on the host and have instances automatically get assigned an available
port when they start up.

Resolves: #448
This commit is contained in:
Hornwitser committed 2024-01-11 00:19:19 +01:00
1 parent 9742eb1645
commit 8733575255
5 files changed
+76 -6

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ describe("class Instance", function() {
instanceConfig.set("instance.name", "foo");
src = addr({ instanceId: instanceConfig.get("instance.id") });
connector = new MockConnector(src, dst);
instance = new Instance({}, connector, "dir", "factorioDir", instanceConfig);
instance = new Instance({ assignGamePort: () => 1 }, connector, "dir", "factorioDir", instanceConfig);
instance.server = new MockServer();
});