Closed ibc closed 13 years ago
Michael Tokarev probed that it can work if the enviroment variable NAMESERVERS is set:
The only trap that comes to mind is that you didn't export NAMESERVERS variable so it's not available in subprocesses.
Check this:
NAMESERVERS=127.0.0.2 dnsget -vv foo.barit will tell where it is sending queries to (if nothing is listening on 127.0.0.2 it will just time out).
NAMESERVERS=127.0.0.2; dnsget -vv foo.bar(note the semicolon) -- this will change nothing, dnsget will use regular nameservers listed in /etc/resolv.conf. And this:
export NAMESERVERS=127.0.0.2; dnsget -vv foo.barwill use 127.0.0.1 again.
So it seems that the way I set the enviroment NAMESERVERS variable:
ENV["NAMESERVERS"] = .....
is not valid as udns doesn't see it as an enviroment variable. I must fix that.
I must set ENV["NAMESERVERS"] before initializing the EM::Udns::Resolver instance, as udns is loaded when allocating the class (which happens before "initialize" method). So I must create a new class method for it.
It seems that udns always takes the list of nameservers from /etc/resolv.conf, regardless of the existance of the NAMESERVERS enviroment variable. Extracted from udns documentation:
So passing an IP (a nameserver) to
EM::Udns::Resolver.new
doesn't work. Must be investigated and the documentation fixed after that.