fix(tests): fix tests

This commit is contained in:
Juergen Kunz
2025-06-23 08:38:14 +00:00
parent 1aead55296
commit be58700a2f
14 changed files with 153 additions and 107 deletions

View File

@ -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)
*/