Sha256: 0fe36aeefd5f313240ce872efeee949332b1c3302fb2a65f8614cfb61f5b2a6d
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true #-- # Ruby Whois # # An intelligent pure Ruby WHOIS client and parser. # # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net> #++ module Whois class Server module Adapters # # = Arin Adapter # # Provides ability to query Arin WHOIS interfaces. # class Arin < Base # Executes a WHOIS query to the Arin WHOIS interface, # resolving any intermediate referral, # and appends the response to the client buffer. # # @param [String] string # @return [void] # def request(string) response = query_the_socket("n + #{string}", host) buffer_append response, host if options[:referral] != false && (referral = extract_referral(response)) response = query_the_socket(string, referral[:host], referral[:port]) buffer_append(response, referral[:host]) end end private def extract_referral(response) return unless response =~ %r{ReferralServer:\s*r?whois://([\w.-]+)(?::(\d+))?} { host: Regexp.last_match(1), port: Regexp.last_match(2)&.to_i, } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whois-6.0.1 | lib/whois/server/adapters/arin.rb |
whois-6.0.0 | lib/whois/server/adapters/arin.rb |