Skip to content

Commit

Permalink
Add a simple tsig example.
Browse files Browse the repository at this point in the history
  • Loading branch information
rthalley committed Mar 11, 2024
1 parent 11b09df commit 21cda62
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/tsig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

import dns.message
import dns.query
import dns.tsig


key = dns.tsig.Key("keyname.", "bnp6+y85UcBfsieuB/Uhx3EUsjc8wAFyyCSS5rhScb0=",
algorithm=dns.tsig.HMAC_SHA256)


q = dns.message.make_query("example.", "SOA")
q.use_tsig(keyring=key)
r = dns.query.udp(q, "127.0.0.1") # your authority address here
soa = r.find_rrset(r.answer, "example", "IN", "SOA")
print(soa)


0 comments on commit 21cda62

Please sign in to comment.