Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIPR-352: Add mxresolv.LookupWithPref #195

Merged
merged 2 commits into from
May 20, 2024
Merged

PIPR-352: Add mxresolv.LookupWithPref #195

merged 2 commits into from
May 20, 2024

Conversation

horkhe
Copy link
Member

@horkhe horkhe commented May 17, 2024

Unlike mxresolv.Lookup function mxresolv.LookupWithPref returns a slice of *net.MX records that are ordered by preference and hostname when the preference is the same.

// returns a prioritised list of MX hostnames, where hostnames with the same
// priority are shuffled. If the second returned value is true, then the host
// does not have explicit MX records, and its A record is returned instead.
//
// It uses an LRU cache with a timeout to reduce the number of network requests.
func Lookup(ctx context.Context, hostname string) (retMxHosts []string, retImplicit bool, reterr error) {
if cachedVal, ok := lookupResultCache.Get(hostname); ok {
func Lookup(ctx context.Context, domain string) ([]string, bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the linter here. The names help with code completion for quick-glance reading

Copy link
Contributor

@MatthewEdge MatthewEdge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sans the linter items, looks good to me 👍

@horkhe horkhe merged commit 354998d into master May 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants