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

调试工具效果预览页使用的ip地址不够严谨 #504

Open
libmw opened this issue Dec 1, 2020 · 2 comments
Open

调试工具效果预览页使用的ip地址不够严谨 #504

libmw opened this issue Dec 1, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@libmw
Copy link

libmw commented Dec 1, 2020

bug描述
执行cml dev后自动打开的preview.html页面使用了require('ip').address()的方式获取ip,但是这个ip并不一定是开发者需要的ip。
开发者需要的ip应该是和手机wifi在同一个网络中的那个ip地址,当用户有多张网卡的时候,require('ip').address()返回的很可能不是用户想要的那个网卡的地址。

复现bug的步骤

  1. 在开发机上配置多张网卡(可以是虚拟网卡)
  2. 执行cml dev
  3. 打开的地址是虚拟网卡的地址而不是和手机在同一网络的无线网卡的地址,此时手机端的Chameleon Playground App扫描二维码无法访问。

问题截图
image

编译环境信息

  • chameleon-tool 版本:[1.0.8]
  • nodejs版本、npm版本:[node v13.12.0、npm 6.14.4]
  • 电脑操作系统: [Microsoft Windows [版本 10.0.18363.1198]]

运行环境信息

  • 端版本: [Chameleon Playground App]
  • 手机机型: [小米10]
@libmw libmw added the bug Something isn't working label Dec 1, 2020
@jimwmg
Copy link
Collaborator

jimwmg commented Dec 24, 2020

欢迎能提供解决方案和我们一起共建

@zhuyifang
Copy link

tcp/ip协议中,专门保留了三个IP地址区域作为私有地址,其地址范围如下
10.0.0.0/8:10.0.0.0~10.255.255.255
172.16.0.0/12:172.16.0.0~172.31.255.255
192.168.0.0/16:192.168.0.0~192.168.255.255
绝大部分都是 192,所以针对这个问题,就很好办了,
最后再加一个IP配置项,这样就够灵活和方便

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants