From: Adam Bozanich Date: 2007-06-29T09:13:43+09:00 Subject: Re: Using resolv.rb ------=_Part_42218_8588101.1183076024630 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/28/07, barjunk 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 ------=_Part_42218_8588101.1183076024630--