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