Software /
code /
prosody-modules
Changeset
4896:54fa2116bbf3
mod_dnsupdate: Add a --remove option to delete all SRV records
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 17 Feb 2022 01:59:24 +0100 |
parents | 4895:2542fd80cd15 |
children | 4897:42a362a2bf51 |
files | mod_dnsupdate/mod_dnsupdate.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_dnsupdate/mod_dnsupdate.lua Tue Feb 15 21:51:52 2022 +0100 +++ b/mod_dnsupdate/mod_dnsupdate.lua Thu Feb 17 01:59:24 2022 +0100 @@ -42,6 +42,7 @@ out:write("\t-l --ttl\tTTL to use\n"); out:write("\t--each\tremove and replace individual SRV records\n"); out:write("\t--reset\tremove and replace all SRV records\n"); + out:write("\t--remove\tremove all SRV records\n"); return opts and opts.help and 0 or 1; end @@ -103,7 +104,7 @@ for _, service in ipairs(services) do local ports = set.new(configured_ports[service]); local records = (async.wait_for(existing_srv[service])); - if opts.reset then + if opts.remove or opts.reset then print(("del _%s._tcp.%s IN SRV"):format(service, ihost)); else for _, rr in ipairs(records) do @@ -117,7 +118,9 @@ end end end - for port in ports do print(("add _%s._tcp.%s IN SRV 1 1 %d %s"):format(service, ihost, port, target)); end + if not opts.remove then + for port in ports do print(("add _%s._tcp.%s IN SRV 1 1 %d %s"):format(service, ihost, port, target)); end + end end print("show");