Class: AuthDnsCheck::Client
- Inherits:
-
Object
- Object
- AuthDnsCheck::Client
- Defined in:
- lib/auth_dns_check/client.rb
Overview
TODO:
IPv6 not supported
Client for performing authoritative DNS checks
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
default resolver for finding authoritative name servers.
-
#overrides ⇒ Object
readonly
authoritative name server overrides.
Instance Method Summary collapse
-
#all?(fqdn) ⇒ Boolean
Check authoritative agreement for a name.
-
#has_ip?(fqdn, ip) ⇒ Boolean
Check authoritative agreement for the specific address for a name.
-
#initialize(overrides: {}, default: Resolv::DNS.new("/etc/resolv.conf")) ⇒ Client
constructor
Initialize a new Client.
Constructor Details
#initialize(overrides: {}, default: Resolv::DNS.new("/etc/resolv.conf")) ⇒ Client
Initialize a new Client
21 22 23 24 |
# File 'lib/auth_dns_check/client.rb', line 21 def initialize(overrides: {}, default: Resolv::DNS.new("/etc/resolv.conf")) @overrides = overrides @default = default end |
Instance Attribute Details
#default ⇒ Object (readonly)
default resolver for finding authoritative name servers
12 13 14 |
# File 'lib/auth_dns_check/client.rb', line 12 def default @default end |
#overrides ⇒ Object (readonly)
authoritative name server overrides
9 10 11 |
# File 'lib/auth_dns_check/client.rb', line 9 def overrides @overrides end |
Instance Method Details
#all?(fqdn) ⇒ Boolean
TODO:
Records of types other than A not yet supported
Check authoritative agreement for a name
32 33 34 35 |
# File 'lib/auth_dns_check/client.rb', line 32 def all?(fqdn) answers = get_addresses(fqdn) answers.all? { |x| x.any? and x == answers.first } end |
#has_ip?(fqdn, ip) ⇒ Boolean
Check authoritative agreement for the specific address for a name
43 44 45 46 47 48 |
# File 'lib/auth_dns_check/client.rb', line 43 def has_ip?(fqdn, ip) answers = get_addresses(fqdn) answers.all? do |x| x.any? and x.all? { |i| i == ip } end end |