1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:54:40 -07:00

move comment to more rational position

This commit is contained in:
Cassondra Foesch 2024-09-18 07:38:29 +00:00
parent dfa5f640b0
commit 4bc6a36ae9

View File

@ -751,13 +751,13 @@ func (p *addrParser) consumeDomainLiteral() (string, error) {
return "", errors.New("mail: unclosed domain-literal")
}
// Check if the domain literal is an IP address
if addr, ok := strings.CutPrefix(dtext, "IPv6:"); ok {
if len(net.ParseIP(addr)) != net.IPv6len {
return "", fmt.Errorf("mail: invalid IPv6 address in domain-literal: %q", dtext)
}
} else if net.ParseIP(dtext).To4() != nil {
// Check if the domain literal is an IP address
return "", fmt.Errorf("mail: invalid IP address in domain-literal: %q", dtext)
}