github.com/yaling888/clash@v1.53.0/dns/local-server.go (about)

     1  package dns
     2  
     3  import D "github.com/miekg/dns"
     4  
     5  type LocalServer struct {
     6  	handler handler
     7  }
     8  
     9  // ServeMsg implement resolver.LocalServer ResolveMsg
    10  func (s *LocalServer) ServeMsg(msg *D.Msg) (*D.Msg, error) {
    11  	return handlerWithContext(s.handler, msg)
    12  }
    13  
    14  func NewLocalServer(resolver *Resolver, mapper *ResolverEnhancer) *LocalServer {
    15  	return &LocalServer{handler: newHandler(resolver, mapper)}
    16  }