Sha256: ebad9cdfab84c955f7832ee26534884d1243c76bddd019903bb8856d57c4d61f
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
require 'irrc/irr' module Irrc module Whoisd module Api private def expand_set_command(as_set, sources, type) "-k -r #{source_option(sources)} -T #{type} #{as_set}" end def parse_objects_from_set(result) if result =~ error_code raise $1 end result.scan(Irrc::Irr.members_tag).flatten.map {|i| i.split /\s*,?\s+/ }.flatten end def expand_route_set_command(route_set, sources) if sources && !sources.empty? "-k -r -s #{sources.join(',')} -T route-set #{route_set}" else "-k -r -a -T route-set #{route_set}" end end def expand_aut_num_command(autnum, sources) "-k -r #{source_option(sources)} -K -i origin #{autnum}" end def parse_prefixes_from_aut_num(result, protocol) result.scan(Irrc::Irr.route_tag(protocol)).flatten.uniq end # See http://www.ripe.net/data-tools/support/documentation/ripe-database-query-reference-manual#a1--ripe-database-query-server-response-codes-and-messages for the error code def error_code /^%ERROR:(.*)$/ end def return_code /\n\n\n/ end def source_option(sources) if sources && !sources.empty? "-s #{sources.join(',')}" else '-a' end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
irrc-0.2.1 | lib/irrc/whoisd/api.rb |
irrc-0.2.0 | lib/irrc/whoisd/api.rb |
irrc-0.1.0 | lib/irrc/whoisd/api.rb |