command
Version:
v0.0.0-...-f10d331
Opens a new window with list of versions in this module.
Published: Dec 8, 2023
License: MIT
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
实验4,得到本机和公网ip
我们在测试服务器的时候,经常在本机和外网的服务器上测试,配置文件改起来比较麻烦。
所以准备直接在测试的时候,直接在服务器里面加上得到ip的代码,运行在这个ip上。
设计的目标:
- 一般的pc上,直接得到局域网的地址
- 在云服务器上,有的云服务器只有10开头的内网,这时候要得到外网的地址(也可以返回
0.0.0.0
)
- 有的云服务器,会有内网和外网两个地址,这时候返回外网
- 要去掉docker或者vm的虚拟网卡,和云服务器上的一些虚拟网卡
运行结果
参考资料
http://golangtc.com/t/5111b98b320b5209f4000004
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.