Class: HTTPX::Resolver::HTTPS

Inherits:
Resolver
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httpx/resolver/https.rb,
sig/resolver/https.rbs

Overview

Implementation of a DoH name resolver (https://www.youtube.com/watch?v=unMXvnY2FNM). It wraps an HTTPX::Connection object which integrates with the main session in the same manner as other performed HTTP requests.

Defined Under Namespace

Modules: DNSExtensions

Constant Summary collapse

NAMESERVER =

Returns:

  • (String)
"https://1.1.1.1/dns-query"
DEFAULTS =

Returns:

  • (Hash[Symbol, untyped])
{
  uri: NAMESERVER,
  use_get: false,
}.freeze
FAMILY_TYPES =

Returns:

  • (Hash[singleton(Resolv::DNS::Resource), String])

Constants inherited from Resolver

Resolver::RECORD_TYPES

Constants included from Loggable

Loggable::COLORS, Loggable::USE_DEBUG_LOG

Instance Attribute Summary collapse

Attributes inherited from Resolver

#current_selector, #current_session, #multi, #options

Instance Method Summary collapse

Methods inherited from Resolver

#closed?, #each_connection, #early_resolve, #emit_addresses, #empty?, #force_close, #handle_error, #initial_call, #lazy_resolve, multi?, #on_error, #on_io_error

Methods included from Loggable

#log, #log_exception, log_identifiers

Methods included from _Selectable

#force_close, #initial_call, #interests, #on_error, #on_io_error, #timeout

Instance Attribute Details

#family ⇒ ip_family (readonly)

Returns the value of attribute family.

Returns:

  • (ip_family)


11
12
13
# File 'sig/resolver/https.rbs', line 11

def family
  @family
end

#pool=(value) ⇒ Object (writeonly)

Sets the attribute pool

Parameters:

  • value (Pool) —

    the value to set the attribute pool to.



25
26
27
# File 'sig/resolver/https.rbs', line 25

def pool=(value)
  @pool = value
end

Instance Method Details

#<<(connection) ⇒ void

This method returns an undefined value.

Parameters:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/httpx/resolver/https.rb', line 56

def <<(connection)
  return if @uri.origin == connection.peer.to_s

  @uri_addresses ||= @options.resolver_cache.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)
    connection.force_close
    throw(:resolve_error, ex)
  end

  resolve(connection)
end

#call ⇒ void

This method returns an undefined value.



34
# File 'sig/resolver/https.rbs', line 34

def call: () -> void

#close ⇒ void

This method returns an undefined value.



36
# File 'sig/resolver/https.rbs', line 36

def close: () -> void

#closed_for_select? ⇒ Boolean

Returns:

  • (Boolean)


40
# File 'sig/resolver/https.rbs', line 40

def closed_for_select?: () -> bool

#connecting? ⇒ Boolean

delegated to resolver connection

Returns:

  • (Boolean)


30
# File 'sig/resolver/https.rbs', line 30

def connecting?: () -> bool

#deactivate ⇒ void

This method returns an undefined value.



42
# File 'sig/resolver/https.rbs', line 42

def deactivate: () -> void

#handle_socket_timeout ⇒ void

This method returns an undefined value.

Parameters:

  • interval (interval)


48
# File 'sig/resolver/https.rbs', line 48

def handle_socket_timeout: (interval interval) -> void

#inflight? ⇒ Boolean

Returns:

  • (Boolean)


46
# File 'sig/resolver/https.rbs', line 46

def inflight?: () -> bool

#state ⇒ Object



52
53
54
# File 'lib/httpx/resolver/https.rb', line 52

def state
  @resolver_connection&.state || :idle
end

#terminate ⇒ void

This method returns an undefined value.



44
# File 'sig/resolver/https.rbs', line 44

def terminate: () -> void

#to_io ⇒ IO

Returns:

  • (IO)


32
# File 'sig/resolver/https.rbs', line 32

def to_io: () ->  IO