A domain name parser.
This expects only the domain, www.google.com
, not http://www.google.com/?query#hash
, use a URI parser first.
public_suffix_list.dat.txt
is from publicsuffix.org site. This is used to generate uhx.types.Domain.hx
.
DomainParts API
enum DomainParts {
Tld(parts:Array<String>);
Domain(name:String);
Subdomain(parts:Array<String>);
}
Domain API
International ccTLD's, like 中国
for China, return the same list as cn
would.
class Domain {
public static function initialize():Void;
public static function parse(domain:String, ?tlds:Array<String->Bool>, ?slds:Array<String->Bool>):haxe.ds.Option<Array<DomainParts>>;
}