public_suffix
Version, currently 1.1.2019100160 versions
- 1.1.20250705latestJul 5, 2025
- 1.1.20241223not indexedJul 5, 2025
- 1.1.20240403not indexedJul 5, 2025
- 1.1.20240304not indexedJul 5, 2025
- 1.1.20240202not indexedJul 5, 2025
- 1.1.20231202not indexedJul 5, 2025
- 1.1.20231107not indexedJul 5, 2025
- 1.1.20231018not indexedJul 5, 2025
- 1.1.20230913not indexedJul 5, 2025
- 1.1.20230725not indexedJul 5, 2025
- 1.1.20230615not indexedJul 5, 2025
- 1.1.20230513not indexedJul 5, 2025
- 1.1.20230408not indexedJul 5, 2025
- 1.1.20230214not indexedJul 5, 2025
- 1.1.20230111not indexedJul 5, 2025
- 1.1.20221205not indexedJul 5, 2025
- 1.1.20221102not indexedJul 5, 2025
- 1.1.20220829not indexedJul 5, 2025
- 1.1.20220805not indexedJul 5, 2025
- 1.1.20220607not indexedJul 5, 2025
- 1.1.20220512not indexedJul 5, 2025
- 1.1.20220406not indexedJul 5, 2025
- 1.1.20220312not indexedJul 5, 2025
- 1.1.20220208not indexedJul 5, 2025
- 1.1.20220117not indexedJul 5, 2025
- 1.1.20211101not indexedJul 5, 2025
- 1.1.20211005not indexedJul 5, 2025
- 1.1.20210807not indexedJul 5, 2025
- 1.1.20210702not indexedJul 5, 2025
- 1.1.20210510not indexedJul 5, 2025
- 1.1.20210324not indexedJul 5, 2025
- 1.1.20210302not indexedJul 5, 2025
- 1.1.20210127not indexedJul 5, 2025
- 1.1.20201120not indexedJul 5, 2025
- 1.1.20201026not indexedJul 5, 2025
- 1.1.20200929not indexedJul 5, 2025
- 1.1.20200812not indexedJul 5, 2025
- 1.1.20200610not indexedJul 5, 2025
- 1.1.20200524not indexedJul 5, 2025
- 1.1.20200407not indexedJul 5, 2025
- 1.1.20200303not indexedJul 5, 2025
- 1.1.20200202not indexedJul 5, 2025
- 1.1.20191227not indexedJul 5, 2025
- 1.1.20191211not indexedJul 5, 2025
- 1.1.20191128not indexedJul 5, 2025
- 1.1.20191030not indexedJul 5, 2025
- 1.1.20191001not indexedJul 5, 2025
- 1.1.20190922not indexedJul 5, 2025
- 1.1.20190904not indexedJul 5, 2025
- 1.1.20190807not indexedJul 5, 2025
- 1.1.20190801not indexedJul 5, 2025
- 1.1.20190712not indexedJul 5, 2025
- 1.1.20190629not indexedJul 5, 2025
- 1.1.20190620not indexedJul 5, 2025
- 1.1.20190601not indexedJul 5, 2025
- 1.0.20190502not indexedJul 5, 2025
- 1.0.20190419not indexedJul 5, 2025
- 1.0.20190411not indexedJul 5, 2025
- 0.2.1not indexedJul 5, 2025
- 0.1.0not indexedJul 5, 2025
github.com/anamba/public_suffix.cr
Crystal language implementation of public suffix check
12 stars
0 dependents
License: MIT
Nothing has been indexed for 1.1.20191001 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
public_suffix:
github: anamba/public_suffix.cr
version: ~> 1.1.20191001Then run:
shards installshard.yml
No shard.yml has been indexed for 1.1.20191001. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# public_suffix.cr - Crystal language implementation of public suffix check
[](https://github.com/anamba/public_suffix.cr/releases/latest)
[](https://travis-ci.org/anamba/public_suffix.cr)
[](https://github.com/anamba/public_suffix.cr/blob/master/LICENSE)
[Public suffix check](https://publicsuffix.org/list/) implemented in [Crystal](https://crystal-lang.org).
The API, README and specs are inspired by [publicsuffix-ruby](https://github.com/weppos/publicsuffix-ruby), but the code itself is all new, and the gem and shard are not otherwise related in any way.
Note that the public suffix dat file is embedded at compile time and parsed into a constant on startup. This will increase the size on disk, startup time, and baseline memory usage of the final binary accordingly (by approx 200KB, 20ms and ?MB respectively).
## Versioning
The patch level indicates the date the list was last updated.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
public_suffix:
github: anamba/public_suffix.cr
```
2. Run `shards install`
## Usage
```crystal
require "public_suffix"
```
Extract the domain out from a name:
```crystal
PublicSuffix.domain("google.com")
# => "google.com"
PublicSuffix.domain("www.google.com")
# => "google.com"
PublicSuffix.domain("www.google.co.uk")
# => "google.co.uk"
```
## What is the Public Suffix List?
The [Public Suffix List](https://publicsuffix.org) is a cross-vendor initiative to provide an accurate list of domain name suffixes.
The Public Suffix List is an initiative of the Mozilla Project, but is maintained as a community resource. It is available for use in any software, but was originally created to meet the needs of browser manufacturers.
A "public suffix" is one under which Internet users can directly register names. Some examples of public suffixes are ".com", ".co.uk" and "pvt.k12.wy.us". The Public Suffix List is a list of all known public suffixes.
## Why the Public Suffix List is better than any available Regular Expression parser
Previously, browsers used an algorithm which basically only denied setting wide-ranging cookies for top-level domains with no dots (e.g. com or org). However, this did not work for top-level domains where only third-level registrations are allowed (e.g. co.uk). In these cases, websites could set a cookie for co.uk which will be passed onto every website registered under co.uk.
Clearly, this was a security risk as it allowed websites other than the one setting the cookie to read it, and therefore potentially extract sensitive information.
Since there is no algorithmic method of finding the highest level at which a domain may be registered for a particular top-level domain (the policies differ with each registry), the only method is to create a list of all top-level domains and the level at which domains can be registered. This is the aim of the effective TLD list.
As well as being used to prevent cookies from being set where they shouldn't be, the list can also potentially be used for other applications where the registry controlled and privately controlled parts of a domain name need to be known, for example when grouping by top-level domains.
Source: <https://wiki.mozilla.org/Public_Suffix_List>
Not convinced yet? Check out [this real world example](https://stackoverflow.com/q/288810/123527).
## Does <tt>public_suffix.cr</tt> make requests to Public Suffix List website?
No. <tt>public_suffix.cr</tt> comes with a bundled list. It does not make any HTTP requests to parse or validate a domain.
## Contributing
1. Fork it (<https://github.com/anamba/public_suffix.cr/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Aaron Namba](https://github.com/anamba) - creator and maintainer
- [Lucjan Suski](https://github.com/methyl)
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.1.20191001- Tagged
- Jul 5, 2025
- Commit
f14e84d36a37- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/anamba/public_suffix.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 60