Using resolv.rb

Can someone point me to some documentation that shows me with examples
how to use that ruby library?

I was just trying to point the resolver at a specific DNS server, but
had trouble figuring out how to do it.

I found the Resolv documentation, but non of the examples showed how
to change what dns server the resolver library used to resolve the
names.

Thanks for any pointers.

Mike B.

Adam B. wrote:

On 6/28/07, barjunk [email protected] wrote:

Example ( verified ):

require ‘resolv’
Resolv::DNS.open({:nameserver=>[“206.13.28.12”]}) do |r|
puts r.getaddress(“www.google.com”)
end

-Adam

Hi Adam…
:nameserver=>[“206.13.28.12”]
here the nameserver can have any LIVE IP right?? i mean i tried changing
this IP and used one of my own server IPs… and it worked the same…
please correct me if I am going wrong …

On 6/28/07, barjunk [email protected] wrote:

Can someone point me to some documentation that shows me with examples
how to use that ruby library?

I was just trying to point the resolver at a specific DNS server, but
had trouble figuring out how to do it.

I found the Resolv documentation, but non of the examples showed how
to change what dns server the resolver library used to resolve the
names.

Looks like the source code has some stuff that didn’t make it to the
documentation:

== Resolv::DNS classDNS stub resolver.=== class methods—
Resolv::DNS.new(config_info=nil)
((|config_info|)) should be nil, a string or a hash. If nil is given,
/etc/resolv.conf and platform specific information is used. If a
string
is given, it should be a filename which format is same as
/etc/resolv.conf. If a hash is given, it may contains information for
nameserver, search and ndots as follows. Resolv::DNS.new
({:nameserver=>[“210.251.121.21”], :search=>[“ruby-lang.org”],
:ndots=>1})

— Resolv::DNS.open(config_info=nil)
— Resolv::DNS.open(config_info=nil) {|dns| …}

Example ( verified ):

require ‘resolv’
Resolv::DNS.open({:nameserver=>[“206.13.28.12”]}) do |r|
puts r.getaddress(“www.google.com”)
end

-Adam