TooTallNate / proxy-agents

Node.js HTTP Proxy Agents Monorepo
https://proxy-agents.n8.io
918 stars 238 forks source link

support tls fingerprint args in constructor #328

Open landonsilla opened 1 month ago

landonsilla commented 1 month ago

hey nate! first off big thanks for this package. it has been incredibly valuable for project.

I'm wanting to include the tls ciphers list (and other, similar params) on the agent constructor:

new HttpsProxyAgent('http://user:pass@$example.com:1234' {
  rejectUnauthorized: false,
  ciphers: [
    'ECDHE-ECDSA-AES128-GCM-SHA256',
    'ECDHE-RSA-AES128-GCM-SHA256',
    'ECDHE-ECDSA-AES256-GCM-SHA384',
    'ECDHE-RSA-AES256-GCM-SHA384',
    'DHE-RSA-AES128-GCM-SHA256',
    'DHE-RSA-AES256-GCM-SHA384'
    ].join(':'),
    honorCipherOrder: true,
    secureProtocol: 'TLSv1_2_method',
})

(Btw, i am making GETs to https://check.ja3.zone/ to check if the fingerprint is changing, e.g. the ciphers declaration is effective)

I found that the ciphers, honorCipherOrder, secureProtocol params don't make it to the base http.Agent object, which is needed to have the effect I'm looking for. And, including the constructor opts in the this.options seems to do the trick.

I'll be honest, I don't deeply understand this code. I just know that this code diff has the affect i desire. Perhaps there are keys that should/should not be here???? Perhaps you want a blacklist or whitelist strategy? I see you have the omit function to remove things. I don't have a strong preference on this stuff, I just want ciphers, honorCipherOrder, secureProtocol (and secureOptions) to be included in this.options.

Thanks again! I hope this is helpful.

changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

Latest commit: ffc3fa8c5a20b568fab2112ae2d146dee626f825

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
proxy-agents ✅ Ready (Inspect) Visit Preview Aug 7, 2024 7:39pm