Authored by htoooth

fix

... ... @@ -159,7 +159,7 @@ async function handleClientTiming(scope, item) {
osVersion: agent.os.toVersion()
};
const ipInfo = await ipService.getIsp(scope.ip).catch(() => {});
const ipInfo = ipService.getIsp(scope.ip).catch(() => {});
_.merge(data, ipInfo);
... ...
... ... @@ -3,7 +3,7 @@ const logger = global.yoho.logger;
const ipQuery = new IP2Region();
async function getIsp(ip) {
function getIsp(ip) {
try {
const result = ipQuery.search(ip);
... ... @@ -15,7 +15,7 @@ async function getIsp(ip) {
country: result.country
};
} catch (e) {
logger.error(e);
logger.error('[ip] find ip error [%s]', e);
return {};
}
}
... ...
const ipApi = require('./ip-api');
async function getIsp(ip) {
function getIsp(ip) {
if (!ip) {
return {};
}
const result = await ipApi.getIsp(ip);
const result = ipApi.getIsp(ip);
if (result.country === '内网IP') {
return {};
... ...