amphp / dns

Async DNS resolution for PHP based on Amp.
https://amphp.org/dns
MIT License
157 stars 32 forks source link

Are dotless domains valid? #93

Closed Guuzen closed 4 years ago

Guuzen commented 4 years ago

Didn't find any test that states dotless domains are invalid. Are they valid? If yes - then there is a bug, because resolve method throws exception for dotless domains. If no - maybe test (and probably explicit exception message) that states dotless domains are invalid should be introduced for clarity and stability?

My use case is simple docker development environment where i want to be able to access hosts in same network by containers/services names. They are usually dotless.

kelunik commented 4 years ago

They're valid, yes. If the current config doesn't work with a simple Docker setup, we should remove that restriction again.

Guuzen commented 4 years ago

This exception occurs on my machine because resolv.conf file has no search line in it. According to docker documentation docker mounts resolv.conf from host machine. So if host machine has no search line in resolv.conf then an exception will happen otherwise not. I do not know how often situation with no search line by default happens in popular linux distros (i installed fresh xubuntu 18.04 and there is a search line). But for me it seems like a bug anyway, because in fact docker dns can resolve dotless host without search line.

kelunik commented 4 years ago

Yup. Mind opening a PR? :-)