示例#1
0
func (v *Value) qualify(name, suffix, apexSuffix string) (string, bool) {
	s := v.qualifyIntl(name, suffix, apexSuffix)
	if !util.ValidateHostName(s) {
		return "", false
	}

	return s, true
}
示例#2
0
func convertEmail(email string) (string, error) {
	if email == "" {
		return ".", nil
	}

	if util.ValidateHostName(email) {
		return email, nil
	}

	addr, err := mail.ParseAddress(email)
	if err != nil {
		return "", err
	}

	email = addr.Address
	parts := strings.SplitN(email, "@", 2)
	if len(parts) < 2 {
		return "", fmt.Errorf("invalid e. mail address specified")
	}

	return dns.Fqdn(parts[0] + "." + parts[1]), nil
}