Class: HTTPX::Resolver::HTTPS
- Inherits:
-
Object
- Object
- HTTPX::Resolver::HTTPS
show all
- Extended by:
- Forwardable
- Includes:
- ResolverMixin
- Defined in:
- lib/httpx/resolver/https.rb
Constant Summary
collapse
- NAMESERVER =
"https://1.1.1.1/dns-query"
- RECORD_TYPES =
{
"A" => Resolv::DNS::Resource::IN::A,
"AAAA" => Resolv::DNS::Resource::IN::AAAA,
}.freeze
- DEFAULTS =
{
uri: NAMESERVER,
use_get: false,
record_types: RECORD_TYPES.keys,
}.freeze
ResolverMixin::CHECK_IF_IP
Constants included
from Loggable
Loggable::COLORS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#uncache
Methods included from Loggable
#log, #log_exception
Methods included from Callbacks
#emit, #on, #once, #only
Constructor Details
#initialize(options) ⇒ HTTPS
Returns a new instance of HTTPS.
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/httpx/resolver/https.rb', line 31
def initialize(options)
@options = Options.new(options)
@resolver_options = DEFAULTS.merge(@options.resolver_options)
@_record_types = Hash.new { |types, host| types[host] = @resolver_options[:record_types].dup }
@queries = {}
@requests = {}
@connections = []
@uri = URI(@resolver_options[:uri])
@uri_addresses = nil
@resolver = Resolv::DNS.new
@resolver.timeouts = @resolver_options.fetch(:timeouts, Resolver::RESOLVE_TIMEOUT)
end
|
Instance Attribute Details
#pool=(value) ⇒ Object
29
30
31
|
# File 'lib/httpx/resolver/https.rb', line 29
def pool=(value)
@pool = value
end
|
Instance Method Details
#<<(connection) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/httpx/resolver/https.rb', line 44
def <<(connection)
return if @uri.origin == connection.origin.to_s
@uri_addresses ||= ip_resolve(@uri.host) || system_resolve(@uri.host) || @resolver.getaddresses(@uri.host)
if @uri_addresses.empty?
ex = ResolveError.new("Can't resolve DNS server #{@uri.host}")
ex.set_backtrace(caller)
throw(:resolve_error, ex)
end
early_resolve(connection) || resolve(connection)
end
|
#closed? ⇒ Boolean
58
59
60
|
# File 'lib/httpx/resolver/https.rb', line 58
def closed?
true
end
|
#empty? ⇒ Boolean
62
63
64
|
# File 'lib/httpx/resolver/https.rb', line 62
def empty?
true
end
|