mirror of
https://github.com/miekg/dns.git
synced 2025-10-11 18:01:02 +02:00
Add dname
This commit is contained in:
parent
7dd412eb99
commit
f15274bfdb
24
zscan_rr.go
24
zscan_rr.go
@ -35,6 +35,9 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
|||||||
case TypeCNAME:
|
case TypeCNAME:
|
||||||
r, e = setCNAME(h, c, o, f)
|
r, e = setCNAME(h, c, o, f)
|
||||||
goto Slurp
|
goto Slurp
|
||||||
|
case TypeDNAME:
|
||||||
|
r, e = setDNAME(h, c, o, f)
|
||||||
|
goto Slurp
|
||||||
case TypeSOA:
|
case TypeSOA:
|
||||||
r, e = setSOA(h, c, o, f)
|
r, e = setSOA(h, c, o, f)
|
||||||
goto Slurp
|
goto Slurp
|
||||||
@ -44,9 +47,6 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
|||||||
case TypeSRV:
|
case TypeSRV:
|
||||||
r, e = setSRV(h, c, o, f)
|
r, e = setSRV(h, c, o, f)
|
||||||
goto Slurp
|
goto Slurp
|
||||||
case TypeNAPTR:
|
|
||||||
r, e = setNAPTR(h, c, o, f)
|
|
||||||
goto Slurp
|
|
||||||
// These types have a variable ending either chunks of txt or chunks/base64 or hex.
|
// These types have a variable ending either chunks of txt or chunks/base64 or hex.
|
||||||
// They need to search for the end of the RR themselves, hence they look for the ending
|
// They need to search for the end of the RR themselves, hence they look for the ending
|
||||||
// newline. Thus there is no need to slurp the remainder, because there is none.
|
// newline. Thus there is no need to slurp the remainder, because there is none.
|
||||||
@ -60,6 +60,8 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
|||||||
return setNSEC3(h, c, o, f)
|
return setNSEC3(h, c, o, f)
|
||||||
case TypeDS:
|
case TypeDS:
|
||||||
return setDS(h, c, f)
|
return setDS(h, c, f)
|
||||||
|
case TypeNAPTR:
|
||||||
|
return setNAPTR(h, c, o, f)
|
||||||
case TypeTXT:
|
case TypeTXT:
|
||||||
return setTXT(h, c, f)
|
return setTXT(h, c, f)
|
||||||
default:
|
default:
|
||||||
@ -197,6 +199,22 @@ func setCNAME(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
|||||||
return rr, nil
|
return rr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setDNAME(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
||||||
|
rr := new(RR_DNAME)
|
||||||
|
rr.Hdr = h
|
||||||
|
|
||||||
|
l := <-c
|
||||||
|
rr.Target = l.token
|
||||||
|
_, ld, ok := IsDomainName(l.token)
|
||||||
|
if !ok {
|
||||||
|
return nil, &ParseError{f, "bad CNAME Target", l}
|
||||||
|
}
|
||||||
|
if rr.Target[ld-1] != '.' {
|
||||||
|
rr.Target += o
|
||||||
|
}
|
||||||
|
return rr, nil
|
||||||
|
}
|
||||||
|
|
||||||
func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
||||||
rr := new(RR_SOA)
|
rr := new(RR_SOA)
|
||||||
rr.Hdr = h
|
rr.Hdr = h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user