Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add address check functions #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add address check functions #12

wants to merge 1 commit into from

Conversation

kerbalwzy
Copy link

在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中发现问题, 请回复告知我.

@coveralls
Copy link

coveralls commented Jul 8, 2019

Coverage Status

Coverage decreased (-1.05%) to 94.667% when pulling 4e618d0 on kerbalwzy:master into b3dec67 on linw1995:master.

@linw1995
Copy link
Owner

linw1995 commented Jul 8, 2019

添加这四个函数有什么用呢?

@kerbalwzy
Copy link
Author

😂不是你在源码里面留了检查IP和端口的TODO么

@linw1995
Copy link
Owner

linw1995 commented Jul 8, 2019

太久忘了😂。能不能在这个 pr 加上去呢?

@kerbalwzy kerbalwzy closed this Jul 9, 2019
@kerbalwzy kerbalwzy reopened this Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants