Documentation
¶
Index ¶
- type DoHServer
- type DoTServer
- type Handler
- type Server
- func (s *Server) GetDNSCache() *cache.DNSCache
- func (s *Server) GetHandler() *Handler
- func (s *Server) GetHostsManager() *hosts.Manager
- func (s *Server) GetRecordStore() *remote.RecordStore
- func (s *Server) GetRulesEngine() *rules.Engine
- func (s *Server) Resolve(ctx context.Context, domain string, qtype uint16) ([]net.IP, error)
- func (s *Server) ResolveWithSource(ctx context.Context, domain string, qtype uint16, sourceIP net.IP) ([]net.IP, error)
- func (s *Server) SetDNSCache(dnsCache *cache.DNSCache)
- func (s *Server) SetHostsManager(manager *hosts.Manager)
- func (s *Server) SetRulesEngine(engine *rules.Engine)
- func (s *Server) Start() error
- func (s *Server) Stop() error
- type UpstreamCache
- func (c *UpstreamCache) Clear()
- func (c *UpstreamCache) Count() int
- func (c *UpstreamCache) Delete(domain string, qtype uint16)
- func (c *UpstreamCache) Get(domain string, qtype uint16) ([]net.IP, bool)
- func (c *UpstreamCache) Set(domain string, qtype uint16, ips []net.IP, ttl time.Duration)
- func (c *UpstreamCache) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoHServer ¶
type DoHServer struct {
// contains filtered or unexported fields
}
DoHServer DNS-over-HTTPS服务器
func NewDoHServer ¶
NewDoHServer 创建DoH服务器
type DoTServer ¶
type DoTServer struct {
// contains filtered or unexported fields
}
DoTServer DNS-over-TLS服务器
func NewDoTServer ¶
NewDoTServer 创建DoT服务器
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler 实现DNS请求处理器
func (*Handler) GetRequestCount ¶
GetRequestCount 获取DNS请求计数
func (*Handler) ResetRequestCount ¶
ResetRequestCount 重置DNS请求计数
func (*Handler) ServeDNS ¶
func (h *Handler) ServeDNS(w dns.ResponseWriter, r *dns.Msg)
ServeDNS 处理DNS请求
func (*Handler) SetController ¶
func (h *Handler) SetController(ctrl *access.Controller)
SetController 设置访问控制器
func (*Handler) SetWhitelist ¶
func (h *Handler) SetWhitelist(whitelist *access.WhitelistTable)
SetWhitelist 设置白名单表
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 表示DNS服务器
func (*Server) GetHostsManager ¶
GetHostsManager 获取 Hosts 管理器
func (*Server) GetRecordStore ¶
func (s *Server) GetRecordStore() *remote.RecordStore
GetRecordStore 获取记录存储
func (*Server) GetRulesEngine ¶
GetRulesEngine 获取分流规则引擎
func (*Server) ResolveWithSource ¶
func (s *Server) ResolveWithSource(ctx context.Context, domain string, qtype uint16, sourceIP net.IP) ([]net.IP, error)
ResolveWithSource 根据源IP解析DNS查询
func (*Server) SetDNSCache ¶
SetDNSCache 设置 DNS 缓存
func (*Server) SetHostsManager ¶
SetHostsManager 设置 Hosts 管理器
func (*Server) SetRulesEngine ¶
SetRulesEngine 设置分流规则引擎
type UpstreamCache ¶
type UpstreamCache struct {
// contains filtered or unexported fields
}
UpstreamCache 上游DNS查询缓存(独立于记录表)
func NewUpstreamCache ¶
func NewUpstreamCache(maxSize int, defaultTTL time.Duration) *UpstreamCache
NewUpstreamCache 创建上游缓存
func (*UpstreamCache) Delete ¶
func (c *UpstreamCache) Delete(domain string, qtype uint16)
Delete 删除缓存
Click to show internal directories.
Click to hide internal directories.