Skip to content

crystal langauge shard containing a dynamically updated database of public domain suffixes and top level domain extensions

License

Notifications You must be signed in to change notification settings

sam0x17/domain-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DomainDB

Contains a dynamically updated database of top level domain extensions (from IANA) and the public suffixes list from Mozilla.

Usage

require "domain-db"

# suffix list contains everything
DomainDB.update_suffixes
DomainDB.suffixes.includes?("com.mx").should eq true
DomainDB.suffixes.includes?("net").should eq true
DomainDB.tld_extensions.includes?("ninja").should eq true

# tld list just contains top level domains according to IANA
DomainDB.update_tlds
DomainDB.tld_extensions.includes?("com.mx").should eq false # not top level
DomainDB.tld_extensions.includes?("net").should eq true
DomainDB.tld_extensions.includes?("ninja").should eq true
DomainDB.tld_extensions.includes?("co.uk").should eq false # not top level

Also see specs for usage for DomainDB.strip_subdomains and DomainDB.strip_suffix.

Installation

Add the following to your shards.yml file:

dependencies:
  domain-db:
    github: sam0x17/domain-db

About

crystal langauge shard containing a dynamically updated database of public domain suffixes and top level domain extensions

Resources

License

Stars

Watchers

Forks

Packages

No packages published