hostnames for all
- DNS Server:
ipname.me
- site: https://www.ipname.me/
This is a free public service that resolves any domain name to it's IP address. If no IP Address in the hostname, then this dns service will reply with your IP Address usage
192.168.1.1.ipname.me ---> 192.168.1.1
foo.192.168.1.1.ipname.me ---> 192.168.1.1
www.192-168-1-1-ipname.me ---> 192.168.1.1
but
thisisnotarealdomain.tld ---> 116.202.176.26
$ dig +short @ipname.me 10.20.30.40
10.20.30.40
$ dig +short @ipname.me www.192.168.1.1
192.168.1.1
$ dig +short @ipname.me www.192-168-1-1-ipname.me
192.168.1.1
$ dig +short @ipname.me example-93.184.216.34-org
93.184.216.34
but
$ dig +short @ipname.me googleyahoo.com
116.202.176.26
dnsdist supports Lua via LuaJIT, so we can use string.match for our pattern matching.
string.match(reply, "%d+%.%d+%.%d+%.%d+")
then we access the FFI library, which allows calling external C functions and using C data structures from pure Lua code. And with the help of INET_PTON, we can validate the IPv4 from the hostname!
The entire configuration is about 42lines!!! You can check it here: [dnsdist.conf](dnsdist.conf)
update:
inspired by xip.io & ifconfig.co
This is only for testing purposes, do not use it for production service.