Documentation
¶
Index ¶
- Constants
- func IsIP(s string) bool
- func Proxy_net_DialCached(network string, addr string, proxyoptions options.ProxyOptionsDNSSLICE, ...) (net.Conn, error)
- func Proxy_net_DialContextCached(ctx context.Context, network string, addr string, ...) (net.Conn, error)
- func ResolveUpstreamDomainToIPs(upstreamAddress string, proxyoptions options.ProxyOptionsDNSSLICE, ...) ([]net.IP, error)
- func Shuffle[T any](slice []T)
- type AOFEntry
- type CachingResolver
- type Config
- type DNSCache
- func (dc *DNSCache) Close()
- func (dc *DNSCache) Delete(dnsType, domain string)
- func (dc *DNSCache) Flush()
- func (dc *DNSCache) Get(dnsType, domain string) (interface{}, bool)
- func (dc *DNSCache) GetIP(dnsType, domain string) (net.IP, bool)
- func (dc *DNSCache) GetIPs(dnsType, domain string) ([]net.IP, bool)
- func (dc *DNSCache) ItemCount() int
- func (dc *DNSCache) Load() error
- func (dc *DNSCache) Save() error
- func (dc *DNSCache) Set(dnsType, domain string, value interface{}, ttl time.Duration)
- func (dc *DNSCache) SetIP(dnsType, domain string, ip net.IP, ttl time.Duration)
- func (dc *DNSCache) SetIPs(dnsType, domain string, ips []net.IP, ttl time.Duration)
- func (dc *DNSCache) Stats() map[string]interface{}
- type DOH3Resolver
- type DOHResolver
- type ErrorArray
- type HostsAndDohResolver
- type HostsResolver
- type NameResolver
- func CreateDOH3ResolverCached(Proxy func(*http.Request) (*url.URL, error), ...) NameResolver
- func CreateDOHResolverCached(Proxy func(*http.Request) (*url.URL, error), ...) NameResolver
- func CreateHostsAndDohResolverCached(proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, ...) NameResolver
- func CreateHostsAndDohResolverCachedSimple(proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, ...) NameResolver
- func CreateHostsResolverCached(dnsCache *DNSCache) NameResolver
- type Record
Constants ¶
View Source
const ( // DefaultTTL 默认缓存时间 10 分钟 DefaultTTL = 10 * time.Minute // DefaultCleanupInterval 默认清理间隔 5 分钟 DefaultCleanupInterval = 5 * time.Minute // DefaultSaveInterval 默认全量保存间隔 30 秒 DefaultSaveInterval = 30 * time.Second // DefaultAOFInterval 默认AOF增量保存间隔 1 秒 DefaultAOFInterval = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func Proxy_net_DialCached ¶
func Proxy_net_DialCached(network string, addr string, proxyoptions options.ProxyOptionsDNSSLICE, upstreamResolveIPs bool, dnsCache *DNSCache, Proxy func(*http.Request) (*url.URL, error), tranportConfigurations ...func(*http.Transport) *http.Transport) (net.Conn, error)
Proxy_net_DialCached 带DNS缓存的网络连接拨号函数
func Proxy_net_DialContextCached ¶
func Proxy_net_DialContextCached(ctx context.Context, network string, addr string, proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, upstreamResolveIPs bool, Proxy func(*http.Request) (*url.URL, error), tranportConfigurations ...func(*http.Transport) *http.Transport) (net.Conn, error)
Proxy_net_DialContextCached 带DNS缓存的上下文网络连接拨号函数
func ResolveUpstreamDomainToIPs ¶
func ResolveUpstreamDomainToIPs(upstreamAddress string, proxyoptions options.ProxyOptionsDNSSLICE, dnsCache interface{}, Proxy func(*http.Request) (*url.URL, error), tranportConfigurations ...func(*http.Transport) *http.Transport) ([]net.IP, error)
ResolveUpstreamDomainToIPs 解析上游代理地址到IP地址
Types ¶
type AOFEntry ¶
type AOFEntry struct {
Timestamp time.Time `json:"timestamp"`
Operation string `json:"operation"` // "SET" or "DELETE"
Key string `json:"key"`
Value interface{} `json:"value,omitempty"`
TTL int64 `json:"ttl,omitempty"` // TTL秒数
}
AOFEntry AOF日志条目
type CachingResolver ¶
type CachingResolver struct {
// contains filtered or unexported fields
}
CachingResolver 包装器,为DNS解析添加缓存功能
func NewCachingResolver ¶
func NewCachingResolver(original NameResolver, cache *DNSCache) *CachingResolver
NewCachingResolver 创建一个新的带缓存的解析器
type Config ¶
type Config struct {
FilePath string `json:"file_path"`
AOFPath string `json:"aof_path"`
DefaultTTL time.Duration `json:"default_ttl"`
CleanupInterval time.Duration `json:"cleanup_interval"`
SaveInterval time.Duration `json:"save_interval"`
AOFInterval time.Duration `json:"aof_interval"`
Enabled bool `json:"enabled"`
}
Config DNS缓存配置
type DNSCache ¶
type DNSCache struct {
// contains filtered or unexported fields
}
DNSCache DNS缓存管理器
func NewWithConfig ¶
NewWithConfig 使用配置创建DNS缓存实例
type DOH3Resolver ¶
type DOH3Resolver struct {
// contains filtered or unexported fields
}
type DOHResolver ¶
type DOHResolver struct {
Proxy func(*http.Request) (*url.URL, error)
// contains filtered or unexported fields
}
type HostsAndDohResolver ¶
type HostsAndDohResolver struct {
Proxy func(*http.Request) (*url.URL, error)
// contains filtered or unexported fields
}
type HostsResolver ¶
type HostsResolver struct{}
type NameResolver ¶
type NameResolver interface {
Resolve(ctx context.Context, name string) (context.Context, net.IP, error)
LookupIP(ctx context.Context, network, host string) ([]net.IP, error)
}
NameResolver 接口定义
func CreateDOH3ResolverCached ¶
func CreateDOH3ResolverCached(Proxy func(*http.Request) (*url.URL, error), proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache) NameResolver
CreateDOH3ResolverCached 创建带缓存的DOH3解析器
func CreateDOHResolverCached ¶
func CreateDOHResolverCached(Proxy func(*http.Request) (*url.URL, error), proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, transportConfigurations ...func(*http.Transport) *http.Transport) NameResolver
CreateDOHResolverCached 创建带缓存的DOH解析器
func CreateHostsAndDohResolverCached ¶
func CreateHostsAndDohResolverCached(proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, Proxy func(*http.Request) (*url.URL, error), transportConfigurations ...func(*http.Transport) *http.Transport) NameResolver
CreateHostsAndDohResolverCached 创建带缓存的Hosts+DOH解析器
func CreateHostsAndDohResolverCachedSimple ¶
func CreateHostsAndDohResolverCachedSimple(proxyoptions options.ProxyOptionsDNSSLICE, dnsCache *DNSCache, Proxy func(*http.Request) (*url.URL, error), transportConfigurations ...func(*http.Transport) *http.Transport) NameResolver
CreateHostsAndDohResolverCachedSimple 创建带缓存的Hosts+DOH解析器
func CreateHostsResolverCached ¶
func CreateHostsResolverCached(dnsCache *DNSCache) NameResolver
CreateHostsResolverCached 创建带缓存的Hosts解析器
Click to show internal directories.
Click to hide internal directories.