Class: Truemail::Dns::Worker
- Inherits:
-
Resolv::DNS
- Object
- Resolv::DNS
- Truemail::Dns::Worker
- Defined in:
- lib/truemail/dns/worker.rb
Constant Summary collapse
- DEFAULT_DNS_PORT =
53
Instance Attribute Summary collapse
-
#dns_gateway ⇒ Object
readonly
Returns the value of attribute dns_gateway.
Instance Method Summary collapse
- #a_record(host_name) ⇒ Object
- #a_records(host_name) ⇒ Object
- #cname_records(host_name) ⇒ Object
- #dns_lookup(host_address) ⇒ Object
-
#initialize(dns_servers) ⇒ Worker
constructor
A new instance of Worker.
- #mx_records(host_name) ⇒ Object
- #ptr_records(host_address) ⇒ Object
Constructor Details
#initialize(dns_servers) ⇒ Worker
Returns a new instance of Worker.
12 13 14 |
# File 'lib/truemail/dns/worker.rb', line 12 def initialize(dns_servers) super(dns_servers.empty? ? nil : config_info(dns_servers)) end |
Instance Attribute Details
#dns_gateway ⇒ Object (readonly)
Returns the value of attribute dns_gateway.
10 11 12 |
# File 'lib/truemail/dns/worker.rb', line 10 def dns_gateway @dns_gateway end |
Instance Method Details
#a_record(host_name) ⇒ Object
20 21 22 |
# File 'lib/truemail/dns/worker.rb', line 20 def a_record(host_name) getaddress(host_name).to_s end |
#a_records(host_name) ⇒ Object
24 25 26 |
# File 'lib/truemail/dns/worker.rb', line 24 def a_records(host_name) getaddresses(host_name).map(&:to_s) end |
#cname_records(host_name) ⇒ Object
28 29 30 |
# File 'lib/truemail/dns/worker.rb', line 28 def cname_records(host_name) getresources(host_name, ::Resolv::DNS::Resource::IN::CNAME) end |
#dns_lookup(host_address) ⇒ Object
16 17 18 |
# File 'lib/truemail/dns/worker.rb', line 16 def dns_lookup(host_address) getname(host_address).to_s end |
#mx_records(host_name) ⇒ Object
32 33 34 |
# File 'lib/truemail/dns/worker.rb', line 32 def mx_records(host_name) getresources(host_name, ::Resolv::DNS::Resource::IN::MX) end |
#ptr_records(host_address) ⇒ Object
36 37 38 |
# File 'lib/truemail/dns/worker.rb', line 36 def ptr_records(host_address) getresources(host_address, ::Resolv::DNS::Resource::IN::PTR) end |