class HTTPX::Resolver::HTTPS

  1. lib/httpx/resolver/https.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. <<
  2. closed?
  3. timeout

Included modules

  1. Resolver::ResolverMixin

Constants

DEFAULTS = { uri: NAMESERVER, use_get: false, }.freeze  
NAMESERVER = "https://1.1.1.1/dns-query"  
RECORD_TYPES = { "A" => Resolv::DNS::Resource::IN::A, "AAAA" => Resolv::DNS::Resource::IN::AAAA, }.freeze  

Public Class methods

new (options)
[show source]
   # File lib/httpx/resolver/https.rb
30 def initialize(options)
31   @options = Options.new(options)
32   @resolver_options = Resolver::Options.new(DEFAULTS.merge(@options.resolver_options || {}))
33   @_record_types = Hash.new { |types, host| types[host] = RECORD_TYPES.keys.dup }
34   @queries = {}
35   @requests = {}
36   @connections = []
37   @uri = URI(@resolver_options.uri)
38   @uri_addresses = nil
39 end

Public Instance methods

<< (connection)
[show source]
   # File lib/httpx/resolver/https.rb
41 def <<(connection)
42   return if @uri.origin == connection.origin.to_s
43 
44   @uri_addresses ||= Resolv.getaddresses(@uri.host)
45 
46   if @uri_addresses.empty?
47     ex = ResolveError.new("Can't resolve #{connection.origin.host}")
48     ex.set_backtrace(caller)
49     emit(:error, connection, ex)
50   else
51     early_resolve(connection) || resolve(connection)
52   end
53 end
closed? ()
[show source]
   # File lib/httpx/resolver/https.rb
59 def closed?
60   return true unless @resolver_connection
61 
62   resolver_connection.closed?
63 end
timeout ()
[show source]
   # File lib/httpx/resolver/https.rb
55 def timeout
56   @connections.map(&:timeout).min
57 end