package domain import "regexp" var mailRetryActorPattern = regexp.MustCompile(`^operator:[a-z0-9][a-z0-9._-]*$`) // MailRetryActor identifies an operator who authorized a retry of an unknown // delivery. It is a handle, not an account ID, email address, or credential. type MailRetryActor string // ParseMailRetryActor accepts an operator handle in the form // "operator:". func ParseMailRetryActor(value string) (MailRetryActor, error) { if len(value) > 128 || !mailRetryActorPattern.MatchString(value) { return "", invalidDelivery("domain.ParseMailRetryActor", "actor must be operator: of at most 128 bytes in lowercase letters, digits, '.', '_', or '-'") } return MailRetryActor(value), nil }