Documentation
¶
Overview ¶
Package resolve is the proxy's own DNS client.
It exists because the proxy must not be subject to the redirection it installs. In the hosts-file deployment, api.anthropic.com is pointed at this proxy's TLS listener; if the proxy then used the system resolver to reach the real API it would resolve its own address and loop. Querying nameservers directly bypasses /etc/hosts, nsswitch and any local stub resolver that honours them, so "the upstream" always means the real upstream.
It answers A and AAAA queries over UDP, retries over TCP when a response is truncated, caches by TTL, and refuses to dial the proxy's own listeners.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Servers are the nameservers to query, as host or host:port. When empty
// they are discovered from /etc/resolv.conf, skipping loopback stubs.
Servers []string
// Timeout bounds a single query attempt.
Timeout time.Duration
// Static pins hostnames to addresses, answered without any query.
Static map[string][]string
// MinTTL and MaxTTL clamp the cache lifetime of an answer.
MinTTL time.Duration
MaxTTL time.Duration
// Deny lists addresses the dialer refuses to connect to. The proxy's own
// listeners go here, so a hosts-file redirect cannot make it call itself.
Deny []string
// DialTimeout bounds one connection attempt to a resolved address.
DialTimeout time.Duration
}
Config configures the resolver.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver resolves names and dials connections.
func (*Resolver) DialContext ¶
DialContext resolves addr with this resolver and connects to it. It is the DialContext of every outbound http.Transport in the proxy.