httpx/sig/resolver/native.rbs
HoneyryderChuck 2940323412 implemented happy eyeballs v2 (rfc8305) for native and https resolver
Two resolver are kept (IPv6/IPv4) along in the pool, to which all
names are sent to and read from in the same pool. IPv4 resolves are
subject to a 50ms delay (as per rfc) before they're used for connecting.
IPv6 addresses have preference, in that if they arrive before the delay,
they are immediately used. If they arrive after the delay, they do not
interrupt the connection, but they'll be the next-in-line in case
connection handshake fails.

Two resolvers are kept, but the inherent Connection will be shared,
thereby sending name resolving requests to the same HTTP/2 connection in
bulk. The resolution delay logic from above also applies.

Currently handles resolving via `resolv` lib. This happens synchronously
though, so we're not there yet.
2022-01-16 22:54:56 +02:00

56 lines
1.2 KiB
Plaintext

module HTTPX
module Resolver
class Native < Resolver
extend Forwardable
include _ToIO
DEFAULTS: Hash[Symbol, untyped]
DNS_PORT: Integer
@family: ip_family
@options: Options
@ns_index: Integer
@nameserver: String
@_timeouts: Array[Numeric]
@timeouts: Hash[String, Array[Numeric]]
@connections: Array[Connection]
@read_buffer: String
@write_buffer: Buffer
attr_reader state: Symbol
def call: () -> void
def interests: () -> io_interests
def <<: (Connection) -> void
def timeout: () -> Numeric?
private
def initialize: (ip_family family, options options) -> void
def calculate_interests: () -> (:r | :w)
def consume: () -> void
def do_retry: () -> void
def dread: (Integer) -> void
| () -> void
def dwrite: () -> void
def parse: (String) -> void
def resolve: (?Connection connection, ?String hostname) -> void
def build_socket: () -> void
def transition: (Symbol nextstate) -> void
def handle_error: (NativeResolveError | StandardError) -> void
end
end
end