Client.js now transmits IP needed to connect to slaves

This commit is contained in:
Danielv123 committed 2016-12-27 11:15:53 +01:00
1 parent 26a9c4f1ef
commit c33ca4abec
3 files changed
+8 -3

No files matched your search

+2 -1
View File
@@ -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
+3
View File
@@ -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,
+3 -2
View File
@@ -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", "*");