Add client.friendlyRemoteAddress() for 'clean' remote IP
This commit is contained in:
@@ -575,6 +575,11 @@ Client.prototype.isLocal = function() {
|
||||
return [ '127.0.0.1', '::ffff:127.0.0.1' ].includes(this.remoteAddress);
|
||||
};
|
||||
|
||||
Client.prototype.friendlyRemoteAddress = function() {
|
||||
// convert any :ffff: IPv4's to 32bit version
|
||||
return this.remoteAddress.replace(/^::ffff:/, '')
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Default error handlers
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user