Skip to content

Commit

Permalink
dnscontrol fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Dec 27, 2024
1 parent 8dcd0ae commit 2e753eb
Show file tree
Hide file tree
Showing 48 changed files with 338 additions and 372 deletions.
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")
);
8 changes: 4 additions & 4 deletions pkg/js/parse_tests/002-ttl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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",TTL(42))
);
D("foo.com", REG, DnsProvider(CF),
A("@", "1.2.3.4", TTL(42))
);
11 changes: 6 additions & 5 deletions pkg/js/parse_tests/003-meta.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

var CLOUDFLARE = NewRegistrar("Cloudflare","CLOUDFLAREAPI");
D("foo.com",CLOUDFLARE,
A("@","1.2.3.4",{"cloudflare_proxy":"ON"})
);
var CLOUDFLARE = NewRegistrar("Cloudflare", "CLOUDFLAREAPI");
D("foo.com", CLOUDFLARE,
A("@", "1.2.3.4", {
"cloudflare_proxy": "ON"
})
);
12 changes: 6 additions & 6 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 REG = NewRegistrar("Third-Party", "NONE");
var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI")

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)
);
26 changes: 4 additions & 22 deletions pkg/js/parse_tests/005-ignored-records.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
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("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")
);
28 changes: 19 additions & 9 deletions pkg/js/parse_tests/006-transforms.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
var REG = NewRegistrar("Third-Party","NONE");
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")]}
]
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")]
}]

D("foo.com",REG,DnsProvider(CF),
A("@","1.2.3.4",{transform: TRANSFORM_INT})
);
D("foo.com", REG, DnsProvider(CF),
A("@", "1.2.3.4", {
transform: TRANSFORM_INT
})
);
3 changes: 1 addition & 2 deletions pkg/js/parse_tests/007-importTransformTTL.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ var TRANSFORM_BASE = [{
low: "7.7.7.7",
high: "8.8.8.8",
newBase: "9.9.9.9"
},
];
}, ];

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

Expand Down
1 change: 0 additions & 1 deletion pkg/js/parse_tests/008-import.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

require("./import.js")
2 changes: 1 addition & 1 deletion pkg/js/parse_tests/009-reverse.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
D(REV("1.2.0.0/16"),"none");
D(REV("1.2.0.0/16"), "none");
6 changes: 3 additions & 3 deletions pkg/js/parse_tests/010-alias.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
D("foo.com","none",
ALIAS("@","foo.com.")
);
D("foo.com", "none",
ALIAS("@", "foo.com.")
);
8 changes: 4 additions & 4 deletions pkg/js/parse_tests/011-cfRedirect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
D("foo.com","none",
CF_REDIRECT("test.foo.com","https://goo.com/$1"),
CF_TEMP_REDIRECT("test.foo.com","https://goo.com/$1")
);
D("foo.com", "none",
CF_REDIRECT("test.foo.com", "https://goo.com/$1"),
CF_TEMP_REDIRECT("test.foo.com", "https://goo.com/$1")
);
12 changes: 6 additions & 6 deletions pkg/js/parse_tests/012-duration.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
D("foo.com","none",
A("@","1.2.3.4", TTL("300s")),
A("a","1.2.3.5", TTL("300")),
A("b","1.2.3.6", TTL("3m")),
A("c","1.2.3.7", TTL("3h")),
A("d","1.2.3.8", TTL("3d"))
D("foo.com", "none",
A("@", "1.2.3.4", TTL("300s")),
A("a", "1.2.3.5", TTL("300")),
A("b", "1.2.3.6", TTL("3m")),
A("c", "1.2.3.7", TTL("3h")),
A("d", "1.2.3.8", TTL("3d"))
);
4 changes: 2 additions & 2 deletions pkg/js/parse_tests/013-mx.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
D("foo.com","none",
MX("@",15,"foo.com.")
D("foo.com", "none",
MX("@", 15, "foo.com.")
);
6 changes: 3 additions & 3 deletions pkg/js/parse_tests/014-caa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
D("foo.com","none",
D("foo.com", "none",
// Allow letsencrypt to issue certificate for this domain
CAA("@","issue","letsencrypt.org"),
CAA("@", "issue", "letsencrypt.org"),
// Allow no CA to issue wildcard certificate for this domain
CAA("@","issuewild",";"),
CAA("@", "issuewild", ";"),
// Report all violation to test@example.com. If CA does not support
// this record then refuse to issue any certificate
CAA("@", "iodef", "mailto:[email protected]", CAA_CRITICAL),
Expand Down
4 changes: 2 additions & 2 deletions pkg/js/parse_tests/015-tlsa.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
D("foo.com","none",
TLSA("_443._tcp",3,1,1,"MDFiYTQ3MTljODBiNmZlOTExYjA5MWE3YzA1MTI0YjY0ZWVlY2U5NjRlMDljMDU4ZWY4Zjk4MDVkYWNhNTQ2YiAgLQo=")
D("foo.com", "none",
TLSA("_443._tcp", 3, 1, 1, "MDFiYTQ3MTljODBiNmZlOTExYjA5MWE3YzA1MTI0YjY0ZWVlY2U5NjRlMDljMDU4ZWY4Zjk4MDVkYWNhNTQ2YiAgLQo=")
);
8 changes: 1 addition & 7 deletions pkg/js/parse_tests/017-txt.js
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
D("foo.com","none"
, TXT("a","simple")
, TXT("b","ws at end ")
, TXT("c",["one"])
, TXT("d",["bonie", "clyde"])
, TXT("e",["straw", "wood", "brick"])
);
D("foo.com", "none", TXT("a", "simple"), TXT("b", "ws at end "), TXT("c", ["one"]), TXT("d", ["bonie", "clyde"]), TXT("e", ["straw", "wood", "brick"]));
4 changes: 1 addition & 3 deletions pkg/js/parse_tests/018-dkim.js

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

28 changes: 14 additions & 14 deletions pkg/js/parse_tests/019-r53-alias.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
D("foo.com", "none",
R53_ALIAS("mxtest", "MX", "foo.com."),
R53_ALIAS("atest", "A", "foo.com."),
R53_ALIAS("atest", "A", "foo.com.", R53_ZONE("Z2FTEDLFRTF")),
R53_ALIAS("aevaltargethealthtest", "A", "foo.com.", R53_EVALUATE_TARGET_HEALTH(true)),
R53_ALIAS("aaaatest", "AAAA", "foo.com."),
R53_ALIAS("aaaatest", "AAAA", "foo.com.", R53_ZONE("ERERTFGFGF")),
R53_ALIAS("cnametest", "CNAME", "foo.com."),
R53_ALIAS("ptrtest", "PTR", "foo.com."),
R53_ALIAS("txttest", "TXT", "foo.com."),
R53_ALIAS("srvtest", "SRV", "foo.com."),
R53_ALIAS("spftest", "SPF", "foo.com."),
R53_ALIAS("caatest", "CAA", "foo.com."),
R53_ALIAS("naptrtest", "NAPTR", "foo.com.")
);
R53_ALIAS("mxtest", "MX", "foo.com."),
R53_ALIAS("atest", "A", "foo.com."),
R53_ALIAS("atest", "A", "foo.com.", R53_ZONE("Z2FTEDLFRTF")),
R53_ALIAS("aevaltargethealthtest", "A", "foo.com.", R53_EVALUATE_TARGET_HEALTH(true)),
R53_ALIAS("aaaatest", "AAAA", "foo.com."),
R53_ALIAS("aaaatest", "AAAA", "foo.com.", R53_ZONE("ERERTFGFGF")),
R53_ALIAS("cnametest", "CNAME", "foo.com."),
R53_ALIAS("ptrtest", "PTR", "foo.com."),
R53_ALIAS("txttest", "TXT", "foo.com."),
R53_ALIAS("srvtest", "SRV", "foo.com."),
R53_ALIAS("spftest", "SPF", "foo.com."),
R53_ALIAS("caatest", "CAA", "foo.com."),
R53_ALIAS("naptrtest", "NAPTR", "foo.com.")
);
2 changes: 1 addition & 1 deletion pkg/js/parse_tests/020-complexRequire.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require('./complexImports/base.js');
require('./complexImports/base.js');
8 changes: 1 addition & 7 deletions pkg/js/parse_tests/021-srv.js

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

18 changes: 9 additions & 9 deletions pkg/js/parse_tests/022-sshfp.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
D("foo.com","none",
SSHFP("@",1,1,"66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@",1,2,"745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@",2,1,"66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@",2,2,"745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@",3,1,"66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@",3,2,"745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@",4,1,"66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@",4,2,"745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc")
D("foo.com", "none",
SSHFP("@", 1, 1, "66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@", 1, 2, "745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@", 2, 1, "66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@", 2, 2, "745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@", 3, 1, "66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@", 3, 2, "745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc"),
SSHFP("@", 4, 1, "66c7d5540b7d75a1fb4c84febfa178ad99bdd67c"),
SSHFP("@", 4, 2, "745a635bc46a397a5c4f21d437483005bcc40d7511ff15fbfafe913a081559bc")
);
4 changes: 1 addition & 3 deletions pkg/js/parse_tests/023-ignored-glob-records.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
D("foo.com", "none"
, IGNORE("\\*.testignore")
);
D("foo.com", "none", IGNORE("\\*.testignore"));
4 changes: 2 additions & 2 deletions pkg/js/parse_tests/024-json-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ var domains = require('./domain-ip-map.json')
var domain = "foo.com"
var ip = domains["foo.com"]

D(domain,"none",
A("@",ip)
D(domain, "none",
A("@", ip)
);
11 changes: 5 additions & 6 deletions pkg/js/parse_tests/025-autodnssec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
D("nothing.com","none"
D("nothing.com", "none");
D("with.com", "none",
AUTODNSSEC_ON
);
D("with.com","none",
AUTODNSSEC_ON
);
D("without.com","none",
AUTODNSSEC_OFF
D("without.com", "none",
AUTODNSSEC_OFF
);
8 changes: 4 additions & 4 deletions pkg/js/parse_tests/026-azure-alias.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
D("foo.com", "none",
AZURE_ALIAS("atest", "A", "foo.com."),
AZURE_ALIAS("aaaatest", "AAAA", "foo.com."),
AZURE_ALIAS("cnametest", "CNAME", "foo.com.")
);
AZURE_ALIAS("atest", "A", "foo.com."),
AZURE_ALIAS("aaaatest", "AAAA", "foo.com."),
AZURE_ALIAS("cnametest", "CNAME", "foo.com.")
);
2 changes: 1 addition & 1 deletion pkg/js/parse_tests/027-ds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
D("foo.com","none",
D("foo.com", "none",
DS("@", 1000, 13, 2, "AABBCCDDEEFF"),
DS("@", 1, 1, 1, "FFFF")
);
16 changes: 8 additions & 8 deletions pkg/js/parse_tests/028-dextend.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ var CF = NewDnsProvider("Cloudflare", "CLOUDFLAREAPI");

// Zone and subdomain Zone:
D("foo.com", REG, DnsProvider(CF),
A("@", "10.1.1.1"),
A("www", "10.2.2.2")
A("@", "10.1.1.1"),
A("www", "10.2.2.2")
);
D("bar.foo.com", REG, DnsProvider(CF),
A("@", "10.3.3.3"),
A("www", "10.4.4.4")
A("@", "10.3.3.3"),
A("www", "10.4.4.4")
);

// Zone that gets extended
D("foo.edu", REG, DnsProvider(CF),
A("@", "10.5.5.5"),
A("www", "10.6.6.6")
A("@", "10.5.5.5"),
A("www", "10.6.6.6")
);
D_EXTEND("foo.edu",
A("more1", "10.7.7.7"),
A("more2", "10.8.8.8")
A("more1", "10.7.7.7"),
A("more2", "10.8.8.8")
);
Loading

0 comments on commit 2e753eb

Please sign in to comment.