1 Star 0 Fork 0

clsld/go_test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
network.go 458 Bytes
一键复制 编辑 原始数据 按行查看 历史
clsld 提交于 2年前 . update
/**
* @Description 网络操作相关的工具类
* @Author chenlin
* @Date 2023/7/31 01:31
**/
package utils
import (
"io/ioutil"
netHttp "net/http"
)
// @Author Chenlin
// @Description 获取外网地址
// @time 2023/7/31
func GetOutNetIp() string {
resp, err := netHttp.Get("http://myexternalip.com/raw")
if err != nil {
panic("error to get real ip")
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
return string(body)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/clsld/go_test.git
git@gitee.com:clsld/go_test.git
clsld
go_test
go_test
v1.0.2

搜索帮助