On 20/03/14 22:52, Tim Rühsen wrote:
I broke out the public suffix code together and created a first go (really very
quick, distcheck fails - couldn't figure out this evening).

https://github.com/rockdaboot/libpsl

The first step was a psl_is_tld() function.
There is a test case for some major things (wildcards, exceptions).

So, your public api seems to be this:

psl_ctx_t *psl_load_file(const char *fname);

void psl_free(psl_ctx_t **psl)

int psl_is_tld(const psl_ctx_t *psl, const char *domain)

Fisrt, I wouldn't call the function is_tld(), not just because tlds simply won't have any dot inside, (just extract the last label in a DNS name)* since there are more ambiguous cases. I would name it is_public(), defining it as “one domain under which anyone* can register a subdomain”. Additionally, I think there should be a function to extract the public suffix from a given domain. Both functions should take a flags argument. The immediate use I foresee is to choose whether private registries should be taken into account or not. (a private registry is a domain used for the public but not owned by a registry, dyndns.org and blogspot.com are examples of that) * "anyone" understood as a random person unaffiliated with the owner of the parent domain, notwithstanding any condition that such "anyone" is required to fulfill in order to register it (such as residing in a given region or having payed certain fees). PS: It's funny to see 1994 rfc1591 talking about TLDs and saying «It is extremely unlikely that any other TLDs will be created.»


Reply via email to