Sent this out yesterday to the "users" mailing list, but it strikes me that
changing how the Plugin framework does asynchronous DNS lookups for plugins or
whether it caches answers or not might be better discussed on the dev mailing
list.
So I've just subscribed, and... hopefully I won't be rehashing too many old
questions.
--- Begin Message ---
On Jun 11, 2014, at 2:27 PM, Philip Prindeville
<[email protected]> wrote:
> Okay, might have a module ready to test.
Here’s what I came up with.
I should probably add uri_block_isp as well, but this is more problematic.
It requires a licensed database which the user may or may not have, so I have
to detect that and handle it gracefully.
Also the names of ISP’s can contain spaces and punctuation, so I’ll need
quoting.
As far as I know, names are limited to the ASCII alphabet for now (yay 1980’s
technology!!!).
I don’t bother to see if multiple URI’s match against the blacklist… I stop
when I see the first one.
I test for country codes before address block matches. Arguably the latter
would be quicker, so I might make that the first test.
Lastly, I don’t do the asynchronous address lookup… and I have to admit I don’t
understand why this isn’t done for us by get_uri_detail_list() or whatever
populates that hash.
Rather than having things like:
hosts => {
‘nqtel.com’ => ‘nqtel.com’
}
why not have it be pre-populated for us, such as:
hosts => {
‘nqtel.com’ => [ 107.158.249.74 ]
}
for instance?
Anyway, here’s the script. I don’t do a lot of volume so I’m okay with
synchronous lookups, but if someone else wants to make that change I’d be happy
to incorporate it.
http://ur1.ca/hiltd
--- End Message ---