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