Added mesh agent IP address geo-location.

This commit is contained in:
Ylian Saint-Hilaire
2019-01-31 15:00:51 -08:00
parent a13acd6f0b
commit b5221c9f0d
6 changed files with 20 additions and 7 deletions

View File

@@ -87,7 +87,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
}
} else {
// Update the last connect time
obj.db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime });
if (obj.authenticated == 2) { obj.db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport }); }
}
delete obj.nodeid;
};
@@ -377,7 +377,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// Mark when we connected to this agent
obj.connectTime = Date.now();
obj.db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime });
obj.db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport });
// See if this node exists in the database
if (nodes.length == 0) {