Skip to content

增加指定网卡功能#129

Open
mem0rz wants to merge 6 commits intoNewFuture:masterfrom
mem0rz:master
Open

增加指定网卡功能#129
mem0rz wants to merge 6 commits intoNewFuture:masterfrom
mem0rz:master

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.

3 participants