mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Client.js now transmits IP needed to connect to slaves
This commit is contained in:
1 parent
26a9c4f1ef
commit
c33ca4abec
3 files changed
+8
-3
No files matched your search
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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", "*");
|
||||
|
||||
Reference in new issue
Block a user