Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
// 缓存刷新时间(默认:80s)
CacheRefreshAfter time.Duration
}
CacheResolverConfig 缓存域名解析器选项
type Resolver ¶
type Resolver interface {
// Resolve 解析域名的 IP 地址
Resolve(context.Context, string) ([]net.IP, error)
// FeedbackGood 反馈一批 IP 地址请求成功
FeedbackGood(context.Context, string, []net.IP)
// FeedbackBad 反馈一批 IP 地址请求失败
FeedbackBad(context.Context, string, []net.IP)
}
Resolver 域名解析器的接口
func NewCacheResolver ¶
func NewCacheResolver(resolver Resolver, opts *CacheResolverConfig) (Resolver, error)
NewCacheResolver 创建带缓存功能的域名解析器
Click to show internal directories.
Click to hide internal directories.