-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
The NewXYZ pattern is limiting in the maximum number of parameters that could be encoded in the method.
There was a problem hiding this 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.
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.
I am not aware of anything I should add, please let me know if there are any further issues with this PR |
There was a problem hiding this 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
.
Superseded by #92. |
This should fix #40
The
dns.Client
exposesDialer: 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.