Skip to content

Commit

Permalink
add ECS example
Browse files Browse the repository at this point in the history
  • Loading branch information
rthalley committed Jul 10, 2020
1 parent 540e0d1 commit 858bd95
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/ecs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import dns.edns
import dns.message
import dns.query

# This example demonstrates how to use the EDNS client subnet option

ADDRESS = '0.0.0.0' # replace this with the address you want to check
PREFIX = 0 # replace this with a prefix length (typically 24 for IPv4)

ecs = dns.edns.ECSOption(ADDRESS, PREFIX)
q = dns.message.make_query('www.google.com', 'A', use_edns=0, options=[ecs])
r = dns.query.udp(q, '8.8.8.8')
print(r)

0 comments on commit 858bd95

Please sign in to comment.