Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶ added in v1.8.7
type Cacher ¶ added in v1.5.0
type Cacher interface { Add(key, value interface{}) Get(key interface{}) (value interface{}, ok bool) }
type DNS ¶
type DNS struct { DOH DOH DNS53 DNS53 Manager *endpoint.Manager // contains filtered or unexported fields }
func (*DNS) CacheStats ¶ added in v1.8.7
func (r *DNS) CacheStats() CacheStats
type DNS53 ¶ added in v1.2.0
type DNS53 struct { Dialer *net.Dialer // Cache defines the cache storage implementation for DNS response cache. If // nil, caching is disabled. Cache Cacher // CacheMaxAge defines the maximum age in second allowed for a cached entry // before being considered stale regardless of the records TTL. CacheMaxAge uint32 // MaxTTL defines the maximum TTL value that will be handed out to clients. // The specified maximum TTL will be given to clients instead of the true // TTL value if it is lower. The true TTL value is however kept in the cache // to evaluate cache entries freshness. MaxTTL uint32 }
DNS53 is a DNS53 implementation of the Resolver interface.
type DOH ¶
type DOH struct { // URL specifies the DoH upstream URL. URL string // GetProfileURL provides a DoH upstream url for q. If GetProfileURL is // defined, URL is ignored. GetProfileURL func(q query.Query) (url, profile string) // Cache defines the cache storage implementation for DNS response cache. If // nil, caching is disabled. Cache Cacher // CacheMaxAge defines the maximum age in second allowed for a cached entry // before being considered stale regardless of the records TTL. CacheMaxAge uint32 // MaxTTL defines the maximum TTL value that will be handed out to clients. // The specified maximum TTL will be given to clients instead of the true // TTL value if it is lower. The true TTL value is however kept in the cache // to evaluate cache entries freshness. MaxTTL uint32 // ExtraHeaders specifies headers to be added to all DoH requests. ExtraHeaders http.Header // ClientInfo is called for each query in order gather client information to // embed with the request. ClientInfo func(query.Query) ClientInfo // contains filtered or unexported fields }
DOH is a DNS over HTTPS implementation of the Resolver interface.
type ResolveInfo ¶ added in v1.2.7
type Resolver ¶
type Resolver interface { // Resolve send q and write the response into buf. If buf too small, // response is truncated. It is fine to reuse the same []byte for q.Payload // and buf. // // When caching is enabled, a cached response is returned if a valid entry // is found in the cache for q. In case of err with cache enabled, an // expired fallback entry may be stored in buf. In such case, n is > 0. Resolve(ctx context.Context, q query.Query, buf []byte) (n int, i ResolveInfo, err error) }
Resolver is an interface to a type that send q to a resolver using a specific transport.
func New ¶
New instances a DNS53 or DoH resolver for endpoint.
Supported format for servers are:
- DoH: https://doh.server.com/path
- DoH: https://doh.server.com/path#1.2.3.4 // with bootstrap
- DoH: https://doh.server.com/path,https://doh2.server.com/path
- DNS53: 1.2.3.4
- DNS53: 1.2.3.4,1.2.3.5
Click to show internal directories.
Click to hide internal directories.