Skip to content

Commit cb0cdbf

Browse files
committed
update docs
1 parent 5386356 commit cb0cdbf

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

docs/content/docs/dns/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ A record belongs to one zone and stores one response. To support multiple respon
3131

3232
To create a record at the root of the zone, set the name of the record to `@`.
3333

34+
To create a wildcard record, set the name of the record to `*`. Note that if a more specific record exists for the queried name, it will have a higher priority and the wildcard record will not be returned.
35+
Wildcard records can also be used for multiple levels, for example creating a record called `*.*` in a zone `example.com` will be matched for a query to `foo.bar.example.com`. Here the first wildcard record, sorted by the least amount of depth (amount of `.`) will be returned, and no other records will be returned.
36+
3437
A single record holds the following data:
3538

3639
- `data`: The actual response, an IP for A/AAAA records, text for TXT records, etc.

pkg/roles/dns/handler_etcd_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
2424
inst.KV().Key(
2525
types.KeyRole,
2626
types.KeyZones,
27-
".",
27+
TestZone,
2828
).String(),
2929
tests.MustJSON(dns.Zone{
3030
HandlerConfigs: []map[string]string{
@@ -39,7 +39,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
3939
inst.KV().Key(
4040
types.KeyRole,
4141
types.KeyZones,
42-
".",
42+
TestZone,
4343
"foo",
4444
types.DNSRecordTypeA,
4545
"0",
@@ -58,7 +58,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
5858
role.Handler(fw, &d.Msg{
5959
Question: []d.Question{
6060
{
61-
Name: "foo.",
61+
Name: "foo.example.com.",
6262
Qtype: d.TypeA,
6363
Qclass: d.ClassINET,
6464
},
@@ -133,7 +133,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
133133
inst.KV().Key(
134134
types.KeyRole,
135135
types.KeyZones,
136-
".",
136+
TestZone,
137137
).String(),
138138
tests.MustJSON(dns.Zone{
139139
HandlerConfigs: []map[string]string{
@@ -148,7 +148,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
148148
inst.KV().Key(
149149
types.KeyRole,
150150
types.KeyZones,
151-
".",
151+
TestZone,
152152
"*",
153153
types.DNSRecordTypeA,
154154
"0",
@@ -167,7 +167,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
167167
role.Handler(fw, &d.Msg{
168168
Question: []d.Question{
169169
{
170-
Name: "foo.",
170+
Name: "foo.example.com.",
171171
Qtype: d.TypeA,
172172
Qclass: d.ClassINET,
173173
},
@@ -187,7 +187,7 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
187187
inst.KV().Key(
188188
types.KeyRole,
189189
types.KeyZones,
190-
"test.",
190+
TestZone,
191191
).String(),
192192
tests.MustJSON(dns.Zone{
193193
HandlerConfigs: []map[string]string{
@@ -202,21 +202,21 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
202202
inst.KV().Key(
203203
types.KeyRole,
204204
types.KeyZones,
205-
"test.",
205+
TestZone,
206206
"foo",
207207
types.DNSRecordTypeCNAME,
208208
"0",
209209
).String(),
210210
tests.MustJSON(dns.Record{
211-
Data: "bar.test.",
211+
Data: "bar.example.com.",
212212
}),
213213
))
214214
tests.PanicIfError(inst.KV().Put(
215215
ctx,
216216
inst.KV().Key(
217217
types.KeyRole,
218218
types.KeyZones,
219-
"test.",
219+
TestZone,
220220
"bar",
221221
types.DNSRecordTypeA,
222222
"0",
@@ -235,7 +235,7 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
235235
role.Handler(fw, &d.Msg{
236236
Question: []d.Question{
237237
{
238-
Name: "bar.test.",
238+
Name: "bar.example.com.",
239239
Qtype: d.TypeA,
240240
Qclass: d.ClassINET,
241241
},
@@ -248,14 +248,14 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
248248
role.Handler(fw, &d.Msg{
249249
Question: []d.Question{
250250
{
251-
Name: "foo.test.",
251+
Name: "foo.example.com.",
252252
Qtype: d.TypeCNAME,
253253
Qclass: d.ClassINET,
254254
},
255255
},
256256
})
257257
ans = fw.Msg().Answer[0]
258-
assert.Equal(t, "bar.test.", ans.(*d.CNAME).Target)
258+
assert.Equal(t, "bar.example.com.", ans.(*d.CNAME).Target)
259259
}
260260

261261
func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
@@ -268,7 +268,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
268268
inst.KV().Key(
269269
types.KeyRole,
270270
types.KeyZones,
271-
".",
271+
TestZone,
272272
).String(),
273273
tests.MustJSON(dns.Zone{
274274
HandlerConfigs: []map[string]string{
@@ -283,7 +283,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
283283
inst.KV().Key(
284284
types.KeyRole,
285285
types.KeyZones,
286-
".",
286+
TestZone,
287287
"*.*",
288288
types.DNSRecordTypeA,
289289
"0",
@@ -302,7 +302,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
302302
role.Handler(fw, &d.Msg{
303303
Question: []d.Question{
304304
{
305-
Name: "foo.bar.",
305+
Name: "foo.bar.example.com.",
306306
Qtype: d.TypeA,
307307
Qclass: d.ClassINET,
308308
},
@@ -322,7 +322,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
322322
inst.KV().Key(
323323
types.KeyRole,
324324
types.KeyZones,
325-
"TesT.",
325+
"eXaMpLe.CoM.",
326326
).String(),
327327
tests.MustJSON(dns.Zone{
328328
HandlerConfigs: []map[string]string{
@@ -337,7 +337,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
337337
inst.KV().Key(
338338
types.KeyRole,
339339
types.KeyZones,
340-
"TesT.",
340+
"eXaMpLe.CoM.",
341341
"bar",
342342
types.DNSRecordTypeA,
343343
"0",
@@ -356,7 +356,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
356356
role.Handler(fw, &d.Msg{
357357
Question: []d.Question{
358358
{
359-
Name: "bar.test.",
359+
Name: "bar.example.com.",
360360
Qtype: d.TypeA,
361361
Qclass: d.ClassINET,
362362
},
@@ -376,7 +376,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
376376
inst.KV().Key(
377377
types.KeyRole,
378378
types.KeyZones,
379-
"test.",
379+
TestZone,
380380
).String(),
381381
tests.MustJSON(dns.Zone{
382382
HandlerConfigs: []map[string]string{
@@ -391,7 +391,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
391391
inst.KV().Key(
392392
types.KeyRole,
393393
types.KeyZones,
394-
"test.",
394+
TestZone,
395395
"bar",
396396
types.DNSRecordTypeA,
397397
"0",
@@ -410,7 +410,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
410410
role.Handler(fw, &d.Msg{
411411
Question: []d.Question{
412412
{
413-
Name: "bar.TesT.",
413+
Name: "bar.eXaMpLe.CoM.",
414414
Qtype: d.TypeA,
415415
Qclass: d.ClassINET,
416416
},

0 commit comments

Comments
 (0)