chore: adjust the internal code structure of the dns module

This commit is contained in:
wwqgtxx
2025-09-29 11:22:05 +08:00
parent 94b591ed44
commit 40e0813869
7 changed files with 72 additions and 72 deletions

View File

@@ -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)
}