From 9d8aa2445f0c9bde4fd56b5aaa6963abe5920d14 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Wed, 23 Dec 2020 14:50:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=96=E7=BD=91IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/ip.go | 3 +++ ws/ws.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/ip.go b/tools/ip.go index bedadca..17998ee 100644 --- a/tools/ip.go +++ b/tools/ip.go @@ -62,3 +62,6 @@ func getIpFromAddr(addr net.Addr) net.IP { return ip } +func GetExternalIp() string { + return Get("http://myexternalip.com/raw") +} diff --git a/ws/ws.go b/ws/ws.go index 2fafacc..b6a83ce 100644 --- a/ws/ws.go +++ b/ws/ws.go @@ -80,7 +80,8 @@ func SendServerJiang(title string, content string, domain string) string { } func SendFlyServerJiang(title string, content string, domain string) string { sendStr := fmt.Sprintf("%s%s", title, content) - desp := content + ",域名:" + domain + ip := tools.GetExternalIp() + desp := content + ",内网:" + domain + ",外网:" + ip url := "https://sc.ftqq.com/SCU113707T98a3ef409d8a018c98ee7abe3278a7155f5f49e886742.send?text=" + sendStr + "&desp=" + desp //log.Println(url) res := tools.Get(url)