Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu committed Oct 11, 2024
1 parent 5386356 commit cb0cdbf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
3 changes: 3 additions & 0 deletions docs/content/docs/dns/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ A record belongs to one zone and stores one response. To support multiple respon

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

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.
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.

A single record holds the following data:

- `data`: The actual response, an IP for A/AAAA records, text for TXT records, etc.
Expand Down
44 changes: 22 additions & 22 deletions pkg/roles/dns/handler_etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -39,7 +39,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
"foo",
types.DNSRecordTypeA,
"0",
Expand All @@ -58,7 +58,7 @@ func TestRoleDNS_Etcd(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "foo.",
Name: "foo.example.com.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -148,7 +148,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
"*",
types.DNSRecordTypeA,
"0",
Expand All @@ -167,7 +167,7 @@ func TestRoleDNS_Etcd_Wildcard(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "foo.",
Name: "foo.example.com.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand All @@ -187,7 +187,7 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"test.",
TestZone,
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -202,21 +202,21 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"test.",
TestZone,
"foo",
types.DNSRecordTypeCNAME,
"0",
).String(),
tests.MustJSON(dns.Record{
Data: "bar.test.",
Data: "bar.example.com.",
}),
))
tests.PanicIfError(inst.KV().Put(
ctx,
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"test.",
TestZone,
"bar",
types.DNSRecordTypeA,
"0",
Expand All @@ -235,7 +235,7 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "bar.test.",
Name: "bar.example.com.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand All @@ -248,14 +248,14 @@ func TestRoleDNS_Etcd_CNAME(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "foo.test.",
Name: "foo.example.com.",
Qtype: d.TypeCNAME,
Qclass: d.ClassINET,
},
},
})
ans = fw.Msg().Answer[0]
assert.Equal(t, "bar.test.", ans.(*d.CNAME).Target)
assert.Equal(t, "bar.example.com.", ans.(*d.CNAME).Target)
}

func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
Expand All @@ -268,7 +268,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -283,7 +283,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
".",
TestZone,
"*.*",
types.DNSRecordTypeA,
"0",
Expand All @@ -302,7 +302,7 @@ func TestRoleDNS_Etcd_WildcardNested(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "foo.bar.",
Name: "foo.bar.example.com.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand All @@ -322,7 +322,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"TesT.",
"eXaMpLe.CoM.",
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -337,7 +337,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"TesT.",
"eXaMpLe.CoM.",
"bar",
types.DNSRecordTypeA,
"0",
Expand All @@ -356,7 +356,7 @@ func TestRoleDNS_Etcd_MixedCase(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "bar.test.",
Name: "bar.example.com.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand All @@ -376,7 +376,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"test.",
TestZone,
).String(),
tests.MustJSON(dns.Zone{
HandlerConfigs: []map[string]string{
Expand All @@ -391,7 +391,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
inst.KV().Key(
types.KeyRole,
types.KeyZones,
"test.",
TestZone,
"bar",
types.DNSRecordTypeA,
"0",
Expand All @@ -410,7 +410,7 @@ func TestRoleDNS_Etcd_MixedCase_Reverse(t *testing.T) {
role.Handler(fw, &d.Msg{
Question: []d.Question{
{
Name: "bar.TesT.",
Name: "bar.eXaMpLe.CoM.",
Qtype: d.TypeA,
Qclass: d.ClassINET,
},
Expand Down

0 comments on commit cb0cdbf

Please sign in to comment.