resolver

package
v7.21.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheResolverConfig

type CacheResolverConfig struct {
	// 压缩周期(默认:60s)
	CompactInterval time.Duration

	// 持久化路径(默认:$TMPDIR/qiniu-golang-sdk/resolver_01.cache.json)
	PersistentFilePath string

	// 持久化周期(默认:60s)
	PersistentDuration time.Duration

	// 缓存有效期(默认:120s)
	CacheLifetime time.Duration
}

CacheResolverConfig 缓存域名解析器选项

type Resolver

type Resolver interface {
	// Resolve 解析域名的 IP 地址
	Resolve(context.Context, string) ([]net.IP, error)
}

Resolver 域名解析器的接口

func NewCacheResolver

func NewCacheResolver(resolver Resolver, opts *CacheResolverConfig) (Resolver, error)

NewCacheResolver 创建带缓存功能的域名解析器

func NewDefaultResolver

func NewDefaultResolver() Resolver

NewDefaultResolver 创建默认的域名解析器

func NewResolver

func NewResolver(fn func(context.Context, string) ([]net.IP, error)) Resolver

NewResolver 创建自定义的域名解析器

Jump to

Keyboard shortcuts

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