class Irrc::Whoisd::Client
Public: Whoisd
client worker.
Private Instance Methods
expand_aut_num(query)
click to toggle source
Public: Expand an aut-num object into routes
# File lib/irrc/whoisd/client.rb, line 68 def expand_aut_num(query) return if query.protocols.empty? result = cache(query.object, query.sources) { begin command = expand_aut_num_command(query.object, query.sources) execute(command) rescue raise "'#{command}' failed on '#{@fqdn}' (#{$!.message})." end } query.protocols.each do |protocol| query.add_prefix_result parse_prefixes_from_aut_num(result, protocol), query.object, protocol end end
expand_set(query, type)
click to toggle source
Public: Expand an as-set or route-set object into any object.
# File lib/irrc/whoisd/client.rb, line 40 def expand_set(query, type) result = cache(query.object, query.sources) { begin command = expand_set_command(query.object, query.sources, type) execute(command) rescue raise "'#{command}' failed on '#{@fqdn}' (#{$!.message})." end } parse_objects_from_set(result).each do |object| next if query.ancestor_object?(object) child = query.fork(object) case child.object_type when 'aut-num' query.add_aut_num_result object when nil # it looks prefix which is a member of route-set prefix = classify_by_protocol(object) query.protocols.each do |protocol| query.add_prefix_result prefix[protocol], nil, protocol end end end end
process(query)
click to toggle source
# File lib/irrc/whoisd/client.rb, line 26 def process(query) case query.object_type when 'as-set' expand_set query, 'as-set' when 'route-set' expand_set query, 'route-set' when 'aut-num' expand_aut_num query end query end