package dns_protocol_crawler

import (
	"encoding/json"
	config "git.loafle.net/overflow/overflow_probe/agent_api/config_manager"
	"git.loafle.net/overflow/overflow_probe/crawler"
	"git.loafle.net/overflow/overflow_probe/matcher/dns"
)

type DNSHealthCrawler struct {
	crawler.SocketHeahthCrawler
}

func (r *DNSHealthCrawler) Internal(params config.Config) ([]byte, error) {

	b, err := r.CheckHeahth(params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(b)
}

func NewDNSHealthCrawler() *DNSHealthCrawler {
	r := &DNSHealthCrawler{}
	r.SetInternal(r)
	r.SetMatcher(dns.NewDnsMatcher())
	return r
}
