DomainTools
Domain tools that I need constantly unified into one module. I have added so far:
- domain splitting based on the public suffix list
- IDN conversion
These can easily be used just by validating a domain name like this:
iex> DomainTools.validate("zen.xn--unup4y")
{:ok, %{domain: "zen.xn--unup4y", host: "zen", tld: "xn--unup4y", unicode: "zen.游戏"}}
iex> DomainTools.validate("zen.游戏")
{:ok, %{domain: "zen.xn--unup4y", host: "zen", tld: "xn--unup4y", unicode: "zen.游戏"}}
Installation
If available in Hex, the package can be installed
by adding domain_tools
to your list of dependencies in mix.exs
:
def deps do
[
{:domain_tools, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/domain_tools.