Orphan record are now simple texts

This commit is contained in:
nemunaire 2020-06-09 01:15:52 +02:00
parent fb9860176e
commit d8758e49ca
3 changed files with 8 additions and 6 deletions

View File

@ -170,7 +170,7 @@ func AnalyzeZone(origin string, zone []dns.RR) (svcs map[string][]*happydns.Serv
continue
}
orphan := &Orphan{record}
orphan := &Orphan{record.String()[strings.LastIndex(record.Header().String(), "\tIN\t")+4:]}
svcs[record.Header().Name] = append(svcs[record.Header().Name], &happydns.ServiceCombined{orphan, happydns.ServiceType{
Type: reflect.Indirect(reflect.ValueOf(orphan)).Type().String(),
Domain: origin,

View File

@ -33,7 +33,6 @@ package svcs
import (
"fmt"
"strings"
"github.com/miekg/dns"
@ -41,7 +40,7 @@ import (
)
type Orphan struct {
RR dns.RR
RR string
}
func (s *Orphan) GetNbResources() int {
@ -49,11 +48,14 @@ func (s *Orphan) GetNbResources() int {
}
func (s *Orphan) GenComment(origin string) string {
return fmt.Sprintf("%s", s.RR.String()[strings.LastIndex(s.RR.Header().String(), "\tIN\t")+4:])
return s.RR
}
func (s *Orphan) GenRRs(domain string, ttl uint32) (rrs []dns.RR) {
rrs = append(rrs, s.RR)
rr, _ := dns.NewRR(fmt.Sprintf("%s %d IN %s", domain, ttl, s.RR))
if rr != nil {
rrs = append(rrs, rr)
}
return
}

View File

@ -145,7 +145,7 @@ func srv_analyze(a *Analyzer) error {
func init() {
RegisterService(
func() happydns.Service {
return &SRV{}
return &UnknownSRV{}
},
srv_analyze,
ServiceInfos{