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.
Until in-depth documentation is available, take a look at the examples below.
const hasRoTLDTopLevelDomain = require("rotld-toolbox/hasRoTLDTopLevelDomain");
console.log(hasRoTLDTopLevelDomain("ș.ro"));
// -> true
const hasRoTLDSecondLevelDomain = require("rotld-toolbox/hasRoTLDSecondLevelDomain");
console.log(hasRoTLDSecondLevelDomain("ș.com.ro"));
// -> true
console.log(hasRoTLDSecondLevelDomain("ș.example.ro"));
// -> false
const isRoTLDReservedDomain = require("rotld-toolbox/isRoTLDReservedDomain");
console.log(isRoTLDReservedDomain("băicoi.ro"));
// -> true
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'
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",
}
*/
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",
}
*/
const getRoTLDDomainFromHostname = require("rotld-toolbox/getRoTLDDomainFromHostname");
console.log(getRoTLDDomainFromHostname("subdomeniu.ș.ro"));
// -> xn--yla.ro
console.log(getRoTLDDomainFromHostname("subdomeniu.ș.www.ro"));
// -> xn--yla.www.ro
const getHostnameFromURL = require("rotld-toolbox/getHostnameFromURL");
console.log(getHostnameFromURL("http://subdomeniu.subdomeniu.ș.com"));
// -> subdomeniu.subdomeniu.xn--yla.com
const convertPunycode = require("rotld-toolbox/convertPunycode");
console.log(convertPunycode.toUnicode("xn--yla.ro"));
// -> ș.ro
console.log(convertPunycode.toASCII("ș.ro"));
// -> xn--yla.ro
const convertWhoisResultToJson = require("rotld-toolbox/convertWhoisResultToJson");
console.log(convertWhoisResultToJson(whoisResultString));
// -> same output as getRoTLDDomainWhois
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"
]
*/
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']
The list is taken weekly from RoTLD - Rules for Registration.
const RoTLDSecondLevelDomains = require("rotld-toolbox/RoTLDSecondLevelDomains");
console.log(RoTLDSecondLevelDomains);
// -> ['com', 'org', ...'www']