mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-04 05:37:38 +03:00
Quite a lot of dependency updates
This commit is contained in:
parent
19647e03a6
commit
26ebb55c8c
61 changed files with 13152 additions and 90698 deletions
282
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
282
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
|
@ -403,7 +403,7 @@ func (rr *SOA) parse(c *zlexer, o string) *ParseError {
|
|||
if l.err {
|
||||
return &ParseError{"", "bad SOA zone parameter", l}
|
||||
}
|
||||
if j, e := strconv.ParseUint(l.token, 10, 32); e != nil {
|
||||
if j, err := strconv.ParseUint(l.token, 10, 32); err != nil {
|
||||
if i == 0 {
|
||||
// Serial must be a number
|
||||
return &ParseError{"", "bad SOA zone parameter", l}
|
||||
|
@ -446,16 +446,16 @@ func (rr *SRV) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad SRV Weight", l}
|
||||
}
|
||||
rr.Weight = uint16(i)
|
||||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad SRV Port", l}
|
||||
}
|
||||
rr.Port = uint16(i)
|
||||
|
@ -482,8 +482,8 @@ func (rr *NAPTR) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad NAPTR Preference", l}
|
||||
}
|
||||
rr.Preference = uint16(i)
|
||||
|
@ -581,9 +581,9 @@ func (rr *TALINK) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
func (rr *LOC) parse(c *zlexer, o string) *ParseError {
|
||||
// Non zero defaults for LOC record, see RFC 1876, Section 3.
|
||||
rr.HorizPre = 165 // 10000
|
||||
rr.VertPre = 162 // 10
|
||||
rr.Size = 18 // 1
|
||||
rr.Size = 0x12 // 1e2 cm (1m)
|
||||
rr.HorizPre = 0x16 // 1e6 cm (10000m)
|
||||
rr.VertPre = 0x13 // 1e3 cm (10m)
|
||||
ok := false
|
||||
|
||||
// North
|
||||
|
@ -600,15 +600,15 @@ func (rr *LOC) parse(c *zlexer, o string) *ParseError {
|
|||
if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok {
|
||||
goto East
|
||||
}
|
||||
i, e = strconv.ParseUint(l.token, 10, 32)
|
||||
if e != nil || l.err {
|
||||
if i, err := strconv.ParseUint(l.token, 10, 32); err != nil || l.err {
|
||||
return &ParseError{"", "bad LOC Latitude minutes", l}
|
||||
} else {
|
||||
rr.Latitude += 1000 * 60 * uint32(i)
|
||||
}
|
||||
rr.Latitude += 1000 * 60 * uint32(i)
|
||||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err {
|
||||
if i, err := strconv.ParseFloat(l.token, 32); err != nil || l.err {
|
||||
return &ParseError{"", "bad LOC Latitude seconds", l}
|
||||
} else {
|
||||
rr.Latitude += uint32(1000 * i)
|
||||
|
@ -626,7 +626,7 @@ East:
|
|||
// East
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
|
||||
if i, err := strconv.ParseUint(l.token, 10, 32); err != nil || l.err {
|
||||
return &ParseError{"", "bad LOC Longitude", l}
|
||||
} else {
|
||||
rr.Longitude = 1000 * 60 * 60 * uint32(i)
|
||||
|
@ -637,14 +637,14 @@ East:
|
|||
if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok {
|
||||
goto Altitude
|
||||
}
|
||||
if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
|
||||
if i, err := strconv.ParseUint(l.token, 10, 32); err != nil || l.err {
|
||||
return &ParseError{"", "bad LOC Longitude minutes", l}
|
||||
} else {
|
||||
rr.Longitude += 1000 * 60 * uint32(i)
|
||||
}
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err {
|
||||
if i, err := strconv.ParseFloat(l.token, 32); err != nil || l.err {
|
||||
return &ParseError{"", "bad LOC Longitude seconds", l}
|
||||
} else {
|
||||
rr.Longitude += uint32(1000 * i)
|
||||
|
@ -667,7 +667,7 @@ Altitude:
|
|||
if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' {
|
||||
l.token = l.token[0 : len(l.token)-1]
|
||||
}
|
||||
if i, e := strconv.ParseFloat(l.token, 32); e != nil {
|
||||
if i, err := strconv.ParseFloat(l.token, 32); err != nil {
|
||||
return &ParseError{"", "bad LOC Altitude", l}
|
||||
} else {
|
||||
rr.Altitude = uint32(i*100.0 + 10000000.0 + 0.5)
|
||||
|
@ -681,23 +681,23 @@ Altitude:
|
|||
case zString:
|
||||
switch count {
|
||||
case 0: // Size
|
||||
e, m, ok := stringToCm(l.token)
|
||||
exp, m, ok := stringToCm(l.token)
|
||||
if !ok {
|
||||
return &ParseError{"", "bad LOC Size", l}
|
||||
}
|
||||
rr.Size = e&0x0f | m<<4&0xf0
|
||||
rr.Size = exp&0x0f | m<<4&0xf0
|
||||
case 1: // HorizPre
|
||||
e, m, ok := stringToCm(l.token)
|
||||
exp, m, ok := stringToCm(l.token)
|
||||
if !ok {
|
||||
return &ParseError{"", "bad LOC HorizPre", l}
|
||||
}
|
||||
rr.HorizPre = e&0x0f | m<<4&0xf0
|
||||
rr.HorizPre = exp&0x0f | m<<4&0xf0
|
||||
case 2: // VertPre
|
||||
e, m, ok := stringToCm(l.token)
|
||||
exp, m, ok := stringToCm(l.token)
|
||||
if !ok {
|
||||
return &ParseError{"", "bad LOC VertPre", l}
|
||||
}
|
||||
rr.VertPre = e&0x0f | m<<4&0xf0
|
||||
rr.VertPre = exp&0x0f | m<<4&0xf0
|
||||
}
|
||||
count++
|
||||
case zBlank:
|
||||
|
@ -762,7 +762,7 @@ func (rr *CERT) parse(c *zlexer, o string) *ParseError {
|
|||
l, _ := c.Next()
|
||||
if v, ok := StringToCertType[l.token]; ok {
|
||||
rr.Type = v
|
||||
} else if i, e := strconv.ParseUint(l.token, 10, 16); e != nil {
|
||||
} else if i, err := strconv.ParseUint(l.token, 10, 16); err != nil {
|
||||
return &ParseError{"", "bad CERT Type", l}
|
||||
} else {
|
||||
rr.Type = uint16(i)
|
||||
|
@ -778,7 +778,7 @@ func (rr *CERT) parse(c *zlexer, o string) *ParseError {
|
|||
l, _ = c.Next() // zString
|
||||
if v, ok := StringToAlgorithm[l.token]; ok {
|
||||
rr.Algorithm = v
|
||||
} else if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
|
||||
} else if i, err := strconv.ParseUint(l.token, 10, 8); err != nil {
|
||||
return &ParseError{"", "bad CERT Algorithm", l}
|
||||
} else {
|
||||
rr.Algorithm = uint8(i)
|
||||
|
@ -812,8 +812,8 @@ func (rr *CSYNC) parse(c *zlexer, o string) *ParseError {
|
|||
c.Next() // zBlank
|
||||
|
||||
l, _ = c.Next()
|
||||
j, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil {
|
||||
j, e1 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e1 != nil {
|
||||
// Serial must be a number
|
||||
return &ParseError{"", "bad CSYNC flags", l}
|
||||
}
|
||||
|
@ -845,9 +845,7 @@ func (rr *CSYNC) parse(c *zlexer, o string) *ParseError {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (rr *SIG) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.RRSIG.parse(c, o)
|
||||
}
|
||||
func (rr *SIG) parse(c *zlexer, o string) *ParseError { return rr.RRSIG.parse(c, o) }
|
||||
|
||||
func (rr *RRSIG) parse(c *zlexer, o string) *ParseError {
|
||||
l, _ := c.Next()
|
||||
|
@ -868,24 +866,24 @@ func (rr *RRSIG) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, err := strconv.ParseUint(l.token, 10, 8)
|
||||
if err != nil || l.err {
|
||||
i, e := strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
return &ParseError{"", "bad RRSIG Algorithm", l}
|
||||
}
|
||||
rr.Algorithm = uint8(i)
|
||||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, err = strconv.ParseUint(l.token, 10, 8)
|
||||
if err != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad RRSIG Labels", l}
|
||||
}
|
||||
rr.Labels = uint8(i)
|
||||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, err = strconv.ParseUint(l.token, 10, 32)
|
||||
if err != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 32)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad RRSIG OrigTtl", l}
|
||||
}
|
||||
rr.OrigTtl = uint32(i)
|
||||
|
@ -918,8 +916,8 @@ func (rr *RRSIG) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, err = strconv.ParseUint(l.token, 10, 16)
|
||||
if err != nil || l.err {
|
||||
i, e3 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e3 != nil || l.err {
|
||||
return &ParseError{"", "bad RRSIG KeyTag", l}
|
||||
}
|
||||
rr.KeyTag = uint16(i)
|
||||
|
@ -933,9 +931,9 @@ func (rr *RRSIG) parse(c *zlexer, o string) *ParseError {
|
|||
}
|
||||
rr.SignerName = name
|
||||
|
||||
s, e := endingToString(c, "bad RRSIG Signature")
|
||||
if e != nil {
|
||||
return e
|
||||
s, e4 := endingToString(c, "bad RRSIG Signature")
|
||||
if e4 != nil {
|
||||
return e4
|
||||
}
|
||||
rr.Signature = s
|
||||
|
||||
|
@ -985,15 +983,15 @@ func (rr *NSEC3) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Hash = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad NSEC3 Flags", l}
|
||||
}
|
||||
rr.Flags = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad NSEC3 Iterations", l}
|
||||
}
|
||||
rr.Iterations = uint16(i)
|
||||
|
@ -1050,22 +1048,22 @@ func (rr *NSEC3PARAM) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Hash = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad NSEC3PARAM Flags", l}
|
||||
}
|
||||
rr.Flags = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad NSEC3PARAM Iterations", l}
|
||||
}
|
||||
rr.Iterations = uint16(i)
|
||||
c.Next()
|
||||
l, _ = c.Next()
|
||||
if l.token != "-" {
|
||||
rr.SaltLength = uint8(len(l.token))
|
||||
rr.SaltLength = uint8(len(l.token) / 2)
|
||||
rr.Salt = l.token
|
||||
}
|
||||
return slurpRemainder(c)
|
||||
|
@ -1132,15 +1130,15 @@ func (rr *SSHFP) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Algorithm = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad SSHFP Type", l}
|
||||
}
|
||||
rr.Type = uint8(i)
|
||||
c.Next() // zBlank
|
||||
s, e1 := endingToString(c, "bad SSHFP Fingerprint")
|
||||
if e1 != nil {
|
||||
return e1
|
||||
s, e2 := endingToString(c, "bad SSHFP Fingerprint")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
}
|
||||
rr.FingerPrint = s
|
||||
return nil
|
||||
|
@ -1155,37 +1153,32 @@ func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, typ string) *ParseError {
|
|||
rr.Flags = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad " + typ + " Protocol", l}
|
||||
}
|
||||
rr.Protocol = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad " + typ + " Algorithm", l}
|
||||
}
|
||||
rr.Algorithm = uint8(i)
|
||||
s, e1 := endingToString(c, "bad "+typ+" PublicKey")
|
||||
if e1 != nil {
|
||||
return e1
|
||||
s, e3 := endingToString(c, "bad "+typ+" PublicKey")
|
||||
if e3 != nil {
|
||||
return e3
|
||||
}
|
||||
rr.PublicKey = s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rr *DNSKEY) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDNSKEY(c, o, "DNSKEY")
|
||||
}
|
||||
|
||||
func (rr *KEY) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDNSKEY(c, o, "KEY")
|
||||
}
|
||||
|
||||
func (rr *CDNSKEY) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDNSKEY(c, o, "CDNSKEY")
|
||||
}
|
||||
func (rr *DNSKEY) parse(c *zlexer, o string) *ParseError { return rr.parseDNSKEY(c, o, "DNSKEY") }
|
||||
func (rr *KEY) parse(c *zlexer, o string) *ParseError { return rr.parseDNSKEY(c, o, "KEY") }
|
||||
func (rr *CDNSKEY) parse(c *zlexer, o string) *ParseError { return rr.parseDNSKEY(c, o, "CDNSKEY") }
|
||||
func (rr *DS) parse(c *zlexer, o string) *ParseError { return rr.parseDS(c, o, "DS") }
|
||||
func (rr *DLV) parse(c *zlexer, o string) *ParseError { return rr.parseDS(c, o, "DLV") }
|
||||
func (rr *CDS) parse(c *zlexer, o string) *ParseError { return rr.parseDS(c, o, "CDS") }
|
||||
|
||||
func (rr *RKEY) parse(c *zlexer, o string) *ParseError {
|
||||
l, _ := c.Next()
|
||||
|
@ -1196,21 +1189,21 @@ func (rr *RKEY) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Flags = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad RKEY Protocol", l}
|
||||
}
|
||||
rr.Protocol = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad RKEY Algorithm", l}
|
||||
}
|
||||
rr.Algorithm = uint8(i)
|
||||
s, e1 := endingToString(c, "bad RKEY PublicKey")
|
||||
if e1 != nil {
|
||||
return e1
|
||||
s, e3 := endingToString(c, "bad RKEY PublicKey")
|
||||
if e3 != nil {
|
||||
return e3
|
||||
}
|
||||
rr.PublicKey = s
|
||||
return nil
|
||||
|
@ -1243,15 +1236,15 @@ func (rr *GPOS) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Longitude = l.token
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
_, e = strconv.ParseFloat(l.token, 64)
|
||||
if e != nil || l.err {
|
||||
_, e1 := strconv.ParseFloat(l.token, 64)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad GPOS Latitude", l}
|
||||
}
|
||||
rr.Latitude = l.token
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
_, e = strconv.ParseFloat(l.token, 64)
|
||||
if e != nil || l.err {
|
||||
_, e2 := strconv.ParseFloat(l.token, 64)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad GPOS Altitude", l}
|
||||
}
|
||||
rr.Altitude = l.token
|
||||
|
@ -1267,7 +1260,7 @@ func (rr *DS) parseDS(c *zlexer, o, typ string) *ParseError {
|
|||
rr.KeyTag = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
if i, e = strconv.ParseUint(l.token, 10, 8); e != nil {
|
||||
if i, err := strconv.ParseUint(l.token, 10, 8); err != nil {
|
||||
tokenUpper := strings.ToUpper(l.token)
|
||||
i, ok := StringToAlgorithm[tokenUpper]
|
||||
if !ok || l.err {
|
||||
|
@ -1279,31 +1272,19 @@ func (rr *DS) parseDS(c *zlexer, o, typ string) *ParseError {
|
|||
}
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad " + typ + " DigestType", l}
|
||||
}
|
||||
rr.DigestType = uint8(i)
|
||||
s, e1 := endingToString(c, "bad "+typ+" Digest")
|
||||
if e1 != nil {
|
||||
return e1
|
||||
s, e2 := endingToString(c, "bad "+typ+" Digest")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
}
|
||||
rr.Digest = s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rr *DS) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDS(c, o, "DS")
|
||||
}
|
||||
|
||||
func (rr *DLV) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDS(c, o, "DLV")
|
||||
}
|
||||
|
||||
func (rr *CDS) parse(c *zlexer, o string) *ParseError {
|
||||
return rr.parseDS(c, o, "CDS")
|
||||
}
|
||||
|
||||
func (rr *TA) parse(c *zlexer, o string) *ParseError {
|
||||
l, _ := c.Next()
|
||||
i, e := strconv.ParseUint(l.token, 10, 16)
|
||||
|
@ -1313,7 +1294,7 @@ func (rr *TA) parse(c *zlexer, o string) *ParseError {
|
|||
rr.KeyTag = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
|
||||
if i, err := strconv.ParseUint(l.token, 10, 8); err != nil {
|
||||
tokenUpper := strings.ToUpper(l.token)
|
||||
i, ok := StringToAlgorithm[tokenUpper]
|
||||
if !ok || l.err {
|
||||
|
@ -1325,14 +1306,14 @@ func (rr *TA) parse(c *zlexer, o string) *ParseError {
|
|||
}
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad TA DigestType", l}
|
||||
}
|
||||
rr.DigestType = uint8(i)
|
||||
s, err := endingToString(c, "bad TA Digest")
|
||||
if err != nil {
|
||||
return err
|
||||
s, e2 := endingToString(c, "bad TA Digest")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
}
|
||||
rr.Digest = s
|
||||
return nil
|
||||
|
@ -1347,22 +1328,22 @@ func (rr *TLSA) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Usage = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad TLSA Selector", l}
|
||||
}
|
||||
rr.Selector = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad TLSA MatchingType", l}
|
||||
}
|
||||
rr.MatchingType = uint8(i)
|
||||
// So this needs be e2 (i.e. different than e), because...??t
|
||||
s, e2 := endingToString(c, "bad TLSA Certificate")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
s, e3 := endingToString(c, "bad TLSA Certificate")
|
||||
if e3 != nil {
|
||||
return e3
|
||||
}
|
||||
rr.Certificate = s
|
||||
return nil
|
||||
|
@ -1377,22 +1358,22 @@ func (rr *SMIMEA) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Usage = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad SMIMEA Selector", l}
|
||||
}
|
||||
rr.Selector = uint8(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
i, e2 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e2 != nil || l.err {
|
||||
return &ParseError{"", "bad SMIMEA MatchingType", l}
|
||||
}
|
||||
rr.MatchingType = uint8(i)
|
||||
// So this needs be e2 (i.e. different than e), because...??t
|
||||
s, e2 := endingToString(c, "bad SMIMEA Certificate")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
s, e3 := endingToString(c, "bad SMIMEA Certificate")
|
||||
if e3 != nil {
|
||||
return e3
|
||||
}
|
||||
rr.Certificate = s
|
||||
return nil
|
||||
|
@ -1469,16 +1450,16 @@ func (rr *URI) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Priority = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next()
|
||||
i, e = strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 16)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad URI Weight", l}
|
||||
}
|
||||
rr.Weight = uint16(i)
|
||||
|
||||
c.Next() // zBlank
|
||||
s, err := endingToTxtSlice(c, "bad URI Target")
|
||||
if err != nil {
|
||||
return err
|
||||
s, e2 := endingToTxtSlice(c, "bad URI Target")
|
||||
if e2 != nil {
|
||||
return e2
|
||||
}
|
||||
if len(s) != 1 {
|
||||
return &ParseError{"", "bad URI Target", l}
|
||||
|
@ -1506,9 +1487,9 @@ func (rr *NID) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Preference = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
u, err := stringToNodeID(l)
|
||||
if err != nil || l.err {
|
||||
return err
|
||||
u, e1 := stringToNodeID(l)
|
||||
if e1 != nil || l.err {
|
||||
return e1
|
||||
}
|
||||
rr.NodeID = u
|
||||
return slurpRemainder(c)
|
||||
|
@ -1546,7 +1527,6 @@ func (rr *LP) parse(c *zlexer, o string) *ParseError {
|
|||
return &ParseError{"", "bad LP Fqdn", l}
|
||||
}
|
||||
rr.Fqdn = name
|
||||
|
||||
return slurpRemainder(c)
|
||||
}
|
||||
|
||||
|
@ -1559,9 +1539,9 @@ func (rr *L64) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Preference = uint16(i)
|
||||
c.Next() // zBlank
|
||||
l, _ = c.Next() // zString
|
||||
u, err := stringToNodeID(l)
|
||||
if err != nil || l.err {
|
||||
return err
|
||||
u, e1 := stringToNodeID(l)
|
||||
if e1 != nil || l.err {
|
||||
return e1
|
||||
}
|
||||
rr.Locator64 = u
|
||||
return slurpRemainder(c)
|
||||
|
@ -1624,14 +1604,13 @@ func (rr *PX) parse(c *zlexer, o string) *ParseError {
|
|||
return &ParseError{"", "bad PX Mapx400", l}
|
||||
}
|
||||
rr.Mapx400 = mapx400
|
||||
|
||||
return slurpRemainder(c)
|
||||
}
|
||||
|
||||
func (rr *CAA) parse(c *zlexer, o string) *ParseError {
|
||||
l, _ := c.Next()
|
||||
i, err := strconv.ParseUint(l.token, 10, 8)
|
||||
if err != nil || l.err {
|
||||
i, e := strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
return &ParseError{"", "bad CAA Flag", l}
|
||||
}
|
||||
rr.Flag = uint8(i)
|
||||
|
@ -1644,9 +1623,9 @@ func (rr *CAA) parse(c *zlexer, o string) *ParseError {
|
|||
rr.Tag = l.token
|
||||
|
||||
c.Next() // zBlank
|
||||
s, e := endingToTxtSlice(c, "bad CAA Value")
|
||||
if e != nil {
|
||||
return e
|
||||
s, e1 := endingToTxtSlice(c, "bad CAA Value")
|
||||
if e1 != nil {
|
||||
return e1
|
||||
}
|
||||
if len(s) != 1 {
|
||||
return &ParseError{"", "bad CAA Value", l}
|
||||
|
@ -1667,8 +1646,8 @@ func (rr *TKEY) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
// Get the key length and key values
|
||||
l, _ = c.Next()
|
||||
i, err := strconv.ParseUint(l.token, 10, 8)
|
||||
if err != nil || l.err {
|
||||
i, e := strconv.ParseUint(l.token, 10, 8)
|
||||
if e != nil || l.err {
|
||||
return &ParseError{"", "bad TKEY key length", l}
|
||||
}
|
||||
rr.KeySize = uint16(i)
|
||||
|
@ -1682,8 +1661,8 @@ func (rr *TKEY) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
// Get the otherdata length and string data
|
||||
l, _ = c.Next()
|
||||
i, err = strconv.ParseUint(l.token, 10, 8)
|
||||
if err != nil || l.err {
|
||||
i, e1 := strconv.ParseUint(l.token, 10, 8)
|
||||
if e1 != nil || l.err {
|
||||
return &ParseError{"", "bad TKEY otherdata length", l}
|
||||
}
|
||||
rr.OtherLen = uint16(i)
|
||||
|
@ -1693,7 +1672,6 @@ func (rr *TKEY) parse(c *zlexer, o string) *ParseError {
|
|||
return &ParseError{"", "bad TKEY otherday", l}
|
||||
}
|
||||
rr.OtherData = l.token
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1727,9 +1705,9 @@ func (rr *APL) parse(c *zlexer, o string) *ParseError {
|
|||
family = family[1:]
|
||||
}
|
||||
|
||||
afi, err := strconv.ParseUint(family, 10, 16)
|
||||
if err != nil {
|
||||
return &ParseError{"", "failed to parse APL family: " + err.Error(), l}
|
||||
afi, e := strconv.ParseUint(family, 10, 16)
|
||||
if e != nil {
|
||||
return &ParseError{"", "failed to parse APL family: " + e.Error(), l}
|
||||
}
|
||||
var addrLen int
|
||||
switch afi {
|
||||
|
@ -1741,9 +1719,9 @@ func (rr *APL) parse(c *zlexer, o string) *ParseError {
|
|||
return &ParseError{"", "unrecognized APL family", l}
|
||||
}
|
||||
|
||||
ip, subnet, err := net.ParseCIDR(cidr)
|
||||
if err != nil {
|
||||
return &ParseError{"", "failed to parse APL address: " + err.Error(), l}
|
||||
ip, subnet, e1 := net.ParseCIDR(cidr)
|
||||
if e1 != nil {
|
||||
return &ParseError{"", "failed to parse APL address: " + e1.Error(), l}
|
||||
}
|
||||
if !ip.Equal(subnet.IP) {
|
||||
return &ParseError{"", "extra bits in APL address", l}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue