lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Apr 12, 2010, at 7:01 PM, Jon Nalley wrote:

> Keep in mind the host running the above code must be using the OpenDNS
> nameservers for DNS.  The IP's of the OpenDNS servers are:
> 208.67.222.222 and 208.67.220.220

Cool :)

% dig @208.67.222.222 myip.opendns.com A +short

Is it possible to pass the DNS server name to query to LuaSocket? Hmmm... apparently not.

dns.lua [1] to the rescue!

local dns = require( 'dns' )

dns._resolver = dns.resolver()
dns._resolver:setnameserver( '208.67.222.222' )
print( dns.lookup( 'myip.opendns.com', 'A', 'IN' ) )


[1] http://ztact.com/software/dns.lua