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

Add net.Dialer override, configurable through options #56

Closed
wants to merge 5 commits into from

Conversation

rtreffer
Copy link

This should fix #40

The dns.Client exposes Dialer: net.Dialer which can be used to specify the local IP address (and various other options).

The NewXXX methods started to become larger and larger, so I've added an Options based configuration / constructor - a common way to expose more options to clients without opening the datastructure.

Feel free to mangle this in any way you like. I saw #40 and thought I could need something like this and hacked it up.

The NewXYZ pattern is limiting in the maximum number of parameters
that could be encoded in the method.
Copy link
Member

@ydnar ydnar left a comment

Choose a reason for hiding this comment

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

Thanks! This is probably something we should do, and this is a good start. I’d love to see more tests, and unexport the option type, so it can be changed later if necessary.

resolver.go Outdated Show resolved Hide resolved
resolver.go Outdated Show resolved Hide resolved
resolver.go Outdated Show resolved Hide resolved
resolver_test.go Outdated Show resolved Hide resolved
The ResolverOption type is a public alias for the private
resolverOption - useful e.g. if multiple reoslver should use the
same settings.

The resolverOption is now potentially returning an error.
resolver.go Outdated Show resolved Hide resolved
@case
Copy link
Contributor

case commented Aug 30, 2021

@rtreffer @ydnar just checking in on this PR, are we waiting for any other changes?

@rtreffer
Copy link
Author

I am not aware of anything I should add, please let me know if there are any further issues with this PR

Copy link
Member

@ydnar ydnar left a comment

Choose a reason for hiding this comment

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

Hi there, thanks for your patience.

The public API looks good, but the internal implementation should be tweaked. The main issue is that the various cache options (Expiring and WithCapacity) both create a cache.

A simple fix could be to add a capacity int field to Resolver, and then create the cache once after the various options are run on the *Resolver.

@case
Copy link
Contributor

case commented Oct 7, 2021

@rtreffer just checking in here, did you see @ydnar's comment above?

@case
Copy link
Contributor

case commented Jun 14, 2023

Superseded by #92.

@case case closed this Jun 14, 2023
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.

Ability to specify source address of requests [Feature Request]
4 participants