@push.rocks/smartproxy
Version:
A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.
39 lines (38 loc) • 1.4 kB
TypeScript
import * as plugins from '../../plugins.js';
/**
* WrappedSocket wraps a regular net.Socket to provide transparent access
* to the real client IP and port when behind a proxy using PROXY protocol.
*
* This is the FOUNDATION for all PROXY protocol support and must be implemented
* before any protocol parsing can occur.
*
* This implementation uses a Proxy to delegate all properties and methods
* to the underlying socket while allowing override of specific properties.
*/
export declare class WrappedSocket {
readonly socket: plugins.net.Socket;
private realClientIP?;
private realClientPort?;
[key: string]: any;
constructor(socket: plugins.net.Socket, realClientIP?: string, realClientPort?: number);
/**
* Returns the real client IP if available, otherwise the socket's remote address
*/
get remoteAddress(): string | undefined;
/**
* Returns the real client port if available, otherwise the socket's remote port
*/
get remotePort(): number | undefined;
/**
* Indicates if this connection came through a trusted proxy
*/
get isFromTrustedProxy(): boolean;
/**
* Returns the address family of the remote IP
*/
get remoteFamily(): string | undefined;
/**
* Updates the real client information (called after parsing PROXY protocol)
*/
setProxyInfo(ip: string, port: number): void;
}