From 574b7472a25169fe44e7332f36f65de1955554c0 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Jan 2018 01:47:37 -0700 Subject: [PATCH] WIP save records --- bin/digd.js | 2 +- lib/digd.js | 19 +- lib/public/js/app.js | 23 +- lib/store.json.js | 39 +- samples/daplie.com.db.json | 848 +++++++++++++++++++++++++++++++++---- samples/db.js | 4 +- samples/db.json | 6 +- 7 files changed, 814 insertions(+), 127 deletions(-) diff --git a/bin/digd.js b/bin/digd.js index 35c121c..8f90164 100755 --- a/bin/digd.js +++ b/bin/digd.js @@ -415,7 +415,7 @@ cli.main(function (args, cli) { try { engine = engine || require('../lib/store.json.js').create(engineOpts); } catch(e) { - respondWithResults(e); + console.error(e); return; } require('../lib/httpd.js').create(cli, engine, dnsd); diff --git a/lib/digd.js b/lib/digd.js index d6d7d22..d6b0114 100644 --- a/lib/digd.js +++ b/lib/digd.js @@ -67,7 +67,6 @@ function getRecords(engine, qname, cb) { // TODO allow multiple records to be returned(?) return function (err, addresses) { if (err || !addresses.length) { - r.id = r.id || Math.random(); delMe[r.id] = true; } else if (addresses.length > 1) { r._address = addresses[Math.floor(Math.random() * addresses.length)]; @@ -139,19 +138,19 @@ function dbToResourceRecord(r) { }; } -function getNs(engine, ds, results, cb) { - console.log('[DEV] getNs entered with domains', ds); +function getNs(engine, zs, results, cb) { + console.log('[DEV] getNs entered with domains', zs); - var d = ds.shift(); - console.log('[DEV] trying another one', d); + var z = zs.shift(); + console.log('[DEV] trying another one', z); - if (!d) { + if (!z) { results.header.rcode = NXDOMAIN; cb(null, results); return; } - var qn = d.id.toLowerCase(); + var qn = z.name.toLowerCase(); return getRecords(engine, qn, function (err, records) { if (err) { cb(err); return; } @@ -179,16 +178,16 @@ function getNs(engine, ds, results, cb) { }); if (!results.authority.length) { - return getNs(engine, ds, results, cb); + return getNs(engine, zs, results, cb); } // d.vanityNs should only be vanity nameservers (pointing to this same server) - if (d.vanityNs || results.authority.some(function (ns) { + if (z.vanityNs || results.authority.some(function (ns) { console.log('[debug] ns', ns); return -1 !== engine.primaryNameservers.indexOf(ns.data.toLowerCase()); })) { results.authority.length = 0; - results.authority.push(engine.zoneToSoa(d)); + results.authority.push(engine.zoneToSoa(z)); results.header.rcode = NXDOMAIN; } cb(null, results); diff --git a/lib/public/js/app.js b/lib/public/js/app.js index 478578e..98fa2e4 100644 --- a/lib/public/js/app.js +++ b/lib/public/js/app.js @@ -116,8 +116,9 @@ el.innerHTML = tpls.zone; console.log(el); console.log($qs('.js-zone-name', el)); - $qs('.js-zone-name', el).innerText = zone.id; + $qs('.js-zone-name', el).innerText = zone.name; $qs('.js-zone-name', el).dataset.id = zone.id; + $qs('.js-zone-name', el).dataset.name = zone.name; console.log(el.innerHTML); tpl += el.innerHTML; console.log(tpl); @@ -156,16 +157,13 @@ el.innerHTML = tpls.recordsMap[record.type.toLowerCase()]; console.log(el); console.log($qs('.js-record-name', el)); - var xid = ''; Object.keys(record).sort().forEach(function (key) { if ('id' === key) { return; } var x = $qs('.js-record-' + key, el); if (x) { - xid += record[key]; x.innerText = record[key]; } }); - record.id = record.id || xid; el.dataset.recordId = record.id; $qs('input.js-record-id', el).value = record.id; cache.recordsMap[record.id] = record; @@ -221,7 +219,7 @@ }); $on('button.js-zone-name', 'click', function (ev) { - var zone = ev.target.dataset.id; + var zone = ev.target.dataset.name; return fetchRecords(zone);/*.then(function () { });*/ }); @@ -285,7 +283,7 @@ var $pel = ev.target.parentElement; var id = $qs('.js-record-id', $pel).value; var existingRecord = cache.recordsMap[id]; - var record = existingRecord ? {} : { _new: true }; + var record = {}; var change; $qsa('input[class*="js-record-"]', $pel).forEach(function ($el) { @@ -301,17 +299,8 @@ record[key] = $el.value; }); - if (record._new) { - var xid = ''; - Object.keys(record).sort().forEach(function (key) { - if ('id' === key) { return; } - var x = $qs('.js-record-' + key, $pel); - if (x) { - xid += record[key]; - x.innerText = record[key]; - } - }); - record.id = record.id || xid; + if (!record.id) { + record.id = ''; } record.type = record.type || $qs('.js-record-type', $pel).innerHTML || $qs('.js-record-type', $pel).value; diff --git a/lib/store.json.js b/lib/store.json.js index 446bb5a..c33be47 100644 --- a/lib/store.json.js +++ b/lib/store.json.js @@ -5,15 +5,36 @@ module.exports.create = function (opts) { var engine = { db: null }; var db = require(opts.filepath); + var crypto = require('crypto'); + db.primaryNameservers.forEach(function (ns) { + if (!ns.id) { + ns.id = crypto.randomBytes(16).toString('hex'); + } + }); + db.zones.forEach(function (zone) { + if (!zone.name) { + zone.name = zone.id; + zone.id = null; + } + if (!zone.id) { + zone.id = crypto.randomBytes(16).toString('hex'); + } + }); + db.records.forEach(function (record) { + if (!record.id) { + record.id = crypto.randomBytes(16).toString('hex'); + } + }); + require('fs').writeFileSync(opts.filepath, JSON.stringify(db, null, 2)); engine.primaryNameservers = db.primaryNameservers; engine.zoneToSoa = function (domain) { - var nameservers = domain.vanityNs || engine.primaryNameservers; + var nameservers = domain.vanityNs || engine.primaryNameservers.map(function (n) { return n.name; }); var index = Math.floor(Math.random() * nameservers.length) % nameservers.length; var nameserver = nameservers[index]; return { - name: domain.id + name: domain.name , typeName: 'SOA' , className: 'IN' , ttl: domain.ttl || 60 @@ -23,8 +44,8 @@ module.exports.create = function (opts) { , name_server: nameserver // admin -- email address or domain for admin - , admin: domain.admin || ('admin.' + domain.id) - , email_addr: domain.admin || ('admin.' + domain.id) + , admin: domain.admin || ('admin.' + domain.name) + , email_addr: domain.admin || ('admin.' + domain.name) // serial -- the version, for cache-busting of secondary nameservers. suggested format: YYYYMMDDnn , serial: domain.serial || Math.round((domain.updatedAt || domain.createdAt || 0) / 1000) @@ -50,16 +71,14 @@ module.exports.create = function (opts) { engine.peers = { all: function (cb) { process.nextTick(function () { - cb(null, db.primaryNameservers.map(function (ns) { - return { name: ns }; - })); + cb(null, db.primaryNameservers); }); } }; engine.zones = { all: function (cb) { process.nextTick(function () { - cb(null, db.domains.slice(0)); + cb(null, db.zones.slice(0)); }); } , get: function (queries, cb) { @@ -68,9 +87,9 @@ module.exports.create = function (opts) { return { name: n }; }); } - var myDomains = db.domains.filter(function (d) { + var myDomains = db.zones.filter(function (d) { return queries.some(function (q) { - return d.id.toLowerCase() === q.name; + return d.name.toLowerCase() === q.name; }); }); process.nextTick(function () { diff --git a/samples/daplie.com.db.json b/samples/daplie.com.db.json index c5372ee..bc3708e 100644 --- a/samples/daplie.com.db.json +++ b/samples/daplie.com.db.json @@ -1,86 +1,764 @@ -{ "primaryNameservers": [ "ns1.daplie.com", "ns2.daplie.com", "ns3.daplie.com" ] -, "domains": [ - { "id": "daplie.com", "revokedAt": 0 } - , { "id": "daplie.domains", "revokedAt": 0, "vanityNs": [ "ns1.daplie.domains", "ns2.daplie.domains", "ns3.daplie.domains" ] } - , { "id": "daplie.me", "revokedAt": 0, "vanityNs": [ "ns1.daplie.me", "ns2.daplie.me", "ns3.daplie.me" ] } - , { "id": "oauth3.org", "revokedAt": 0 } +{ + "primaryNameservers": [ + { + "name": "ns1.daplie.com", + "id": "65a90f49f906ee5a3823e443ce5cc9a9" + }, + { + "name": "ns2.daplie.com", + "id": "5c05ac90852ee645e465da523b306800" + }, + { + "name": "ns3.daplie.com", + "id": "24dd0e0881f900b0bb3ed7bf9267e8f1" + } + ], + "zones": [ + { + "id": "1dd4ca0da57dbab8b536e4a4148ebf7b", + "revokedAt": 0, + "name": "daplie.com" + }, + { + "id": "b3a542f49a1cd4bc417622b9f0712400", + "revokedAt": 0, + "vanityNs": [ + "ns1.daplie.domains", + "ns2.daplie.domains", + "ns3.daplie.domains" + ], + "name": "daplie.domains" + }, + { + "id": "e2cf3bc08cf090d139ea45a6542b0caa", + "revokedAt": 0, + "vanityNs": [ + "ns1.daplie.me", + "ns2.daplie.me", + "ns3.daplie.me" + ], + "name": "daplie.me" + }, + { + "id": "e8ba9456b5966d22b5737fccc09a2685", + "revokedAt": 0, + "name": "oauth3.org" + } + ], + "records": [ + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns1", + "data": "ns1.daplie.com", + "id": "1d650317017daa83f493786268a267d9" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns2", + "data": "ns2.daplie.com", + "id": "aabaa77aa289d20d6e55bcc49da2f543" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns3", + "data": "ns3.daplie.com", + "id": "d523d2fe91ea2fc7d5f013536f583b38" + }, + { + "zone": "daplie.com", + "name": "ns1.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns1", + "address": "45.55.1.122", + "id": "19503a7b0dc6ec9bf512998fe69fa3cb" + }, + { + "zone": "daplie.com", + "name": "ns2.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns2", + "address": "45.55.254.197", + "id": "12b35252ff4a9d9b08c7824ebd20d452" + }, + { + "zone": "daplie.com", + "name": "ns3.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ns3", + "address": "159.203.25.112", + "id": "1db74720ae593c3bbe171882cf34335c" + }, + { + "zone": "daplie.me", + "name": "daplie.me", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "daplie", + "sub": "ns1", + "data": "ns1.daplie.me", + "id": "98f8f748dffc0c1025b3154d67a71bad" + }, + { + "zone": "daplie.me", + "name": "daplie.me", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "daplie", + "sub": "ns2", + "data": "ns2.daplie.me", + "id": "0b28c6ed7f2cbe57590e673f12df2ee6" + }, + { + "zone": "daplie.me", + "name": "daplie.me", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "daplie", + "sub": "ns3", + "data": "ns3.daplie.me", + "id": "870820f0937a0066dadc2ba283d9afcc" + }, + { + "zone": "daplie.me", + "name": "ns1.daplie.me", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "me", + "sld": "daplie", + "sub": "ns1", + "address": "45.55.1.122", + "id": "99f98a25d228108c573a91be55f90e38" + }, + { + "zone": "daplie.me", + "name": "ns2.daplie.me", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "me", + "sld": "daplie", + "sub": "ns2", + "address": "45.55.254.197", + "id": "0bbcf7056c4191f48d0c4b4394295d59" + }, + { + "zone": "daplie.me", + "name": "ns3.daplie.me", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "me", + "sld": "daplie", + "sub": "ns3", + "address": "159.203.25.112", + "id": "d017cadd989d00beab9abf855ef86df2" + }, + { + "zone": "oauth3.org", + "name": "ns1.oauth3.org", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "org", + "sld": "oauth3", + "sub": "ns1", + "address": "45.55.1.122", + "id": "dbd12081d23ba12c17b0cc8c58f4a578" + }, + { + "zone": "oauth3.org", + "name": "ns2.oauth3.org", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "org", + "sld": "oauth3", + "sub": "ns2", + "address": "45.55.254.197", + "id": "a6b2a9c476e20ea34c61d834303f8fff" + }, + { + "zone": "oauth3.org", + "name": "ns3.oauth3.org", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "org", + "sld": "oauth3", + "sub": "ns3", + "address": "159.203.25.112", + "id": "59a041995080f04c7516a5cdc5925494" + }, + { + "zone": "oauth3.org", + "name": "oauth3.org", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "oauth3", + "sub": "ns1", + "data": "ns1.oauth3.org", + "id": "7ae22868acb69760f56a2a1b98285a19" + }, + { + "zone": "oauth3.org", + "name": "oauth3.org", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "oauth3", + "sub": "ns2", + "data": "ns2.oauth3.org", + "id": "237901ec60a8c1812250f9c389ada7b1" + }, + { + "zone": "oauth3.org", + "name": "oauth3.org", + "type": "NS", + "class": "IN", + "ttl": 43200, + "tld": "me", + "sld": "oauth3", + "sub": "ns3", + "data": "ns3.oauth3.org", + "id": "04bc0d1dfae48ad560bc05e60f834087" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "address": "23.228.168.108", + "id": "52fabdc61de1e0c3e941f82354509c4d" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "TXT", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "data": [ + "v=spf1 include:mailgun.org include:spf.mandrillapp.com include:_spf.google.com include:servers.mcsv.net include:mail.zendesk.com ~all" + ], + "id": "dee3d19cfb94616871f2dd2f20a9b025" + }, + { + "zone": "daplie.com", + "name": "www.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "www", + "address": "23.228.168.108", + "id": "e0cf7db3a53773e2b1b18c8c813feb7e" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "MX", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "exchange": "mxa.mailgun.org", + "priority": 10, + "id": "9226b3e23aeecc6e40158c1aa8f94900" + }, + { + "zone": "daplie.com", + "name": "daplie.com", + "type": "MX", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "exchange": "mxb.mailgun.org", + "priority": 10, + "id": "cd4c0912c7cd6c66bc35a25c1a7fcb44" + }, + { + "zone": "daplie.com", + "name": "email.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "email", + "data": "mailgun.org", + "id": "ae35a02033e64ec171ea47f6bee614a4" + }, + { + "zone": "daplie.com", + "name": "k1._domainkey.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "k1._domainkey", + "data": "dkim.mcsv.net", + "id": "34a9bab7b4cf424aac48e16c9151ed28" + }, + { + "zone": "daplie.com", + "name": "smtp._domainkey.daplie.com", + "type": "TXT", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "smtp._domainkey", + "data": [ + "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdEzzYX8U31O5p5Uvyb1B50/JPMcKnsnIQcPDWWYkBUQxMt+FyD1SRZLCaVxWybZ8eFQUwxlh0qFeLd/mIIGhCazQ74a3AH+TJhz4gOAvNQHmWvS0Sv9ZZjGuDM/RdOAFSwZET8+WUpJfDADfijihj5KqMab13NDDLOQ96wObuwQIDAQAB" + ], + "id": "c421b6ec538d0155b48a3981ea1b96c4" + }, + { + "zone": "daplie.com", + "name": "mandrill._domainkey.daplie.com", + "type": "TXT", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "mandrill._domainkey", + "data": [ + "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrLHiExVd55zd/IQ/J/mRwSRMAocV/hMB3jXwaHH36d9NaVynQFYV8NaWi69c1veUtRzGt7yAioXqLj7Z4TeEUoOLgrKsn8YnckGs9i3B3tVFB+Ch/4mPhXWiNfNdynHWBcPcbJ8kjEQ2U8y78dHZj1YeRXXVvWob2OaKynO8/lQIDAQAB;" + ], + "id": "b99eaca18715483ae51602043128c3ce" + }, + { + "zone": "daplie.com", + "name": "iqqsuxwfyvyw.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "iqqsuxwfyvyw", + "data": "gv-roynzijsoqayyg.dv.googlehosted.com", + "id": "e6fce430c0c4c0841c0c081b9c5a34f3" + }, + { + "zone": "daplie.com", + "name": "support.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "support", + "data": "daplie.zendesk.com", + "id": "8345c4944c5b8d1c997f51f9085db1c2" + }, + { + "zone": "daplie.com", + "name": "proxy.tardigrade.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "proxy.tardigrade.devices", + "address": "23.228.168.108", + "id": "ca8456b1003b929b734ffac3d442ffa9" + }, + { + "zone": "daplie.com", + "name": "redleader.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "redleader.devices", + "address": "104.36.98.166", + "id": "6a78a8131a3bf053c6e3d1c9ad6b7120" + }, + { + "zone": "daplie.com", + "name": "beast.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "beast.devices", + "address": "96.19.92.42", + "id": "7a83df9c98ea6e86574a2966846a3a80" + }, + { + "zone": "daplie.com", + "name": "ossus.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "ossus.devices", + "address": "73.65.206.97", + "id": "b7731ad942a5051acc52054a5b228a5b" + }, + { + "zone": "daplie.com", + "name": "leo.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 3600, + "tld": "com", + "sld": "daplie", + "sub": "leo.devices", + "address": "45.56.59.142", + "id": "05d05b135fa7ee4aaca663f82263035f" + }, + { + "zone": "daplie.com", + "name": "proxy.leo.devices.daplie.com", + "type": "A", + "class": "IN", + "ttl": 3600, + "tld": "com", + "sld": "daplie", + "sub": "proxy.leo.devices", + "address": "45.56.59.142", + "id": "7f235d22c012df06f851f4fb074dcf2d" + }, + { + "zone": "daplie.com", + "name": "git.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "git", + "address": "23.228.168.108", + "id": "7cc0dfd69956ac97193d4d64c7911ee1" + }, + { + "zone": "daplie.com", + "name": "tunnel.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "tunnel", + "address": "162.243.160.23", + "id": "19d036f38c44598e36368f50f38ca3ac" + }, + { + "zone": "daplie.com", + "name": "api.daplie.com", + "type": "A", + "class": "IN", + "ttl": 43200, + "tld": "com", + "sld": "daplie", + "sub": "api", + "address": "23.228.168.108", + "id": "143c7ef20ebed52fd422efa9bd8edf44" + }, + { + "zone": "daplie.com", + "name": "preorder.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "preorder", + "data": "daplie.myshopify.com", + "id": "07ed749a2bb04d15c20b0df41e20e71b" + }, + { + "zone": "daplie.com", + "name": "rvpn.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "rvpn", + "address": "104.236.182.24", + "id": "3e57f0a99a0232e33ffc78018dfa5589" + }, + { + "zone": "daplie.com", + "name": "mailapp.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "mailapp", + "data": "mandrillapp.com", + "id": "069069ef7f8b0ffd7182a55135810c3f" + }, + { + "zone": "daplie.com", + "name": "hero.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "hero", + "address": "138.197.54.15", + "id": "3fbc0c3d51b5ae9afe34a7d2a7f3e480" + }, + { + "zone": "daplie.com", + "name": "mattermost.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "mattermost", + "address": "23.228.168.108", + "id": "d4a05a3bb296a8b7e5ae579208d6a7dd" + }, + { + "zone": "daplie.com", + "name": "china-ftp.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "china-ftp", + "address": "210.5.144.209", + "id": "8171ab72b4244492f15105e429fb9ee4" + }, + { + "zone": "daplie.com", + "name": "shop.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "shop", + "address": "23.227.38.32", + "id": "4bf66b3196e658edb32b79c24555c4a3" + }, + { + "zone": "daplie.com", + "name": "shop.daplie.com", + "type": "CNAME", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "shop", + "data": "shops.myshopify.com", + "id": "4d235ba90b0eac2a6cdd2ee887ece0e8" + }, + { + "zone": "daplie.com", + "name": "new.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "new", + "address": "23.228.168.108", + "id": "c3364d94014f3250f30810bf8ce42925" + }, + { + "zone": "daplie.com", + "name": "media.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "media", + "address": "45.56.59.142", + "id": "ceeb2618ebd0c8d6232f5b31f3b16eec" + }, + { + "zone": "daplie.com", + "name": "domains.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "domains", + "address": "23.228.168.108", + "id": "0a550bc92aa23a91b6f09dcfbb051bc7" + }, + { + "zone": "daplie.com", + "name": "labs.daplie.com", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "com", + "sld": "daplie", + "sub": "labs", + "address": "23.228.168.108", + "id": "e8ced4eb0a1ac0089e9c3f8981aab7de" + }, + { + "zone": "daplie.domains", + "name": "daplie.domains", + "type": "NS", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns1", + "data": "ns1.daplie.domains", + "id": "9994c44030200acc6bf32d4d1f6c8854" + }, + { + "zone": "daplie.domains", + "name": "daplie.domains", + "type": "NS", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns2", + "data": "ns2.daplie.domains", + "id": "3b5322d19ed697decc8ea399901925c7" + }, + { + "zone": "daplie.domains", + "name": "daplie.domains", + "type": "NS", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns3", + "data": "ns3.daplie.domains", + "id": "1444690ec1c527ac8894f198e9bc55a3" + }, + { + "zone": "daplie.domains", + "name": "ns1.daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns1", + "address": "45.55.1.122", + "id": "ac237469a1afdef3773b14fa1280ee9e" + }, + { + "zone": "daplie.domains", + "name": "ns2.daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns2", + "address": "45.55.254.197", + "id": "ac4c92727b045e40545e635f08f3e002" + }, + { + "zone": "daplie.domains", + "name": "ns3.daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "ns3", + "address": "159.203.25.112", + "id": "96012efb05f1dea1177e8311dd8ee71a" + }, + { + "zone": "daplie.domains", + "name": "leo.devices.daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "leo.devices", + "address": "45.56.59.142", + "id": "2c0c54b31598b769456c79f17f4c8469" + }, + { + "zone": "daplie.domains", + "name": "daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "", + "address": "45.56.59.142", + "aname": "leo.devices.daplie.domains", + "id": "e792d963b60c4b5eac7137513414f229" + }, + { + "zone": "daplie.domains", + "name": "daplie.domains", + "type": "A", + "class": "IN", + "ttl": 5, + "tld": "domains", + "sld": "daplie", + "sub": "www", + "address": "45.56.59.142", + "aname": "leo.devices.daplie.domains", + "id": "299767640358e61d2f95ee80fc4505bb" + } ] -, "records": [ - {"zone":"daplie.com","name":"daplie.com","type":"NS","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns1","data":"ns1.daplie.com"} - , {"zone":"daplie.com","name":"daplie.com","type":"NS","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns2","data":"ns2.daplie.com"} - , {"zone":"daplie.com","name":"daplie.com","type":"NS","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns3","data":"ns3.daplie.com"} - - , {"zone":"daplie.com","name":"ns1.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns1","address":"45.55.1.122"} - , {"zone":"daplie.com","name":"ns2.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns2","address":"45.55.254.197"} - , {"zone":"daplie.com","name":"ns3.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ns3","address":"159.203.25.112"} - - , {"zone":"daplie.me","name":"daplie.me","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"daplie","sub":"ns1","data":"ns1.daplie.me"} - , {"zone":"daplie.me","name":"daplie.me","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"daplie","sub":"ns2","data":"ns2.daplie.me"} - , {"zone":"daplie.me","name":"daplie.me","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"daplie","sub":"ns3","data":"ns3.daplie.me"} - - , {"zone":"daplie.me","name":"ns1.daplie.me","type":"A","class":"IN","ttl":5,"tld":"me","sld":"daplie","sub":"ns1","address":"45.55.1.122"} - , {"zone":"daplie.me","name":"ns2.daplie.me","type":"A","class":"IN","ttl":5,"tld":"me","sld":"daplie","sub":"ns2","address":"45.55.254.197"} - , {"zone":"daplie.me","name":"ns3.daplie.me","type":"A","class":"IN","ttl":5,"tld":"me","sld":"daplie","sub":"ns3","address":"159.203.25.112"} - - , {"zone":"oauth3.org","name":"ns1.oauth3.org","type":"A","class":"IN","ttl":5,"tld":"org","sld":"oauth3","sub":"ns1","address":"45.55.1.122"} - , {"zone":"oauth3.org","name":"ns2.oauth3.org","type":"A","class":"IN","ttl":5,"tld":"org","sld":"oauth3","sub":"ns2","address":"45.55.254.197"} - , {"zone":"oauth3.org","name":"ns3.oauth3.org","type":"A","class":"IN","ttl":5,"tld":"org","sld":"oauth3","sub":"ns3","address":"159.203.25.112"} - - , {"zone":"oauth3.org","name":"oauth3.org","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"oauth3","sub":"ns1","data":"ns1.oauth3.org"} - , {"zone":"oauth3.org","name":"oauth3.org","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"oauth3","sub":"ns2","data":"ns2.oauth3.org"} - , {"zone":"oauth3.org","name":"oauth3.org","type":"NS","class":"IN","ttl":43200,"tld":"me","sld":"oauth3","sub":"ns3","data":"ns3.oauth3.org"} - - - - , {"zone":"daplie.com","name":"daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"daplie.com","type":"TXT","class":"IN","ttl":43200,"tld":"com","sld":"daplie","data":["v=spf1 include:mailgun.org include:spf.mandrillapp.com include:_spf.google.com include:servers.mcsv.net include:mail.zendesk.com ~all"]} - , {"zone":"daplie.com","name":"www.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"www","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"daplie.com","type":"MX","class":"IN","ttl":43200,"tld":"com","sld":"daplie","exchange":"mxa.mailgun.org","priority":10} - , {"zone":"daplie.com","name":"daplie.com","type":"MX","class":"IN","ttl":43200,"tld":"com","sld":"daplie","exchange":"mxb.mailgun.org","priority":10} - , {"zone":"daplie.com","name":"email.daplie.com","type":"CNAME","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"email","data":"mailgun.org"} - , {"zone":"daplie.com","name":"k1._domainkey.daplie.com","type":"CNAME","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"k1._domainkey","data":"dkim.mcsv.net"} - , {"zone":"daplie.com","name":"smtp._domainkey.daplie.com","type":"TXT","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"smtp._domainkey","data":["k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdEzzYX8U31O5p5Uvyb1B50/JPMcKnsnIQcPDWWYkBUQxMt+FyD1SRZLCaVxWybZ8eFQUwxlh0qFeLd/mIIGhCazQ74a3AH+TJhz4gOAvNQHmWvS0Sv9ZZjGuDM/RdOAFSwZET8+WUpJfDADfijihj5KqMab13NDDLOQ96wObuwQIDAQAB"]} - , {"zone":"daplie.com","name":"mandrill._domainkey.daplie.com","type":"TXT","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"mandrill._domainkey","data":["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrLHiExVd55zd/IQ/J/mRwSRMAocV/hMB3jXwaHH36d9NaVynQFYV8NaWi69c1veUtRzGt7yAioXqLj7Z4TeEUoOLgrKsn8YnckGs9i3B3tVFB+Ch/4mPhXWiNfNdynHWBcPcbJ8kjEQ2U8y78dHZj1YeRXXVvWob2OaKynO8/lQIDAQAB;"]} - , {"zone":"daplie.com","name":"iqqsuxwfyvyw.daplie.com","type":"CNAME","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"iqqsuxwfyvyw","data":"gv-roynzijsoqayyg.dv.googlehosted.com"} - - , {"zone":"daplie.com","name":"support.daplie.com","type":"CNAME","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"support","data":"daplie.zendesk.com"} - - , {"zone":"daplie.com","name":"proxy.tardigrade.devices.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"proxy.tardigrade.devices","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"redleader.devices.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"redleader.devices","address":"104.36.98.166"} - , {"zone":"daplie.com","name":"beast.devices.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"beast.devices","address":"96.19.92.42"} - , {"zone":"daplie.com","name":"ossus.devices.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"ossus.devices","address":"73.65.206.97"} - , {"zone":"daplie.com","name":"leo.devices.daplie.com","type":"A","class":"IN","ttl":3600,"tld":"com","sld":"daplie","sub":"leo.devices","address":"45.56.59.142"} - , {"zone":"daplie.com","name":"proxy.leo.devices.daplie.com","type":"A","class":"IN","ttl":3600,"tld":"com","sld":"daplie","sub":"proxy.leo.devices","address":"45.56.59.142"} - - , {"zone":"daplie.com","name":"git.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"git","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"tunnel.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"tunnel","address":"162.243.160.23"} - , {"zone":"daplie.com","name":"api.daplie.com","type":"A","class":"IN","ttl":43200,"tld":"com","sld":"daplie","sub":"api","address":"23.228.168.108"} - - , {"zone":"daplie.com","name":"preorder.daplie.com","type":"CNAME","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"preorder","data":"daplie.myshopify.com"} - , {"zone":"daplie.com","name":"rvpn.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"rvpn","address":"104.236.182.24"} - , {"zone":"daplie.com","name":"mailapp.daplie.com","type":"CNAME","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"mailapp","data":"mandrillapp.com"} - , {"zone":"daplie.com","name":"hero.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"hero","address":"138.197.54.15"} - , {"zone":"daplie.com","name":"mattermost.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"mattermost","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"china-ftp.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"china-ftp","address":"210.5.144.209"} - , {"zone":"daplie.com","name":"shop.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"shop","address":"23.227.38.32"} - , {"zone":"daplie.com","name":"shop.daplie.com","type":"CNAME","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"shop","data":"shops.myshopify.com"} - , {"zone":"daplie.com","name":"new.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"new","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"media.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"media","address":"45.56.59.142"} - , {"zone":"daplie.com","name":"domains.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"domains","address":"23.228.168.108"} - , {"zone":"daplie.com","name":"labs.daplie.com","type":"A","class":"IN","ttl":5,"tld":"com","sld":"daplie","sub":"labs","address":"23.228.168.108"} - - - - , {"zone":"daplie.domains","name":"daplie.domains","type":"NS","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns1","data":"ns1.daplie.domains"} - , {"zone":"daplie.domains","name":"daplie.domains","type":"NS","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns2","data":"ns2.daplie.domains"} - , {"zone":"daplie.domains","name":"daplie.domains","type":"NS","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns3","data":"ns3.daplie.domains"} - - , {"zone":"daplie.domains","name":"ns1.daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns1","address":"45.55.1.122"} - , {"zone":"daplie.domains","name":"ns2.daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns2","address":"45.55.254.197"} - , {"zone":"daplie.domains","name":"ns3.daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"ns3","address":"159.203.25.112"} - - , {"zone":"daplie.domains","name":"leo.devices.daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"leo.devices","address":"45.56.59.142"} - , {"zone":"daplie.domains","name":"daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"","address":"45.56.59.142","aname":"leo.devices.daplie.domains"} - , {"zone":"daplie.domains","name":"daplie.domains","type":"A","class":"IN","ttl":5,"tld":"domains","sld":"daplie","sub":"www","address":"45.56.59.142","aname":"leo.devices.daplie.domains"} - ] -} +} \ No newline at end of file diff --git a/samples/db.js b/samples/db.js index 5e6da5d..1d2c6bb 100644 --- a/samples/db.js +++ b/samples/db.js @@ -2,8 +2,8 @@ module.exports = { - "primaryNameservers": [ "localhost" ] // 'ns1.vanity-dns.org' -, "domains": [ + "primaryNameservers": [ { "name": "localhost" } ] // 'ns1.vanity-dns.org' +, "zones": [ { "id": "example.com", "revokedAt": 0 } , { "id": "smith.example.com", "revokedAt": 0 } , { "id": "in-delegated.example.com", "revokedAt": 0 } diff --git a/samples/db.json b/samples/db.json index 47cedb6..c820fc5 100644 --- a/samples/db.json +++ b/samples/db.json @@ -1,6 +1,8 @@ { - "primaryNameservers": [ "localhost" ] -, "domains": [ + "primaryNameservers": [ + { "name": "localhost" } + ] +, "zones": [ { "id": "example.com", "revokedAt": 0 } , { "id": "smith.example.com", "revokedAt": 0 } , { "id": "in-delegated.example.com", "revokedAt": 0 }