mihomo/component/resolver/patch.go

19 lines
365 B
Go
Raw Normal View History

2021-07-01 22:49:29 +08:00
package resolver
import D "github.com/miekg/dns"
2021-10-21 22:37:30 +08:00
var DefaultLocalServer LocalServer
2021-07-01 22:49:29 +08:00
type LocalServer interface {
ServeMsg(msg *D.Msg) (*D.Msg, error)
}
// ServeMsg with a dns.Msg, return resolve dns.Msg
func ServeMsg(msg *D.Msg) (*D.Msg, error) {
if server := DefaultLocalServer; server != nil {
return server.ServeMsg(msg)
}
return nil, ErrIPNotFound
}