octodns / octodns-bind

RFC compliant (Bind9) provider for octoDNS
MIT License
7 stars 12 forks source link

dns.resolver.resolver does not refer to /etc/hosts before querying resolver #27

Closed yzguy closed 1 year ago

yzguy commented 1 year ago

Related #24 #25

dns.resolver.resolve() does not refer to /etc/hosts before making a query to a resolver it goes straight to a resolver. This generally is fine if you're referring to a remote server, but if it's running on localhost or something that you've set in /etc/hosts it won't work.

We should probably use socket.getaddrinfo instead which will look at /etc/hosts and then do a query via resolver if it finds nothing.

ross commented 1 year ago

We should probably we socket.gethostbyname instead which will look at /etc/hosts and then do a query via resolver if it finds nothing.

Ah, true. would be a bit tough for people to figure out why their etc/hosts info wasn't getting used.

yzguy commented 1 year ago

I actually had it using socket.getaddrinfo originally, but then thought because we were using dnspython throughout it would be good to stick with that. I want to add a toggle for IPv4/IPv6 too, right now I believe it's just going to query the name and go for an A record if it exists, if not then i believe it'll go for an AAAA, but a user might want it to go IPv6 first.

I'll fix it and give the option to toggle IPv6 or not with like ipv6: true

yzguy commented 1 year ago

This is contained in #28