dnscontrol/pkg/soautil/soautil.go
2023-02-27 20:28:17 -05:00

12 lines
335 B
Go

package soautil
import "strings"
// RFC5322MailToBind converts a user@host email address to BIND format.
func RFC5322MailToBind(rfc5322Mail string) string {
res := strings.SplitN(rfc5322Mail, "@", 2)
user, domain := res[0], res[1]
// RFC-1035 [Section-8]
user = strings.ReplaceAll(user, ".", "\\.")
return user + "." + domain
}