-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
When proxy-chain is configured to chain through an upstream SOCKS5 proxy, we should support forwarding UDP traffic, not just TCP.
The socks npm package we already use (v2.8.3) supports the associate command, but we never use it. In src/chain_socks.ts:85-89:
const client = await SocksClient.createConnection({
proxy,
command: 'connect', // always TCP
destination,
});
To support UDP through SOCKS5 upstreams:
- Add a
chainSocksUdp()function insrc/chain_socks.tsthat usescommand: 'associate' - Handle the BND.ADDR and BND.PORT returned by the upstream SOCKS5 server
- Create a local UDP socket to relay datagrams to the upstream's relay address
- Manage the association lifecycle (the TCP control connection must stay open)
The routing logic in src/server.ts would need updating to detect when an incoming request is for UDP and dispatch to the appropriate handler.
This depends on having incoming UDP support first (see related ticket #633), since we need to accept UDP from clients before we can forward it anywhere.
Metadata
Metadata
Assignees
Labels
No labels