diff --git a/client.js b/client.js index f5c13ac0..42f9a041 100644 --- a/client.js +++ b/client.js @@ -179,7 +179,8 @@ function getID() { rconPort: instanceconfig.clientPort, rconPassword: instanceconfig.clientPassword, serverPort: instanceconfig.factorioPort, - unique: instanceconfig.clientPassword.hashCode() + unique: instanceconfig.clientPassword.hashCode(), + publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config } require('getmac').getMac(function (err, mac) { if (err) throw err diff --git a/config.json b/config.json index 49d838a3..f5c44cd5 100644 --- a/config.json +++ b/config.json @@ -2,6 +2,9 @@ "__comment": "Where factorio folder. Should be in the same folder as this config file.", "factorioDirectory": "factorio", + "__comment": "IP players should connect to to join your servers, should be portforwarded and stuff", + "publicIP": "192.168.10.1", + "__comment": "IP the master web server runs at, can be ignored on the master system", "masterIP": "localhost", "masterPort": 8080, diff --git a/master.js b/master.js index 5131370f..c5b31dcb 100644 --- a/master.js +++ b/master.js @@ -52,10 +52,11 @@ app.post("/getID", function(req,res) { // time us a unix timestamp we can use to check for how long the server has been unresponsive // we should save that somewhere and give appropriate response if(req.body){ - slaves[req.body.unique] = req.body - console.log("Slave: " + req.body.mac + " : " + req.body.serverPort) + slaves[req.body.unique] = req.body; + console.log("Slave: " + req.body.mac + " : " + req.body.serverPort+" at " + req.body.publicIP); } }); + // endpoint for getting information about all our slaves app.get("/slaves", function(req, res) { res.header("Access-Control-Allow-Origin", "*");