mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
21 lines
370 B
Go
21 lines
370 B
Go
package resolver
|
|
|
|
import D "github.com/miekg/dns"
|
|
|
|
var (
|
|
DefaultLocalServer LocalServer
|
|
)
|
|
|
|
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
|
|
}
|