Feature: Rewrite ProxyAgent
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
This would solve...
I want connectors in undici to be responsible for all connections to the destination server. This allows you to configure agents more flexibly.
The implementation should look like...
I wrote a separate package to show how it is necessary and will be more correct to use a proxy
buildHttpProxyConnector
buildSocksProxyConnector
import {
buildHttpProxyConnector,
buildSocksProxyConnector,
buildSocksProxyChainConnector
} from '@undicijs/proxy';
import { request, Agent } from 'undici';
// Connectors only for wrapping socket connection for distonation host
const httpProxyConnector = buildHttpProxyConnector('http://3proxy:8080');
const socksProxyConnector = buildSocksProxyConnector('socks5://3proxy:1080');
const socksProxyChainConnector = buildSocksProxyChainConnector(['socks5://3proxy:1080', 'socks5://3proxy:1081']);
// Agents managing of openned sockets and dispatching requests
const httpProxyAgent = new Agent({connect: httpProxyConnector});
const socksProxyAgent = new Agent({connect: socksProxyConnector});
const socksProxyChainAgent = new Agent({connect: socksProxyChainConnector});
Additional context
You can look at it in full at https://jsr.io/@undicijs/proxy@0.2.1
I think this would be a better solution. What do you say about this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked @undicijs/proxy implementations in src/http.ts and src/socks.ts, then inspect how undici's ProxyAgent currently manages connections. The requested outcome is for connectors to own destination-server connections while standard Agent instances manage sockets and dispatch requests, including HTTP, SOCKS, and chained SOCKS proxies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- backend-api-design, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100