Handle case where remoteAddress is not yet avail
This commit is contained in:
parent
2a0ae05c45
commit
a1188fb90c
|
@ -598,6 +598,10 @@ Client.prototype.isLocal = function () {
|
|||
};
|
||||
|
||||
Client.prototype.friendlyRemoteAddress = function () {
|
||||
if (!this.remoteAddress) {
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
// convert any :ffff: IPv4's to 32bit version
|
||||
return this.remoteAddress.replace(/^::ffff:/, '').replace(/^::1$/, 'localhost');
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue