mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-27 01:07:10 +00:00
chore: adjust the internal code structure of the dns module
This commit is contained in:
@@ -6,15 +6,15 @@ import (
|
||||
D "github.com/miekg/dns"
|
||||
)
|
||||
|
||||
var DefaultLocalServer LocalServer
|
||||
var DefaultService Service
|
||||
|
||||
type LocalServer interface {
|
||||
type Service interface {
|
||||
ServeMsg(ctx context.Context, msg *D.Msg) (*D.Msg, error)
|
||||
}
|
||||
|
||||
// ServeMsg with a dns.Msg, return resolve dns.Msg
|
||||
func ServeMsg(ctx context.Context, msg *D.Msg) (*D.Msg, error) {
|
||||
if server := DefaultLocalServer; server != nil {
|
||||
if server := DefaultService; server != nil {
|
||||
return server.ServeMsg(ctx, msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user