
Find / extract the "registered domain" (or "effective TLD" or "public
suffix") of domain / dns names.

We utilize Mozilla's public suffix list: http://publicsuffix.org,

Some examples: 
   DNS name       "registered domain"   "effective TLD"
   foo.bar.com         bar                  com
   foo.bar.co.uk       bar                  co.uk


We use Mozilla's public suffix list for this purpose.  The public suffix
list is a text file. Ideally however we would want to have a script (or
module) that has the list "embedded" in its logic, so that we don't have to
read and parse the suffix list file every time the script is run. 

The gen_registered_domain.py script does that
It can be used to generate a script/module that has the logic implemented. In
this use-case one feeds an effective_tld_names.dat into this script on stdin
and gets the generated script on stdout.  (the effective_tld_names.dat files
can be found on http://publicsuffix.org) e.g.,  

./gen_registered_domain.py < effective_tld_names.dat > registered_domain.py

The generated script can be used standalone. It doesn't need any data or py
files to work. 


The gen_registered_domain_template.py files serves in a dual purpose: 
  * It is the template that the generator script uses to generate 
    the output script file. 
  * Is included as a module in the generator script to access some
    common functionality (data structures, etc.). It has to be in the
	python path (or the same directory than gen_registered_domain.py) 
	when the generator is run. It's *not* required for 
	registered_domain.py


Release under both 
BSD-style license and GPL v2. See COPYING. 

See testcases/README for a quick-and-dirty test.


gregor@majordomus.org
http://www.icir.org/gregor/tools

