Skip to content

Commit

Permalink
Peers: Use new freegeoip.app for IP geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed Dec 23, 2019
1 parent 8b9ed64 commit bb15310
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/peers.js
Expand Up @@ -30,16 +30,16 @@ mongoose.connect(dbString, function(err) {
var port = body[i].addr.split(':')[1];
db.find_peer(address, function(peer) {
if (peer) {
if (isNaN(peer['port']) || peer['port'].length < 2) {
if (isNaN(peer['port']) || peer['port'].length < 2 || peer['country'].length < 1) {
db.drop_peers(function() {
console.log('Saved peers missing ports, dropping peers. Re-reun this script afterwards.');
console.log('Saved peers missing ports or country, dropping peers. Re-reun this script afterwards.');
exit();
});
}
// peer already exists
loop.next();
} else {
request({uri: 'http://freegeoip.net/json/' + address, json: true}, function (error, response, geo) {
request({uri: 'https://freegeoip.app/json/' + address, json: true}, function (error, response, geo) {
db.create_peer({
address: address,
port: port,
Expand Down

0 comments on commit bb15310

Please sign in to comment.