func (r *CacheResolver) Get(domain string) []string {
	r.mu.Lock()
	defer r.mu.Unlock()
	return r.cache[domain]
}
Get gets the currently configured entry for domain, or nil
package resolver
import (
	"context"
	"sync"
)
type CacheResolver struct {
	ReadOnly bool
	Resolver
	mu    sync.Mutex
	cache map[string][]string
}
func (r *CacheResolver) LookupHost(
	ctx context.Context, hostname string) ([]string, error) {
	if entry := r.Get(hostname); entry != nil {
		return entry, nil
	}
	entry, err := r.Resolver.LookupHost(ctx, hostname)
	if err != nil {
		return nil, err
	}
	if r.ReadOnly == false {
		r.Set(hostname, entry)
	}
	return entry, nil
}