domain-db 0.1.0

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

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
Repository

domain-db

Owner
Statistic
  • 1
  • 1
  • 1
  • 0
  • 1
  • over 4 years ago
  • August 6, 2020
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 01:58:48 GMT

Languages