Resolve TXT records via CNAME (#3557)

* Add test case for TXT lookup via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Return HostType of explicit TXT records

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Adapt TXT method lookup to allow lookup via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Implement lookup of TXT records via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>
This commit is contained in:
Jonathan Nagy
2020-01-04 00:16:04 +11:00
committed by Miek Gieben
parent acac649c1b
commit e3266d24f7
6 changed files with 80 additions and 12 deletions

View File

@@ -19,8 +19,12 @@ func (s *Service) HostType() (what uint16, normalized net.IP) {
ip := net.ParseIP(s.Host)
switch {
case ip == nil:
return dns.TypeCNAME, nil
if len(s.Text) == 0 {
return dns.TypeCNAME, nil
}
return dns.TypeTXT, nil
case ip.To4() != nil:
return dns.TypeA, ip.To4()