github.com/yaling888/clash@v1.53.0/component/resolver/local.go (about)

     1  package resolver
     2  
     3  import D "github.com/miekg/dns"
     4  
     5  var DefaultLocalServer LocalServer
     6  
     7  type LocalServer interface {
     8  	ServeMsg(msg *D.Msg) (*D.Msg, error)
     9  }
    10  
    11  // ServeMsg with a dns.Msg, return resolve dns.Msg
    12  func ServeMsg(msg *D.Msg) (*D.Msg, error) {
    13  	if server := DefaultLocalServer; server != nil {
    14  		return server.ServeMsg(msg)
    15  	}
    16  
    17  	return nil, ErrIPNotFound
    18  }