zaccone / spf

Sender Policy Framework
MIT License
19 stars 6 forks source link

Add isNoHost function and add "no host" check for Go 1.7.6 on Windows #29

Open cedar10bits opened 7 years ago

cedar10bits commented 7 years ago

I want to use this library, but unfortunately I have to use Go 1.7.6 on Windows/Linux. On Windows, in case of "no such host", net.DNSError.Err is "dnsquery: DNS name does not exist". (if Go 1.8.3 on Windows, "no such host") So, even if expected result is "none", spf.CheckHost returns "temperror".

This pull request is a fix for this case.

cedar10bits commented 7 years ago

Sorry for some operation mistakes of this pull request(close, reopen, ... ).

zaccone commented 7 years ago

Hi, just got back from vacation. Will review your change today or tomorrow. Thanks for pull request!

zaccone commented 7 years ago

Hi, Thanks again for the pull request and patience.

Note I don't have any way to test the library on Windows.

From what I understood the problem is that on windows literal error value is different and the code does not enter correct branch and returns invalid value. Why not then add extra if in the branch? THe PR would be like +1 maybe 2 lines.

cedar10bits commented 7 years ago

I add "isNoHost" function to avoid code duplication because there were two "no host" checks. If I do not add "isNoHost", I will have to write same if statement twice.

And if other "no host" case found, I will have to do so, too. If three cases, I will have to write six if. I don't want to write too many if.

cedar10bits commented 7 years ago

@zaccone Could you reply to my opinion?