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

增加指定网卡功能 #129

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

增加指定网卡功能 #129

wants to merge 6 commits into from

Conversation

mem0rz
Copy link
Contributor

@mem0rz mem0rz commented Feb 9, 2020

导入了一个netifaces库

@NewFuture
Copy link
Owner

谢谢修改,两个问题

  1. 这个与数字(0,1,2,3等): 第 i 个网卡 ip这个功能是否有区别?
  2. 尽量避免引入库外部依赖,尽量简单,保证有python的环境即可执行。

@mem0rz
Copy link
Contributor Author

mem0rz commented Feb 11, 2020

谢谢修改,两个问题

1. 这个与`数字(0,1,2,3等): 第 i 个网卡 ip`这个功能是否有区别?

2. 尽量避免引入库外部依赖,尽量简单,保证有python的环境即可执行。

数字0,1,2,3这个返回的是从/etc/hostname里读取的IP。不是真正的从网卡读取IP
image
然后第二个问题的话我也没想到特别好的方法。好像这种读取系统硬件信息的方法都是要引入别的包。

增加华为DNS
更换get获取IP地址的接口
@purerosefallen
Copy link

I don't think specifying the count of net interfaces is a good idea. Sometimes it would be annoying if new interfaces are added, causing the number changed

@purerosefallen
Copy link

I think adding a library could be acceptable. Because getting interface address in system way is better than parsing the command line output.

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.

None yet

3 participants