7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/eventmachine/dnsbl/zone/abstract_zone.rb', line 7
def get_records(query, qtype = Resolv::DNS::Resource::IN::A)
records = Array.new
if qtype != Resolv::DNS::Resource::IN::A
return records
end
zone = label = nil
@zones.each do |z|
if query.end_with?(z)
label = query[0, query.length - z.length - 1]
zone = z
end
end
if zone
get_all_records_for_zone(zone).each do |rec|
if rec[:valid_until] and rec[:valid_until] < Time.now.to_i
next
elsif rec[:label_regex].match(label)
records << rec
end
end
end
records
end
|