Simple Lua interface to the Public Suffix List rules, intended to be used a building block for implementing the PSL domain parsing algorithm. New Luarocks builds are automatically created each month using the latest Public Suffix List.
local public_suffix_list = require('public_suffix_list')
if public_suffix_list.exists('com') then
-- ...
end
With Luarocks:
luarocks install public_suffix_list
Note: public_suffix_list.lua
is not checked into the repository. Instead, public_suffix_list.dat
is parsed and converted into a Lua table that is then used to create public_suffix_list.lua
(from public_suffix_list.in.lua
).
Checks if the suffix rule exists (can be any type). On success, returns true
; otherwise, returns false
.
Returns the type of the suffix rule (as a lowercase string) if it exists (e.g. "icann"
or "private"
); othwerwise, returns nil, errmsg
.
Returns true
if the suffix rule is delegated by ICANN; otherwise, returns false
.
Returns true
if the suffix rule is submitted by a domain holder; otherwise, returns false
.
A table of key, value
pairs where key
is a suffix rule type (as a lowercase string, e.g. "icann"
) and value
is an array-like table of suffix rules.