You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert b == raw(SvcParam(key='mandatory', value=['alpn', 'ipv6hint']))
252
+
253
+
b = b'\x00\x01\x00\x06\x02h3\x02h2'
254
+
p = SvcParam(b)
255
+
assert p.key == 1 and p.value == [b'h3', b'h2']
256
+
assert b == raw(SvcParam(key='alpn', value=['h3', 'h2']))
257
+
258
+
b = b'\x00\x02\x00\x00'
259
+
p = SvcParam(b)
260
+
assert p.key == 2 and p.value == []
261
+
assert b == raw(SvcParam(key='no-default-alpn'))
262
+
263
+
b = b'\x00\x03\x00\x02\x04\xd2'
264
+
p = SvcParam(b)
265
+
assert p.key == 3 and p.value == 1234
266
+
assert b == raw(SvcParam(key='port', value=1234))
267
+
268
+
b = b'\x00\x04\x00\x08\xc0\xa8\x00\x01\xc0\xa8\x00\x02'
269
+
p = SvcParam(b)
270
+
assert p.key == 4 and p.value == ['192.168.0.1', '192.168.0.2']
271
+
assert b == raw(SvcParam(key='ipv4hint', value=['192.168.0.1', '192.168.0.2']))
272
+
273
+
b = b'\x00\x06\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
274
+
p = SvcParam(b)
275
+
assert p.key == 6 and p.value == ['2001:db8::1']
276
+
assert b == raw(SvcParam(key='ipv6hint', value=['2001:db8::1']))
277
+
278
+
b = b'\x00\x07\x00\x10/dns-query{?dns}'
279
+
p = SvcParam(b)
280
+
assert p.key == 7 and p.value == b'/dns-query{?dns}'
281
+
assert b == raw(SvcParam(key='dohpath', value=b'/dns-query{?dns}'))
282
+
283
+
p = DNSRRSVCB()
284
+
assert p.rrname == b'.' and p.type == 64 and p.svc_priority == 0 and p.svc_params == []
285
+
286
+
p = DNSRRHTTPS()
287
+
assert p.rrname == b'.' and p.type == 65 and p.svc_priority == 0 and p.svc_params == []
288
+
289
+
# Real-world SVCB RR
290
+
b = b'\x04_dns\x03one\x03one\x03one\x03one\x00\x00@\x00\x01\x00\x00\x01,\x001\x00\x01\x03one\x03one\x03one\x03one\x00\x00\x01\x00\x06\x02h3\x02h2\x00\x07\x00\x10/dns-query{?dns}'
291
+
p = DNSRRSVCB(b)
292
+
assert p.type == 64 and p.ttl == 300 and p.svc_priority == 1 and p.target_name == b'one.one.one.one.'
assert b == raw(DNSRRSVCB(rrname='_dns.one.one.one.one', ttl=300, svc_priority=1, target_name='one.one.one.one', svc_params=[alpn, dohpath]))
301
+
302
+
# Real-world HTTPS RR
303
+
b = b'\ncloudflare\x03com\x00\x00A\x00\x01\x00\x00\x00>\x00=\x00\x01\x00\x00\x01\x00\x06\x02h3\x02h2\x00\x04\x00\x08h\x10\x84\xe5h\x10\x85\xe5\x00\x06\x00 &\x06G\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x10\x84\xe5&\x06G\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x10\x85\xe5'
304
+
305
+
p = DNSRRHTTPS(b)
306
+
assert p.type == 65 and p.ttl == 62 and p.svc_priority == 1 and p.target_name == b'.'
0 commit comments