https://github.com/sam0x17/domain-db
crystal langauge shard containing a dynamically updated database of public domain suffixes and top level domain extensions
https://github.com/sam0x17/domain-db
Last synced: 5 months ago
JSON representation
crystal langauge shard containing a dynamically updated database of public domain suffixes and top level domain extensions
- Host: GitHub
- URL: https://github.com/sam0x17/domain-db
- Owner: sam0x17
- License: mit
- Created: 2020-08-06T04:43:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T04:55:37.000Z (over 5 years ago)
- Last Synced: 2025-02-13T08:14:52.343Z (11 months ago)
- Language: Crystal
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DomainDB
Contains a dynamically updated database of top level domain extensions (from IANA)
and the public suffixes list from Mozilla.
## Usage
```crystal
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:
```yaml
dependencies:
domain-db:
github: sam0x17/domain-db
```