Skip to content

Commit 521aab0

Browse files
committed
fix other type issue
1 parent 3f6761f commit 521aab0

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/dns_observe/dns.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import datetime
55
import argparse
66

7-
__version__ = "0.6.1"
7+
__version__ = "0.6.2"
88

99
# DNS query type
1010
class QueryType:
@@ -80,7 +80,7 @@ def query(self, qname, qtype=QueryType.A):
8080
if len(dns_record.answers) == 0:
8181
code = dns_record.flags & 0b1111
8282
reply = DNS_RCODE.get(code, 'Unassigned')
83-
print(f"Time: {now}, Reply code: {reply}({code})")
83+
print(f"Time: {now}, Reply code: {reply}({code}), Answer RRS: 0")
8484
if len(dns_record.answers) == 1:
8585
single = True
8686
if len(dns_record.answers) > 1:
@@ -141,11 +141,13 @@ def _parse_name(self, response: bytes, offset: int) -> tuple[str, int]:
141141
p, _set = self._parse_name(response, _offset) # 递归调用
142142
parts.extend(p) # list extend
143143
offset += 2
144-
nlen = 0
144+
nlen = 0 # break
145145
else:
146146
parts.append(response[offset+1:offset+nlen+1]) # list append
147147
offset += nlen + 1
148148
nlen = response[offset]
149+
if nlen == 0: # offset + 1 before break
150+
offset += 1
149151

150152
return parts, offset
151153

tests/domain_list.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
google.com
22
google.com.hk
33
google.cn
4+
googlevideo.com
5+
googleapis.com
6+
google-analytics.com
7+
googletagmanager.com
48
googleusercontent.com
59
ggpht.com
610
gstatic.com
7-
googleapis.com
811
facebook.com
912
fbcdn.net
1013
twitter.com
@@ -20,9 +23,5 @@ github.com
2023
github.io
2124
disqus.com
2225
imgur.com
23-
google.com
24-
googlevideo.com
25-
google-analytics.com
26-
googletagmanager.com
2726
reddit.com
2827
redd.it

0 commit comments

Comments
 (0)