Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[socks-proxy-agent] pass socket_options to SocksClient #302

Merged
merged 6 commits into from
Mar 30, 2024

Conversation

lukekarrys
Copy link
Collaborator

This PR adds the option socketOptions which will get passed along to SocksClient.createConnection as socket_options.

Another solution would be to spread all the unused constructor options to the SocksClient.createConnection options since there are a few more that are allowed. I didn't go this route since I only have a use case for socket_options and I didn't want to couple the two APIs too closely. But I'd be happy to rework this PR if desired.

For reference the SocksClientOptions interface is:

interface SocksClientOptions {
    command: SocksCommandOption;
    destination: SocksRemoteHost;
    proxy: SocksProxy;
    timeout?: number;
    existing_socket?: Duplex;
    set_tcp_nodelay?: boolean;
    socket_options?: SocketConnectOpts;
}

Copy link

changeset-bot bot commented Mar 30, 2024

🦋 Changeset detected

Latest commit: 3586919

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
socks-proxy-agent Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Mar 30, 2024

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

Name Status Preview Updated (UTC)
proxy-agents ✅ Ready (Inspect) Visit Preview Mar 30, 2024 1:08am

Co-authored-by: Nathan Rajlich <[email protected]>
@melroy89
Copy link

CI/CD fails, due to too many socket connections or.. ? 😆

 
  FAIL test/e2e.test.ts (32.526 s)
    HttpsProxyAgent
      ✕ should work over NordVPN proxy (30002 ms)
  
    ● HttpsProxyAgent › should work over NordVPN proxy
  
      thrown: "Exceeded timeout of 30000 ms for a test.
      Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
  
        49 |
        50 | describe('HttpsProxyAgent', () => {
      > 51 | 	it('should work over NordVPN proxy', async () => {
           | 	^
        52 | 		const { NORDVPN_USERNAME, NORDVPN_PASSWORD } = process.env;
        53 | 		if (!NORDVPN_USERNAME) {
        54 | 			throw new Error('`NORDVPN_USERNAME` env var is not defined');
  
        at test/e2e.test.ts:51:2
        at Object.<anonymous> (test/e2e.test.ts:50:1)
  

@lukekarrys lukekarrys merged commit ada656d into main Mar 30, 2024
14 of 15 checks passed
@lukekarrys lukekarrys deleted the lk/socks-proxy-socket-options branch March 30, 2024 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants