Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在utils模块下添加了addr_check模块, addr_check模块包含以下几个函数:
def _host_addresses() -> set; 获取本机的所有有效IPV4地址
def ip_validate(ip: str) -> bool; 检查IP的有效性
def _port_is_free(port: int) -> bool; 检查端口是否被占用
def port_validate(port: int) -> bool; 检查端口的有效性
并且简单写了个单元测试⚠️ :运行单元测试前要去掉 “函数注解”, 否则会引发语法错误
😁我只新增了这个模块, 但是没有改动你的其他任何代码
如果你采纳了本次提交, 关于项目中的 # TODO 验证addr有效性等位置的代码请有您自己修改
如果你在CodeReview中发现问题, 请回复告知我.