Skip to content

Commit 542b7b8

Browse files
committed
fix: fix hostname error
1 parent 9d2fd82 commit 542b7b8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
name='smartdns',
2727
description='An Intelligent DNS Similar to DNSPod',
28-
version='3.3.6',
28+
version='3.3.7',
2929
author='duanhongyi',
3030
author_email='duanhyi@gmail.com',
3131
packages=find_packages(),

smartdns/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ def packResult(value, ttl):
8686
add.append(dns.RRHeader('', sdns.EDNS, 4096, 0, sdns.Record_EDNS(None, 0), True))
8787
return [ret, (), add]
8888

89-
wildcard = name[name.index("."):]
89+
wildcard = name[name.index("."):] if "." in name else None
9090
if name in self.a_mapping:
9191
ttl = self.a_mapping[name]['ttl']
9292
result = self.finder.findIP(str(addr[0]), name)
9393
random.shuffle(result) # 返回的IP数组乱序
9494
return packResult(result, ttl)
95-
elif wildcard in self.a_mapping:
95+
elif wildcard is not None and wildcard in self.a_mapping:
9696
ttl = self.a_mapping[wildcard]['ttl']
9797
result = self.finder.findIP(str(addr[0]), wildcard)
9898
random.shuffle(result) # 返回的IP数组乱序

0 commit comments

Comments
 (0)