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

Not convenient to call bind_with_addr to make a AsyncResolver #2188

Open
hainesc opened this issue Apr 20, 2024 · 3 comments
Open

Not convenient to call bind_with_addr to make a AsyncResolver #2188

hainesc opened this issue Apr 20, 2024 · 3 comments

Comments

@hainesc
Copy link

hainesc commented Apr 20, 2024

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Maybe I have missed something, but AFAIK, it is not convenient to call bind_with_addr when I want to make dns resolver with a specific network interface.

Now I can write as below:

let (config, options) = trust_dns_resolver::system_conf::read_system_conf()?;

// but how can I set bind addr for config here. Since `set_bind_addr` is a method of `NameServerConfigGroup`, but `name_servers` in ResolverConfig is not public.

let provider = ...
let resolver = trust_dns_resolver::new_with_conn(config, options, provider)

I don't like copy the code how trust_dns_resolver::system_conf::read_system_conf() does and set bind addr there.

Describe the solution you'd like
A clear and concise description of what you want to happen.

And I think make a method named set_bind_addr for ResolverConfig will be a simple solution.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

https://github.com/hickory-dns/hickory-dns/blob/main/crates/resolver/src/config.rs#L827

@hainesc
Copy link
Author

hainesc commented Apr 20, 2024

If that is acceptable, I can make a PR ASAP.

@hainesc
Copy link
Author

hainesc commented Apr 20, 2024

Related issue:
#2087

@djc
Copy link
Collaborator

djc commented Apr 22, 2024

bind_addr is a public property of NameServerConfig so by itself that seems easy enough to change. I guess it might be okay to expose a groups_mut() accessor on ResolverConfig and a servers_mut() accessor on NameServerGroup?

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

No branches or pull requests

2 participants