feat(PortProxy): Add feature to preserve original client IP through chained proxies
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartproxy',
|
||||
version: '3.5.0',
|
||||
version: '3.6.0',
|
||||
description: 'a proxy for handling high workloads of proxying'
|
||||
}
|
||||
|
@ -123,9 +123,11 @@ export class PortProxy {
|
||||
const domainConfig = serverName ? findMatchingDomain(serverName) : undefined;
|
||||
const targetHost = domainConfig?.targetIP || this.settings.toHost!;
|
||||
|
||||
// Create connection with IP binding to preserve original client IP
|
||||
const to = plugins.net.createConnection({
|
||||
host: targetHost,
|
||||
port: this.settings.toPort,
|
||||
localAddress: remoteIP.replace('::ffff:', ''), // Remove IPv6 mapping if present
|
||||
});
|
||||
console.log(`Connection established: ${remoteIP} -> ${targetHost}:${this.settings.toPort}${serverName ? ` (SNI: ${serverName})` : ''}`);
|
||||
from.setTimeout(120000);
|
||||
|
Reference in New Issue
Block a user