mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-05 00:02:38 -04:00
for multi-backed resolvers, resolving is attempted before sending it to the resolver. in this way, cached, local or ip resolves get propagated to the proper resolver by ip family, instead of the previous mess. the system resolver doesn't do these shenanigans (trust getaddrinfo)
35 lines
1012 B
Plaintext
35 lines
1012 B
Plaintext
module HTTPX
|
|
type ipaddr = IPAddr | String
|
|
|
|
module Resolver
|
|
extend Registry[Symbol, Class]
|
|
|
|
RESOLVE_TIMEOUT: Integer | Float
|
|
|
|
@lookup_mutex: Thread::Mutex
|
|
|
|
type dns_resource = singleton(Resolv::DNS::Resource)
|
|
|
|
type dns_result = { "name" => String, "TTL" => Numeric, "alias" => String }
|
|
| { "name" => String, "TTL" => Numeric, "data" => String }
|
|
|
|
|
|
def nolookup_resolve: (String hostname) -> Array[IPAddr]
|
|
|
|
def ip_resolve: (String hostname) -> Array[IPAddr]?
|
|
|
|
def system_resolve: (String hostname) -> Array[IPAddr]?
|
|
|
|
def self?.cached_lookup: (String hostname) -> Array[IPAddr]?
|
|
|
|
def self?.cached_lookup_set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
|
|
|
|
def self?.lookup: (String hostname, Numeric ttl) -> Array[IPAddr]?
|
|
|
|
def self?.generate_id: () -> Integer
|
|
|
|
def self?.encode_dns_query: (String hostname, ?type: dns_resource) -> String
|
|
|
|
def self?.decode_dns_answer: (String) -> Array[dns_result]
|
|
end
|
|
end |