Software /
code /
prosody
Comparison
util/dns.lua @ 12241:dd15f42f6312
util.dns: Minor updates of SVCB parser
Now based on draft-ietf-dnsop-svcb-https-08
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 02 Feb 2022 17:58:48 +0100 |
parent | 12240:ffd66b461f6a |
child | 12288:08a933450922 |
comparison
equal
deleted
inserted
replaced
12240:ffd66b461f6a | 12241:dd15f42f6312 |
---|---|
196 match = match; | 196 match = match; |
197 data = s_sub(packet, 4); | 197 data = s_sub(packet, 4); |
198 }, tlsa_mt); | 198 }, tlsa_mt); |
199 end | 199 end |
200 | 200 |
201 local svcb_params = {"alpn"; "no-default-alpn"; "port"; "ipv4hint"; "echconfig"; "ipv6hint"}; | 201 local svcb_params = {"alpn"; "no-default-alpn"; "port"; "ipv4hint"; "ech"; "ipv6hint"}; |
202 setmetatable(svcb_params, {__index = function(_, n) return "key" .. tostring(n); end}); | 202 setmetatable(svcb_params, {__index = function(_, n) return "key" .. tostring(n); end}); |
203 | 203 |
204 local svcb_mt = { | 204 local svcb_mt = { |
205 __tostring = function (rr) | 205 __tostring = function (rr) |
206 local kv = {}; | 206 local kv = {}; |
207 for i = 1, #rr.fields do | 207 for i = 1, #rr.fields do |
208 t_insert(kv, s_format("%s=%q", svcb_params[rr.fields[i].key], tostring(rr.fields[i].value))); | 208 t_insert(kv, s_format("%s=%q", svcb_params[rr.fields[i].key], tostring(rr.fields[i].value))); |
209 -- FIXME the =value part may be omitted when the value is "empty" | |
209 end | 210 end |
210 return s_format("%d %s %s", rr.prio, rr.name, t_concat(kv, " ")); | 211 return s_format("%d %s %s", rr.prio, rr.name, t_concat(kv, " ")); |
211 end; | 212 end; |
212 }; | 213 }; |
213 local svbc_ip_mt = {__tostring = function(ip) return t_concat(ip, ", "); end} | 214 local svbc_ip_mt = {__tostring = function(ip) return t_concat(ip, ", "); end} |