Class: BrighterPlanet::Deploy::AuthoritativeDnsResolver
- Inherits:
-
Object
- Object
- BrighterPlanet::Deploy::AuthoritativeDnsResolver
- Defined in:
- lib/brighter_planet_deploy/authoritative_dns_resolver.rb
Constant Summary collapse
- NAMESERVERS =
sabshere 5/4/11 last updated
{ 'ns1.easydns.com' => '64.68.192.10', 'ns2.easydns.com' => '72.52.2.1', }
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
Class Method Summary collapse
Instance Method Summary collapse
-
#empty_config_file_path ⇒ Object
net-dns always looks for this, so give it something empty.
- #getaddress ⇒ Object
-
#initialize(domain) ⇒ AuthoritativeDnsResolver
constructor
A new instance of AuthoritativeDnsResolver.
Constructor Details
#initialize(domain) ⇒ AuthoritativeDnsResolver
Returns a new instance of AuthoritativeDnsResolver.
19 20 21 |
# File 'lib/brighter_planet_deploy/authoritative_dns_resolver.rb', line 19 def initialize(domain) @domain = domain end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
17 18 19 |
# File 'lib/brighter_planet_deploy/authoritative_dns_resolver.rb', line 17 def domain @domain end |
Class Method Details
.getaddress(domain) ⇒ Object
12 13 14 |
# File 'lib/brighter_planet_deploy/authoritative_dns_resolver.rb', line 12 def getaddress(domain) new(domain).getaddress end |
Instance Method Details
#empty_config_file_path ⇒ Object
net-dns always looks for this, so give it something empty
30 31 32 |
# File 'lib/brighter_planet_deploy/authoritative_dns_resolver.rb', line 30 def empty_config_file_path ::File. '../../../support/empty_resolv.conf', __FILE__ end |
#getaddress ⇒ Object
23 24 25 26 27 |
# File 'lib/brighter_planet_deploy/authoritative_dns_resolver.rb', line 23 def getaddress resolver = ::Net::DNS::Resolver.new :nameservers => NAMESERVERS.values, :use_tcp => false, :config_file => empty_config_file_path packet = resolver.search domain, ::Net::DNS::A, ::Net::DNS::IN packet.answer[0].address.to_s end |