From 858bd95b78429c1f8d3e1c6b902f7445da437c1e Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 10 Jul 2020 10:31:41 -0700 Subject: [PATCH] add ECS example --- examples/ecs.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 examples/ecs.py diff --git a/examples/ecs.py b/examples/ecs.py new file mode 100755 index 00000000..f7b31d84 --- /dev/null +++ b/examples/ecs.py @@ -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) + -- 2.47.3