diff options
author | Bob Halley <halley@dnspython.org> | 2020-07-10 10:31:41 -0700 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2020-07-10 10:31:56 -0700 |
commit | 858bd95b78429c1f8d3e1c6b902f7445da437c1e (patch) | |
tree | 58f68e36064c0b568c8450c17bdc7a450ae63b3b | |
parent | 540e0d1f7d59e959b735cd1364ec9f2e32249e56 (diff) | |
download | dnspython-858bd95b78429c1f8d3e1c6b902f7445da437c1e.tar.gz |
add ECS example
-rwxr-xr-x | examples/ecs.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/ecs.py b/examples/ecs.py new file mode 100755 index 0000000..f7b31d8 --- /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) + |