gera2ld / async-doh Goto Github PK
View Code? Open in Web Editor NEWDNS over HTTPS based on aiohttp and async-dns
DNS over HTTPS based on aiohttp and async-dns
Hello, First of all, amazing work on the doh library!
I was trying to get the TXT record for example.com
which errored out the ParseError.
Code:
import asyncio
from async_doh.client import DoHClient
async def async_query(domain):
async with DoHClient() as client:
return await client.query("https://1.1.1.1/dns-query", domain, "TXT")
result = asyncio.run(async_query("example.com"))
print(result)
Error Traceback:
Traceback (most recent call last):
File "gen.py", line 10, in <module>
result = asyncio.run(async_query("example.com"))
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "gen.py", line 7, in async_query
return await client.query("https://1.1.1.1/dns-query", domain, "TXT")
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_doh/client.py", line 49, in query
return await self.request_message(url, req, method)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_doh/client.py", line 41, in request_message
result = DNSMessage.parse(data)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_dns/core/record.py", line 313, in parse
l, ans.an = ans.parse_entry(RESPONSE, data, l, an)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_dns/core/record.py", line 294, in parse_entry
l = r.parse(data, l)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_dns/core/record.py", line 196, in parse
_, self.data = utils.load_message(data, l)
File "/Users/scorpionk/.pyenv/versions/3.8.6/lib/python3.8/site-packages/async_dns/core/utils.py", line 39, in load_message
assert cursor is not None, ParseError(data, offset)
AssertionError
If I do the curl of example.com
TXT record using Cloudflare DNS then I get the following result.
Command:
curl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=example.com&type=TXT' | python -m json.tool
Output:
{
"Status": 0,
"TC": false,
"RD": true,
"RA": true,
"AD": true,
"CD": false,
"Question": [
{
"name": "example.com",
"type": 16
}
],
"Answer": [
{
"name": "example.com",
"type": 16,
"TTL": 86400,
"data": "\"v=spf1 -all\""
},
{
"name": "example.com",
"type": 16,
"TTL": 86400,
"data": "\"8j5nfqld20zpcyr8xjw0ydcfq9rk8hgm\""
}
]
}
It would be great if this can be fixed.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.