feat(assist): EE fixed geoip-unknown ip
This commit is contained in:
parent
5b8eddc0e1
commit
6cacc4ef52
2 changed files with 14 additions and 4 deletions
|
|
@ -270,8 +270,13 @@ function extractSessionInfo(socket) {
|
|||
socket.handshake.query.sessionInfo.userCountry = null;
|
||||
if (geoip() !== null) {
|
||||
debug && console.log(`looking for location of ${socket.handshake.headers['x-forwarded-for'] || socket.handshake.address}`);
|
||||
let country = geoip().country(socket.handshake.headers['x-forwarded-for'] || socket.handshake.address);
|
||||
socket.handshake.query.sessionInfo.userCountry = country.country.isoCode;
|
||||
try {
|
||||
let country = geoip().country(socket.handshake.headers['x-forwarded-for'] || socket.handshake.address);
|
||||
socket.handshake.query.sessionInfo.userCountry = country.country.isoCode;
|
||||
} catch (e) {
|
||||
debug && console.log("geoip-country failed");
|
||||
debug && console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,8 +249,13 @@ function extractSessionInfo(socket) {
|
|||
socket.handshake.query.sessionInfo.userCountry = null;
|
||||
if (geoip() !== null) {
|
||||
debug && console.log(`looking for location of ${socket.handshake.headers['x-forwarded-for'] || socket.handshake.address}`);
|
||||
let country = geoip().country(socket.handshake.headers['x-forwarded-for'] || socket.handshake.address);
|
||||
socket.handshake.query.sessionInfo.userCountry = country.country.isoCode;
|
||||
try {
|
||||
let country = geoip().country(socket.handshake.headers['x-forwarded-for'] || socket.handshake.address);
|
||||
socket.handshake.query.sessionInfo.userCountry = country.country.isoCode;
|
||||
} catch (e) {
|
||||
debug && console.log("geoip-country failed");
|
||||
debug && console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue