javascript – Forward Client IP in Node.JS (net) proxy

I’d like to forward the client IP on my proxy to the remote host, so the remote host receives the client’s IP, and not my server’s IP.

I understand it’s not really a proxy at that point, but that’s not really what I’m aiming for.

Let’s say the remote is 1.1.1.1, client is 2.2.2.2 and my proxy is 3.3.3.3

When the client (2.2.2.2) connects to my server (3.3.3.3), It redirects to the remote (1.1.1.1) but the remote gets the request from IP 3.3.3.3 and not 2.2.2.2, is there a way to “Forward the IP” so the remote doesn’t recognize it’s been through another server?
Here is how I’m forwarding connections right now where destip is equal to the remote server, destport is the remote port, data is equal to the client > proxy socket, and socket is equal to the proxy > client socket

   socket.connect(parseInt(destport), destip, function () {
        socket.on('data', (proxy_client_data) => {
            data.write(proxy_client_data)
        })
        data.on('data', (client_proxy_data)=> {
            socket.write(client_proxy_data)
        })
    })

Thanks

Read more here: Source link