(addr string, profile *precis.Profile)
| 143 | } |
| 144 | |
| 145 | func precisEmail(addr string, profile *precis.Profile) (string, error) { |
| 146 | mbox, domain, err := Split(addr) |
| 147 | if err != nil { |
| 148 | return "", fmt.Errorf("address: precis: %w", err) |
| 149 | } |
| 150 | |
| 151 | // PRECISFold is not included in the regular address.ForLookup since it reduces |
| 152 | // the range of valid addresses to a subset of actually valid values. |
| 153 | // PRECISFold is a matter of our own local policy, not a general rule for all |
| 154 | // email addresses. |
| 155 | |
| 156 | // Side note: For used profiles, there is no practical difference between |
| 157 | // CompareKey and String. |
| 158 | mbox, err = profile.CompareKey(mbox) |
| 159 | if err != nil { |
| 160 | return "", fmt.Errorf("address: precis: %w", err) |
| 161 | } |
| 162 | |
| 163 | domain, err = dns.ForLookup(domain) |
| 164 | if err != nil { |
| 165 | return "", fmt.Errorf("address: precis: %w", err) |
| 166 | } |
| 167 | |
| 168 | return mbox + "@" + domain, nil |
| 169 | } |
no test coverage detected