Sha256: 37ccd13042de8114c50068cedf90e3b2a77264ab853e2b27be32159633673fd8
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require 'irrc/irr' module Irrc module Irrd module Api private def persist_command '!!' end # Public: Returns a IRR command to specify authoritative IRR source. # # sources - Array object containing IRR source names. def set_source_command(sources) if sources && !sources.empty? "!s#{sources.join(',')}" else '!s-*' end end def expand_set_command(as_set) "!i#{as_set},1" if as_set && as_set != '' end def parse_aut_nums_from_as_set(result) case result when success_code result.gsub(/^#{$1}$/, '').strip.split.grep(/^AS/).uniq when error_code raise $1 end end def parse_prefixes_from_route_set(result) case result when success_code result.gsub(/^#{$1}$/, '').strip.split.reject {|p| p =~ /^A\d+$/ }.uniq when error_code raise $1 end end def expand_aut_num_command(autnum) "-K -r -i origin #{autnum}" if autnum && autnum != '' end def parse_prefixes_from_aut_num(result, protocol) result.scan(Irrc::Irr.route_tag(protocol)).flatten.uniq end # See http://www.irrd.net/irrd-user.pdf for return codes def success_code /^(C.*)\n$/ end def error_code /^(D|E|F.*)\n$/ end def return_code # Query with ripe option commands like "-i origin AS2515" returns doubled blank lines. # And we can't easily tell whether it succeeded or not. Regexp.union(success_code, error_code, /^\n\n$/) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
irrc-0.2.1 | lib/irrc/irrd/api.rb |
irrc-0.2.0 | lib/irrc/irrd/api.rb |
irrc-0.1.0 | lib/irrc/irrd/api.rb |