mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-25 11:54:25 +08:00
21 lines
439 B
Go
21 lines
439 B
Go
package dns
|
|
|
|
import (
|
|
"context"
|
|
|
|
D "github.com/miekg/dns"
|
|
)
|
|
|
|
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)
|
|
}
|
|
|
|
func NewLocalServer(resolver *Resolver, mapper *ResolverEnhancer) *LocalServer {
|
|
return &LocalServer{handler: NewHandler(resolver, mapper)}
|
|
}
|