Add basic checking of mx records for mailto links
Helps ensure that the domain is registered and at least partially configured to recieve email.
Codecov Report
Merging #57 into master will decrease coverage by
2.21%. The diff coverage is60.97%.
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
- Coverage 95.67% 93.45% -2.22%
==========================================
Files 17 17
Lines 902 917 +15
==========================================
- Hits 863 857 -6
- Misses 34 49 +15
- Partials 5 11 +6
| Impacted Files | Coverage Δ | |
|---|---|---|
| htmltest/check-link.go | 91.6% <60.97%> (-3.5%) |
:arrow_down: |
| htmltest/htmltest.go | 89.18% <0%> (-8.63%) |
:arrow_down: |
| htmltest/options.go | 89.06% <0%> (-0.17%) |
:arrow_down: |
| htmldoc/document.go | 88.37% <0%> (+0.27%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update d42cbee...75fff69. Read the comment docs.
Coverage has decreased as I can't think of a way to trigger the errors to execute those lines of code. In theory they should never execute, but it is a bit of catch all error handling in a default and else statement.
Does this pass for the case that a domain has no MX records, but has a valid A/CNAME record? (I believe it should)
I believe you are correct according to this RFC 5321 Section 5 but that doesn't current exist.
Looking at the changes coverage is fine.
Re. the RFC my understanding is as follows:
Checking items off as I read them
- [x] DNS lookup must be performed
- [x] First check for MX
- [x] If CNAME present restart from beginning
- [x] If neither, fallback to A or AAAA
- [x] If NXDOMAIN then error
- [ ] If haven't found a valid record then error
Rebased and made the changes requested.