Upgrade the definition of domain name
This commit is contained in:
parent
e816e64e3e
commit
99a7a57713
|
@ -243,8 +243,8 @@ func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package.
|
||||||
}
|
}
|
||||||
partlen++
|
partlen++
|
||||||
case c == '.':
|
case c == '.':
|
||||||
// byte before dot cannot be dot, dash
|
// byte before dot cannot be dot
|
||||||
if last == '.' || last == '-' {
|
if last == '.' {
|
||||||
return 0, uint8(l - longer), false
|
return 0, uint8(l - longer), false
|
||||||
}
|
}
|
||||||
if last == '\\' { // Ok, escaped dot.
|
if last == '\\' { // Ok, escaped dot.
|
||||||
|
|
|
@ -111,6 +111,7 @@ func TestPack(t *testing.T) {
|
||||||
m.Answer[0], err = NewRR(r)
|
m.Answer[0], err = NewRR(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("Failed to create RR: %s\n", err.Error())
|
t.Logf("Failed to create RR: %s\n", err.Error())
|
||||||
|
t.Fail()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := m.Pack(); !ok {
|
if _, ok := m.Pack(); !ok {
|
||||||
|
|
1
msg.go
1
msg.go
|
@ -1284,7 +1284,6 @@ func (dns *Msg) Len() int {
|
||||||
for i := 0; i < len(dns.Question); i++ {
|
for i := 0; i < len(dns.Question); i++ {
|
||||||
l += dns.Question[i].Len()
|
l += dns.Question[i].Len()
|
||||||
}
|
}
|
||||||
println("LENGTE", len(dns.Answer))
|
|
||||||
for i := 0; i < len(dns.Answer); i++ {
|
for i := 0; i < len(dns.Answer); i++ {
|
||||||
l += dns.Answer[i].Len()
|
l += dns.Answer[i].Len()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue