nonebot-plugin-mccheck 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/PKG-INFO +1 -1
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/configs.py +1 -1
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/utils.py +14 -11
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/pyproject.toml +1 -1
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/LICENSE +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/README.md +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/__init__.py +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/config.py +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/data_source.py +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/language.json +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/Minecraft_AE.ttf +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/README.md +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/background.png +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/default.html +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/imagelesshoverbg.png +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/main.css +0 -0
- {nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/templates/no_favicon.png +0 -0
{nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/utils.py
RENAMED
|
@@ -8,6 +8,7 @@ from typing import Literal
|
|
|
8
8
|
|
|
9
9
|
import dns.asyncresolver
|
|
10
10
|
import dns.exception
|
|
11
|
+
import dns.name
|
|
11
12
|
import dns.resolver
|
|
12
13
|
import idna
|
|
13
14
|
from nonebot import logger, require
|
|
@@ -289,21 +290,23 @@ def is_validity_address(address: str) -> bool:
|
|
|
289
290
|
|
|
290
291
|
def is_domain(address: str) -> bool:
|
|
291
292
|
"""
|
|
292
|
-
|
|
293
|
+
判断给定的地址是否为合法域名。
|
|
293
294
|
|
|
294
|
-
:
|
|
295
|
-
|
|
296
|
-
:
|
|
295
|
+
:param str address: 待验证的域名字符串。
|
|
296
|
+
:returns: 如果合法返回 True,否则返回 False。
|
|
297
|
+
:rtype: bool
|
|
297
298
|
"""
|
|
298
299
|
try:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return False
|
|
300
|
+
# 尝试构造 DNS Name 对象
|
|
301
|
+
name = dns.name.from_text(address)
|
|
302
302
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
# 检查总长度是否符合 RFC (<= 253)
|
|
304
|
+
if len(name.to_unicode()) > 253:
|
|
305
|
+
return False
|
|
306
|
+
|
|
307
|
+
return all(len(label) <= 63 for label in name.labels)
|
|
308
|
+
except Exception:
|
|
309
|
+
return False
|
|
307
310
|
|
|
308
311
|
|
|
309
312
|
def is_ipv4(address: str) -> bool:
|
|
File without changes
|
|
File without changes
|
{nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/__init__.py
RENAMED
|
File without changes
|
{nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/config.py
RENAMED
|
File without changes
|
{nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/data_source.py
RENAMED
|
File without changes
|
{nonebot_plugin_mccheck-0.2.3 → nonebot_plugin_mccheck-0.2.4}/nonebot_plugin_mccheck/language.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|