feat: add options for SRV record

This commit is contained in:
Adrien Waksberg 2018-05-25 13:06:21 +02:00
parent ade97f81e9
commit 56ade0a702
4 changed files with 9 additions and 0 deletions

View file

@ -58,6 +58,7 @@ bind_zones:
- { name: '@', type: ns, value: localhost. }
- { name: hello, type: a, ttl: 5m, value: 1.2.3.4 }
- { name: hello, type: caa, flag: 0, tag: issue, value: letsencrypt.org }
- { name: hello, type: srv, priority: 0, weight: 5, port: 80, value: www }
hello.local:
ns_primary: ns1.hello.local
mail: root@hello.local

View file

@ -12,6 +12,8 @@ $TTL {{ item.value.ttl|default(3600) }}
{% for record in item.value.records %}
{% if record.type|upper == 'MX' %}
{{ record.name }} {{ record.ttl|default(' ') }} IN MX {{ record.priority }} {{ record.value }}
{% elif record.type|upper == 'SRV' %}
{{ record.name }} {{ record.ttl|default(' ') }} IN SRV {{ record.priority }} {{ record.weight }} {{ record.port }} {{ record.value }}
{% elif record.type|upper == 'CAA' %}
{{ record.name }} {{ record.ttl|default(' ') }} CAA {{ record.flag }} {{ record.tag }} "{{ record.value }}"
{% elif record.type|upper == 'TXT' %}

View file

@ -28,6 +28,7 @@
- { name: hello, type: a, ttl: 5m, value: 1.2.3.4 }
- { name: hello, type: caa, flag: 0, tag: issue, value: letsencrypt.org }
- { name: hello, type: caa, flag: 0, tag: iodef, value: 'mailto:root@test.local' }
- { name: hello, type: srv, priority: 0, weight: 5, port: 80, value: www }
hello.local:
ns_primary: ns1.hello.local
mail: root@hello.local

View file

@ -87,6 +87,11 @@ describe command('dig +nocmd +noall +answer -t mx test.local @127.0.0.1') do
its(:stdout) { should contain(/test\.local\.\s+3600\s+IN\s+MX\s+20 mail\.test\.local\./) }
end
describe command('dig +nocmd +noall +answer -t srv hello.test.local @127.0.0.1') do
its(:exit_status) { should eq 0 }
its(:stdout) { should contain(/hello\.test\.local\.\s+3600\s+IN\s+SRV\s+0\s+5\s+80\s+www\.test\.local\.$/) }
end
describe command('dig +nocmd +noall +answer -t caa hello.test.local @127.0.0.1') do
its(:exit_status) { should eq 0 }
its(:stdout) { should contain(/hello\.test\.local\.\s+3600\s+IN\s+CAA\s+0 issue "letsencrypt\.org"/) }