[Feature] SOCKS Proxy support
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
- I'd be willing to implement this feature
- This feature can already be implemented through a plugin
Describe the user story
I'm an employee at a corporation using a private NPM registry. This registry is only reachable from within the local network. I'd like to use a SOCKS5 proxy to connect to it.
Describe the solution you'd like
Ideally, Yarn would support SOCKS proxies in addition to the already supported HTTP(S) proxies out of the box. socksProxy might be a new configuration option in addition to httpProxy and httpsProxy.
Then request in httpUtils.ts can construct an instance of socks-proxy-agent as appropriate.
To my understanding this should enable the use of a SOCKS proxy consistently across all plugins using HTTP (from the core library).
Describe the drawbacks of your solution
Yarn will have an extra dependency for all users, even those not wishing to use a SOCKS proxy. The dependency, however, is very actively used and seems well-maintained.
Describe alternatives you've considered
It would be possible to implement this by effectively forking plugin-npm, however I would hardly consider that more than a hack.
Alternatively, it might be possible to extend the plugin API to be able to supply arbitrary proxies as long as they conform to the interface. Right now I couldn't name another type of proxies other than HTTP(S) (already supported) and SOCKS that would be relevant to Yarn, so I believe that extracting this into a plugin would also be overkill.
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 with packages/berry-core/sources/Configuration.ts and packages/berry-core/sources/httpUtils.ts, especially the existing httpProxy and httpsProxy handling. Trace how request constructs proxy agents, then confirm the SOCKS5 option works consistently for core HTTP users and plugins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100