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

Add dns_nameserver option for mx checking #230

Merged
merged 10 commits into from
Feb 4, 2024

Conversation

timkrins
Copy link
Contributor

Adds an option for easily customising the DNS resolver that is used for checking A and MX records.
If no option is given, it will use all current defaults.

Copy link
Owner

@micke micke left a comment

Choose a reason for hiding this comment

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

Thanks! I just have some feedback!

README.md Outdated Show resolved Hide resolved
lib/valid_email2/address.rb Outdated Show resolved Hide resolved
lib/valid_email2/address.rb Outdated Show resolved Hide resolved
lib/valid_email2/address.rb Outdated Show resolved Hide resolved
@timkrins
Copy link
Contributor Author

Review comments resolved

@micke
Copy link
Owner

micke commented Feb 1, 2024

@timkrins great! Seems like you have some failing tests still!

@timkrins
Copy link
Contributor Author

timkrins commented Feb 1, 2024

Ensuring the timeout test pass is an interesting one - the DNS response was too quick in CI to hit the timeout, but did hit the timeout locally.

My new solution to fail the DNS resolution in time seems to be a bit 'hacky'...

As long as the DNS server doesn't respond in less than 2.2250738585072014e-308 seconds (Float::MIN), and resolv respects a float value, the test should now work (the timeout value is validated by resolv and must be positive).

The only other way to cause a timeout might be to start a socket on a thread that does not reply (this is how it is done in the resolv lib tests), but this is quite a deviation from the simpleness of the current tests.

@micke micke merged commit f2062f4 into micke:master Feb 4, 2024
11 checks passed
@micke
Copy link
Owner

micke commented Feb 4, 2024

I've pushed 5.2.0 to rubygems. Thanks!

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