dns

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName    = "dns.resolver"
	ModuleVersion = "1.0.0"

	DefaultCacheSize = 10000
	DefaultCacheTTL  = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Upstream        string
	FakeIPEnabled   bool
	FakeIPRange     string
	CacheEnabled    bool
	CacheSize       int
	CacheTTL        time.Duration
	BlockingEnabled bool
	BlockLists      []string
	DialContext     func(ctx context.Context, network, address string) (net.Conn, error)
	BypassFunc      func(hostname string) bool
	BypassResolver  *net.Resolver
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Validate

func (c *Config) Validate() error

type Resolver

type Resolver struct {
	*base.Module
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) (*Resolver, error)

func NewResolver

func NewResolver(cfg *Config) *Resolver

func (*Resolver) GetUpstream

func (r *Resolver) GetUpstream() string

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, domain string) ([]net.IP, error)

func (*Resolver) ResolveUpstream added in v0.0.4

func (r *Resolver) ResolveUpstream(ctx context.Context, domain string) ([]net.IP, error)

func (*Resolver) SetDialContext

func (r *Resolver) SetDialContext(dialFn func(ctx context.Context, network, address string) (net.Conn, error))

func (*Resolver) SetUpstream

func (r *Resolver) SetUpstream(upstream string)

Jump to

Keyboard shortcuts

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