-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
feat(dns): allow custom dns server as cli flag #193
Conversation
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.
Aside from a potentially stray comment, this looks excellent! A nice feature to have!
src/network/dns/resolver.rs
Outdated
Some(dns_server_address) => { | ||
let mut config = ResolverConfig::new(); | ||
let options = ResolverOpts::default(); | ||
// let socket = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(1, 1, 1, 1), 53)); |
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.
Should this comment be removed? Is it something that still needs addressing?
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.
Hot damn, thanks for catching this :)
tls_dns_name: None, | ||
}; | ||
config.add_name_server(nameserver_config); | ||
TokioAsyncResolver::new(config, options, runtime).await? |
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.
It's a shame we can't just change the nameserver of the configuration returned by from_system_conf
, but I think this is the best we can do right now :)
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.
Yeah, for sure. I mostly want this feature as a workaround for issues where we fail to parse resolv.conf, so we'd be panicking by then.
Thanks for the review @TheLostLambda ! |
Since there are some cases in which we don't properly detect the system dns servers to performs reverse dns lookup, I added a CLI option that would allow users to manually specify a dns server as a workaround.
Usage example:
sudo bandwhich --dns-server 1.1.1.1