Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RunOnFluxBot committed Nov 21, 2023
1 parent e09924c commit 422cc03
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions services/geolocationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,8 @@ async function setNodeGeolocation() {
if (!storedGeolocation || myIP !== storedIp || execution % 4 === 0) {
log.info(`Checking geolocation of ${myIP}`);
storedIp = myIP;
const statsApiUrl = `https://stats.runonflux.io/fluxlocation/${myIP.split(':')[0]}`;
const statsRes = await serviceHelper.axiosGet(statsApiUrl);
if (statsRes.data.status === 'success' && statsRes.data.data) {
storedGeolocation = {
ip: statsRes.data.data.ip,
continent: statsRes.data.data.continent,
continentCode: statsRes.data.data.continentCode,
country: statsRes.data.data.country,
countryCode: statsRes.data.data.countryCode,
region: statsRes.data.data.region,
regionName: statsRes.data.data.regionName,
lat: statsRes.data.data.lat,
lon: statsRes.data.data.lon,
org: statsRes.data.data.org,
};
} else {
throw new Error(`Geolocation of IP ${myIP} is unavailable`);
}
// consider another service failover or stats db
/* const ipApiUrl = `http://ip-api.com/json/${myIP.split(':')[0]}?fields=status,continent,continentCode,country,countryCode,region,regionName,lat,lon,query,org,isp`;
const ipApiUrl = `http://ip-api.com/json/${myIP.split(':')[0]}?fields=status,continent,continentCode,country,countryCode,region,regionName,lat,lon,query,org,isp`;
const ipRes = await serviceHelper.axiosGet(ipApiUrl);
if (ipRes.data.status === 'success' && ipRes.data.query !== '') {
storedGeolocation = {
Expand Down Expand Up @@ -73,7 +55,7 @@ async function setNodeGeolocation() {
} else {
throw new Error(`Geolocation of IP ${myIP} is unavailable`);
}
} */
}
}
log.info(`Geolocation of ${myIP} is ${JSON.stringify(storedGeolocation)}`);
for (let i = 0; i < staticIpOrgs.length; i += 1) {
Expand Down

0 comments on commit 422cc03

Please sign in to comment.