github.com/metacubex/mihomo@v1.18.5/dns/local.go (about)

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