当在linux上时,得到的是docker0的地址#73
Open
doodoocoder wants to merge 1 commit into
Open
Conversation
当在linux上时,得到的是docker0的地址,直接选最后一个ip地址即为“真实”ip
Contributor
|
@doodoocoder 谢谢 不过选最后一个就代表选的是真实ip么? 是巧合,还是确实就是这样呢?有依据么 |
Author
|
我在windows 10测试了,环境是一个虚拟网卡(virtualbox虚拟出来的),一个真实的局域网地址,选取最后一个能得到真实的局域网ip地址,在linux上测试,环境是安装了docker,选取最后一个就是真实的局域网地址,但在云服务器上,得不到真实的外网地址,只能得到局域网的地址,我建议这个地址直接在实时broker,delay broker中配置,不用代码获取,最稳当,你觉得呢? |
Contributor
|
@doodoocoder |
Contributor
|
@doodoocoder |
|
这个修改应该不是最终方案,老代码在某些装了docker的机器上依然可以拿到正确的IP地址,应该是和ioctl的SIOCGIFCONF有关系,暂时没查到这个列表的内部sort规则。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
当在linux上时,得到的是docker0的地址,直接选最后一个ip地址即为“真实”ip即可