mihomo/dns/patch.go

21 lines
439 B
Go
Raw Normal View History

2022-05-02 14:21:37 +08:00
package dns
import (
"context"
D "github.com/miekg/dns"
)
2022-05-02 14:21:37 +08:00
type LocalServer struct {
handler handler
}
// ServeMsg implement resolver.LocalServer ResolveMsg
func (s *LocalServer) ServeMsg(ctx context.Context, msg *D.Msg) (*D.Msg, error) {
return handlerWithContext(ctx, s.handler, msg)
2022-05-02 14:21:37 +08:00
}
func NewLocalServer(resolver *Resolver, mapper *ResolverEnhancer) *LocalServer {
return &LocalServer{handler: NewHandler(resolver, mapper)}
}