dnscache

package
v0.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dnscache exports DNS caching utilities for http.DialContexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialContext added in v0.23.0

func DialContext(ttl int) func(context.Context, string, string) (net.Conn, error)

DialContext returns an http.DialContext with DNS caching. Cached DNS entries are refreshed by a ticker, with the given TTL as the number of seconds to wait before refreshing the cache.

func Disable

func Disable()

Disable resets the default dial context back to http.Transport's DialContext.

func Enable

func Enable(ttl int)

Enable adds caching to DNS lookups, performed by the standard library's http.DefaultTransport. TTL in this case doesn't truly mean TTL for an address; rather, it determines the number of seconds to use for the cache refresh interval.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL