Giter VIP home page Giter VIP logo

dominion's Introduction

Dominion

Dominion is a library to extract information from a domain name.

We're basically interested in two particulars:

  • The de facto TLD: this is the part of the domain a NIC would be responsible for. It may be an honest-to-god TLD, or a ccTLD, and more importantly, a ccSLD.

  • The base domain: That is the domain that is registered with the NIC, clear of any subdomains.

To resolve this we rely on the Mozilla Foundation's Public Suffix List, which can be found at http://publicsuffix.org/list/.

See http://publicsuffix.org/ to learn more.

A copy of the list file is provided with this library in var/tlds.dat, and loaded automatically when you require 'dominion'.

Usage

require 'dominion'

d = Dominion::DomainName.new(".name")
d.tld?  # => true
d.tld   # => "name"
d.base  # => "name"

d = Dominion::DomainName.new("foo.bar.co.uk")
d.tld?  # => false
d.tld   # => "co.uk"
d.base  # => "bar.co.uk"

Colophon

Copyright © 2010 Caio Chassot
Released under the MIT license
http://github.com/kch/dominion

dominion's People

Contributors

bgentry avatar bjeanes avatar brandur avatar kch avatar tmaher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dominion's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.