Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.
/ rotld-toolbox Public archive

Simple tools for working with RoTLD (Romania Top Level Domain).

License

Notifications You must be signed in to change notification settings

alinchican/rotld-toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rotld-toolbox · Build Status codecov Greenkeeper badge

Simple tools for working with RoTLD (Romania Top Level Domain).

rotld-toolbox is available as the rotld-toolbox package on npm. You can find it here.

How to use

Until in-depth documentation is available, take a look at the examples below.

Check if a domain name has a RoTLD top level domain

const hasRoTLDTopLevelDomain = require("rotld-toolbox/hasRoTLDTopLevelDomain");

console.log(hasRoTLDTopLevelDomain("ș.ro"));
// -> true

Check if a Romanian domain name has a RoTLD second level domain

const hasRoTLDSecondLevelDomain = require("rotld-toolbox/hasRoTLDSecondLevelDomain");

console.log(hasRoTLDSecondLevelDomain("ș.com.ro"));
// -> true

console.log(hasRoTLDSecondLevelDomain("ș.example.ro"));
// -> false

Check if a Romanian domain name is reserved

const isRoTLDReservedDomain = require("rotld-toolbox/isRoTLDReservedDomain");

console.log(isRoTLDReservedDomain("băicoi.ro"));
// -> true

Get WHOIS result for a Romanian domain name

const queryRoTLDWhoisServer = require("rotld-toolbox/queryRoTLDWhoisServer");

console.log(queryRoTLDWhoisServer("ș.ro").then(whoisResult => console.log(whoisResult)));
// -> '\n% Whois Server Version 3.0 ...Domain Status: UpdateProhibited\r\n\r\n\r\n'

Get WHOIS result in JSON format for a Romanian domain name

const getRoTLDDomainWhois = require("rotld-toolbox/getRoTLDDomainWhois");

getRoTLDDomainWhois("ș.ro").then(whoisResult => console.log(whoisResult));
/*
  ->
    {
      domainName: "xn--yla.ro",
      registeredOn: "Before 2001",
      expiresOn: "2018-03-14", // in loving memory of Stephen Hawking
      referralUrl: "http://www.rotld.ro",
      registrar: "ICI - Registrar",
      domainStatus: [
        "DeleteProhibited",
        "RegistrantTransferProhibited",
        ...
      ],
      nameserver: [
        "ns1.xn--yla.ro",
        "ns2.xn--yla.ro",
        ...
      ]
      dnssec: "Active",
      dsRecord: [
        {
          dsAlgorithm: "...",
          dsDigest: "...",
          dsDigestType: "...",
          dsKeytag: "..."
        },
        ...
      ]
    }
*/

getRoTLDDomainWhois("nons-nodnsec-norefferalurl-domainok.ro").then(whoisResult => console.log(whoisResult));
/*
  ->
    {
      domainName: "xn--yla.ro",
      registeredOn: "Before 2001",
      expiresOn: "2018-03-14", // in loving memory of Stephen Hawking
      registrar: "ICI - Registrar",
      domainStatus: ["OK"],
      dnssec: "Inactive",
    }
*/

Get WHOIS domain labels for a Romanian domain name

const getRoTLDWhoisDomainLabels = require("rotld-toolbox/getRoTLDWhoisDomainLabels");

console.log(getRoTLDWhoisDomainLabels("ș.ro"));
/*
  ->
    {
      domain: "xn--yla",
      tld: "ro"
    }
*/

console.log(getRoTLDWhoisDomainLabels("subdomeniu.ș.www.ro"));
/*
  ->
    {
      subdomain: "subdomeniu",
      domain: "xn--yla",
      tldSecondLevelDomain: "www",
      tld: "ro",
    }
*/

Get RoTLD domain from hostname

const getRoTLDDomainFromHostname = require("rotld-toolbox/getRoTLDDomainFromHostname");

console.log(getRoTLDDomainFromHostname("subdomeniu.ș.ro"));
// -> xn--yla.ro

console.log(getRoTLDDomainFromHostname("subdomeniu.ș.www.ro"));
// -> xn--yla.www.ro

Get hostname from an URL

const getHostnameFromURL = require("rotld-toolbox/getHostnameFromURL");

console.log(getHostnameFromURL("http://subdomeniu.subdomeniu.ș.com"));
// -> subdomeniu.subdomeniu.xn--yla.com

Convert punycode

const convertPunycode = require("rotld-toolbox/convertPunycode");

console.log(convertPunycode.toUnicode("xn--yla.ro"));
// -> ș.ro

console.log(convertPunycode.toASCII("ș.ro"));
// -> xn--yla.ro

Convert WHOIS result to JSON

const convertWhoisResultToJson = require("rotld-toolbox/convertWhoisResultToJson");

console.log(convertWhoisResultToJson(whoisResultString));
// -> same output as getRoTLDDomainWhois

Clean WHOIS result

const cleanWhoisResult = require("rotld-toolbox/cleanWhoisResult");

console.log(cleanWhoisResult(whoisResultString));
/*
  ->
    [
      "Domain Name: xn--yla.ro",
      ...
      "Referral URL: http://www.rotld.ro",
      ...
      "DS Keytag #1: 22215",
      "DS Algorithm #1: 7-RSASHA1-NSEC3-SHA1",
      "DS Digest Type #1: 1-SHA1",
      "DS Digest #1: a3df7873ef974bddc91efd6f58d4f9b1487d16bd",
      "DS Keytag #2: 22215",
      ...
      "Nameserver: ns1.xn--yla.ro",
      "Nameserver: ns2.xn--yla.ro",
      "Domain Status: DeleteProhibited",
      "Domain Status: RegistrantTransferProhibited"
    ]
*/

Extras

RoTLDReservedDomains

The list is taken weekly from RoTLD - Reserved Domains.

const RoTLDReservedDomains = require("rotld-toolbox/RoTLDReservedDomains");

console.log(RoTLDReservedDomains);
// -> ['23-august', 'abrămuț', ...'zvoriștea.ro']

RoTLDSecondLevelDomains

The list is taken weekly from RoTLD - Rules for Registration.

const RoTLDSecondLevelDomains = require("rotld-toolbox/RoTLDSecondLevelDomains");

console.log(RoTLDSecondLevelDomains);
// -> ['com', 'org', ...'www']

About

Simple tools for working with RoTLD (Romania Top Level Domain).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •