Skip to content

Instantly share code, notes, and snippets.

@alxrdn
Last active September 24, 2025 14:39
Show Gist options
  • Select an option

  • Save alxrdn/bc3b2a4beed431d7f1b2f606fe9332e9 to your computer and use it in GitHub Desktop.

Select an option

Save alxrdn/bc3b2a4beed431d7f1b2f606fe9332e9 to your computer and use it in GitHub Desktop.

Revisions

  1. alxrdn revised this gist Mar 29, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion dnsmasq_https_rr.py
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    import dns.rdata
    import dns.rdata # pip3 install dnspython
    import io

    name = "host.example.com."
  2. alxrdn revised this gist Mar 21, 2024. No changes.
  3. alxrdn created this gist Mar 21, 2024.
    14 changes: 14 additions & 0 deletions dnsmasq_https_rr.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import dns.rdata
    import io

    name = "host.example.com."
    rclass = dns.rdataclass.IN
    rtype = dns.rdatatype.HTTPS
    rdata = '1 . alpn="h3,h2" ipv4hint="XXX.XXX.XXX.XXX"'


    rd = dns.rdata.from_text(rclass, rtype, rdata)
    f = io.BytesIO()
    rd.to_wire(f)
    wire_data = f.getvalue()
    print ("dnsmasq option: --dns-rr=" + name + "," + str(rtype) + "," + wire_data.hex().upper())