core/dnsserver: normalize server block zones (#8320)

This commit is contained in:
houyuwushang
2026-07-23 10:04:15 +08:00
committed by GitHub
parent 1cf446a2b5
commit 55949d626b
3 changed files with 36 additions and 1 deletions

View File

@@ -143,6 +143,19 @@ func TestInspectServerBlocks(t *testing.T) {
"dns://example.org.:53": {Zone: "example.org.", Port: "53", Transport: "dns"},
},
},
{
name: "uppercase dns",
serverBlocks: []caddyfile.ServerBlock{
{Keys: []string{"EXAMPLE.ORG"}},
},
expectedServerBlocks: []caddyfile.ServerBlock{
{Keys: []string{"dns://example.org.:53"}},
},
expectedConfigsLen: 1,
expectedZoneAddrs: map[string]zoneAddr{
"dns://example.org.:53": {Zone: "example.org.", Port: "53", Transport: "dns"},
},
},
{
name: "dns with port",
serverBlocks: []caddyfile.ServerBlock{