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

Allow disabling autoSelectFamily in an Agent #4070

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hitsthings
Copy link

@hitsthings hitsthings commented Feb 28, 2025

Currently the options are only passed if they enable autoSelectFamily. However, if autoSelectFamily is the default, we want to be able to disable it too.

Noticed this while debugging nodejs/node#47822 (comment)

This relates to...

nodejs/node#47822 (comment)

Rationale

Currently this claims to accept a boolean but really only accepts true.

Changes

React to the autoSelectFamily option if it is passed in.

Features

Agent's can disable autoSelectFamily

Breaking Changes and Deprecations

None?

Status

Currently the options are only passed if they enable autoSelectFamily. However, if autoSelectFamily is the default, we want to be able to disable it too.
- Also add tests.
- Fix types so that partial options can be passed
  to buildConnector without violating the TypeScript.
  For example, TcpNet options require 'port' but the options
  we pass should not.
@hitsthings hitsthings marked this pull request as ready for review February 28, 2025 03:43
@@ -70,7 +70,7 @@ export declare namespace Client {
/** TODO */
maxRedirections?: number;
/** TODO */
connect?: buildConnector.BuildOptions | buildConnector.connector;
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
Copy link
Author

@hitsthings hitsthings Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Agent({ connect: { autoSelectFamily: true } }) is not actually considered valid currently because it doesn't specify required properties of buildConnector.BuildOptions. But the rest of the options come from elsewhere (hence why connect itself is not a required property) so you don't need to specify everything.

@hitsthings
Copy link
Author

Let me know if I need to do something about those tests. They seem unrelated to this afaict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants