fix(tests): fix tests
This commit is contained in:
@ -52,6 +52,9 @@ export class WrappedSocket {
|
||||
if (prop === 'setProxyInfo') {
|
||||
return target.setProxyInfo.bind(target);
|
||||
}
|
||||
if (prop === 'remoteFamily') {
|
||||
return target.remoteFamily;
|
||||
}
|
||||
|
||||
// For all other properties/methods, delegate to the underlying socket
|
||||
const value = target.socket[prop as keyof plugins.net.Socket];
|
||||
@ -89,6 +92,21 @@ export class WrappedSocket {
|
||||
return !!this.realClientIP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address family of the remote IP
|
||||
*/
|
||||
get remoteFamily(): string | undefined {
|
||||
const ip = this.realClientIP || this.socket.remoteAddress;
|
||||
if (!ip) return undefined;
|
||||
|
||||
// Check if it's IPv6
|
||||
if (ip.includes(':')) {
|
||||
return 'IPv6';
|
||||
}
|
||||
// Otherwise assume IPv4
|
||||
return 'IPv4';
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the real client information (called after parsing PROXY protocol)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user