Skip to content

Commit

Permalink
TESTING: parse_tests: reformat/regenerate .js .json files
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Jan 3, 2025
1 parent e232501 commit e9ff430
Show file tree
Hide file tree
Showing 102 changed files with 1,292 additions and 712 deletions.
22 changes: 8 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pkg/js/parse_tests/001-basic.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

var REG = NewRegistrar("Third-Party","NONE");
var REG = NewRegistrar("Third-Party", "NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");

D("foo.com",REG,DnsProvider(CF),
A("@","1.2.3.4")
);
D("foo.com", REG, DnsProvider(CF),
A("@", "1.2.3.4")
);
5 changes: 5 additions & 0 deletions pkg/js/parse_tests/001-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
"dnsProviders": {
"Cloudflare": -1
},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [
{
"name": "@",
"target": "1.2.3.4",
"ttl": 300,
"type": "A"
}
],
Expand Down
11 changes: 6 additions & 5 deletions pkg/js/parse_tests/002-ttl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var REG = NewRegistrar("Third-Party","NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI")
D("foo.com",REG,DnsProvider(CF),
A("@","1.2.3.4",TTL(42))
);
var REG = NewRegistrar("Third-Party", "NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");

D("foo.com", REG, DnsProvider(CF),
A("@", "1.2.3.4", TTL(42)),
);
4 changes: 4 additions & 0 deletions pkg/js/parse_tests/002-ttl.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"dnsProviders": {
"Cloudflare": -1
},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [
{
Expand Down
10 changes: 6 additions & 4 deletions pkg/js/parse_tests/003-meta.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var CLOUDFLARE = NewRegistrar("Cloudflare", "CLOUDFLAREAPI");

var CLOUDFLARE = NewRegistrar("Cloudflare","CLOUDFLAREAPI");
D("foo.com",CLOUDFLARE,
A("@","1.2.3.4",{"cloudflare_proxy":"ON"})
);
D("foo.com", CLOUDFLARE,
A("@", "1.2.3.4", {
"cloudflare_proxy": "ON"
}),
);
5 changes: 5 additions & 0 deletions pkg/js/parse_tests/003-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"domains": [
{
"dnsProviders": {},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [
{
Expand All @@ -11,6 +15,7 @@
},
"name": "@",
"target": "1.2.3.4",
"ttl": 300,
"type": "A"
}
],
Expand Down
16 changes: 8 additions & 8 deletions pkg/js/parse_tests/004-ips.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var REG = NewRegistrar("Third-Party","NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI")
var REG = NewRegistrar("Third-Party", "NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");

var BASE = IP("1.2.3.4")
var BASE = IP("1.2.3.4");

D("foo.com",REG,DnsProvider(CF,0),
A("@",BASE),
A("p1",BASE+1),
A("p255", BASE+255)
);
D("foo.com", REG, DnsProvider(CF, 0),
A("@", BASE),
A("p1", BASE + 1),
A("p255", BASE + 255),
);
7 changes: 7 additions & 0 deletions pkg/js/parse_tests/004-ips.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,28 @@
"dnsProviders": {
"Cloudflare": 0
},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [
{
"name": "@",
"target": "1.2.3.4",
"ttl": 300,
"type": "A"
},
{
"name": "p1",
"target": "1.2.3.5",
"ttl": 300,
"type": "A"
},
{
"name": "p255",
"target": "1.2.4.3",
"ttl": 300,
"type": "A"
}
],
Expand Down
43 changes: 22 additions & 21 deletions pkg/js/parse_tests/005-ignored-records.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
D("foo.com", "none"
, IGNORE_NAME("testignore")
, IGNORE_NAME("testignore2", "A")
, IGNORE_NAME("testignore3", "A, CNAME, TXT")
, IGNORE_NAME("testignore4", "*")
, IGNORE_TARGET("testtarget", "CNAME")
, IGNORE("legacyignore")
, IGNORE_NAME("@")
, IGNORE_TARGET("@", "CNAME")
D("foo.com", "none",
IGNORE_NAME("testignore"),
IGNORE_NAME("testignore2", "A"),
IGNORE_NAME("testignore3", "A, CNAME, TXT"),
IGNORE_NAME("testignore4", "*"),
IGNORE_TARGET("testtarget", "CNAME"),
IGNORE("legacyignore"),
IGNORE_NAME("@"),
IGNORE_TARGET("@", "CNAME"),
);
D("diff2.com", "none"
, IGNORE("mylabel")
, IGNORE("mylabel2", "")
, IGNORE("mylabel3", "", "")
, IGNORE("", "A")
, IGNORE("", "A,AAAA")
, IGNORE("", "", "mytarget")
, IGNORE("labelc", "CNAME", "targetc")
// Compatibility mode:
, IGNORE_NAME("nametest")
, IGNORE_TARGET("targettest1")
, IGNORE_TARGET("targettest2", "A")

D("diff2.com", "none",
IGNORE("mylabel"),
IGNORE("mylabel2", ""),
IGNORE("mylabel3", "", ""),
IGNORE("", "A"),
IGNORE("", "A,AAAA"),
IGNORE("", "", "mytarget"),
IGNORE("labelc", "CNAME", "targetc"),
// Compatibility mode:
IGNORE_NAME("nametest"),
IGNORE_TARGET("targettest1"),
IGNORE_TARGET("targettest2", "A"),
);
8 changes: 8 additions & 0 deletions pkg/js/parse_tests/005-ignored-records.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"domains": [
{
"dnsProviders": {},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [],
"registrar": "none",
Expand Down Expand Up @@ -51,6 +55,10 @@
},
{
"dnsProviders": {},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "diff2.com"
},
"name": "diff2.com",
"records": [],
"registrar": "none",
Expand Down
29 changes: 19 additions & 10 deletions pkg/js/parse_tests/006-transforms.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
var REG = NewRegistrar("Third-Party","NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI")
var REG = NewRegistrar("Third-Party", "NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");

var TRANSFORM_INT = [
{low: "0.0.0.0", high: "1.1.1.1", newBase: "2.2.2.2" },
{low: "1.1.1.1", high: IP("2.2.2.2"), newBase: ["3.3.3.3","4.4.4.4",IP("5.5.5.5")]} ,
{low: "1.1.1.1", high: IP("2.2.2.2"), newIP: ["3.3.3.3","4.4.4.4",IP("5.5.5.5")]}
]
// This is a cloudflare-specific transform. It is no longer used because
// IMPORT_TRANSFORM works for all providers.

D("foo.com",REG,DnsProvider(CF),
A("@","1.2.3.4",{transform: TRANSFORM_INT})
);
var TRANSFORM_INT = [{
low: "0.0.0.0",
high: "1.1.1.0",
newBase: "2.2.2.2"
}, {
low: "1.1.1.1",
high: IP("2.2.2.2"),
newIP: ["3.3.3.3", "4.4.4.4", IP("5.5.5.5")]
}];

D("foo.com", REG, DnsProvider(CF),
A("@", "1.2.3.4", {
transform: TRANSFORM_INT
}),
);
27 changes: 25 additions & 2 deletions pkg/js/parse_tests/006-transforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,37 @@
"dnsProviders": {
"Cloudflare": -1
},
"meta": {
"dnscontrol_tag": "",
"dnscontrol_uniquename": "foo.com"
},
"name": "foo.com",
"records": [
{
"meta": {
"transform": "0.0.0.0 ~ 1.1.1.1 ~ 2.2.2.2 ~ ; 1.1.1.1 ~ 2.2.2.2 ~ 3.3.3.3,4.4.4.4,5.5.5.5 ~ ; 1.1.1.1 ~ 2.2.2.2 ~ ~ 3.3.3.3,4.4.4.4,5.5.5.5"
"transform": "0.0.0.0 ~ 1.1.1.0 ~ 2.2.2.2 ~ ; 1.1.1.1 ~ 2.2.2.2 ~ ~ 3.3.3.3,4.4.4.4,5.5.5.5"
},
"name": "@",
"target": "3.3.3.3",
"ttl": 300,
"type": "A"
},
{
"meta": {
"transform": "0.0.0.0 ~ 1.1.1.0 ~ 2.2.2.2 ~ ; 1.1.1.1 ~ 2.2.2.2 ~ ~ 3.3.3.3,4.4.4.4,5.5.5.5"
},
"name": "@",
"target": "4.4.4.4",
"ttl": 300,
"type": "A"
},
{
"meta": {
"transform": "0.0.0.0 ~ 1.1.1.0 ~ 2.2.2.2 ~ ; 1.1.1.1 ~ 2.2.2.2 ~ ~ 3.3.3.3,4.4.4.4,5.5.5.5"
},
"name": "@",
"target": "1.2.3.4",
"target": "5.5.5.5",
"ttl": 300,
"type": "A"
}
],
Expand Down
6 changes: 3 additions & 3 deletions pkg/js/parse_tests/006-transforms/foo.com.zone
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$TTL 300
@ IN A 3.4.5.6
IN A 4.5.6.7
IN A 5.6.7.8
@ IN A 3.3.3.3
IN A 4.4.4.4
IN A 5.5.5.5
41 changes: 22 additions & 19 deletions pkg/js/parse_tests/007-importTransformTTL.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
var TRANSFORM_NEWIP = [{
low: "0.0.0.0",
high: "1.1.1.1",
newIP: "2.2.2.2"
}];
D("foo1.com", "reg",
A("bar", "1.1.1.1"),
A("foo", "5.5.5.5"),
);

var TRANSFORM_BASE = [{
low: "0.0.0.0",
high: "1.1.1.1",
newBase: "4.4.4.4"
low: "1.1.1.0",
high: "1.1.1.100",
newBase: "4.4.4.100"
}, {
low: "7.7.7.7",
high: "8.8.8.8",
newBase: "9.9.9.9"
},
];
low: "5.5.5.2",
high: "5.5.5.100",
newBase: "6.6.6.0"
}, ];

D("foo1.com", "reg");

D("foo2.com", "reg",
IMPORT_TRANSFORM(TRANSFORM_BASE, "foo1.com", 60)
D("inny", "reg",
IMPORT_TRANSFORM(TRANSFORM_BASE, "foo1.com", 60),
);

D("foo3.com", "reg",
IMPORT_TRANSFORM_STRIP(TRANSFORM_NEWIP, "foo1.com", 99, ".com")
var TRANSFORM_NEWIP = [{
low: "5.5.5.0",
high: "6.0.0.0",
newIP: "7.7.7.7"
}];

D("com.inny", "reg",
IMPORT_TRANSFORM_STRIP(TRANSFORM_NEWIP, "foo1.com", 99, "com"),
);
Loading

0 comments on commit e9ff430

Please sign in to comment.