From f81a0b3da32d5f8aadafa7f426a5bdf370d210c2 Mon Sep 17 00:00:00 2001 From: sjlleo Date: Wed, 25 May 2022 17:25:26 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=BD=93=20ip.sb=20=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=20cloudflare=205s=20=E5=A2=99=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=20=E8=87=AA=E5=8A=A8=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ipgeo/ipsb.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ipgeo/ipsb.go b/ipgeo/ipsb.go index aca919b..873dea4 100644 --- a/ipgeo/ipsb.go +++ b/ipgeo/ipsb.go @@ -4,6 +4,7 @@ import ( "io/ioutil" "log" "net/http" + "os" "time" "github.com/tidwall/gjson" @@ -26,6 +27,11 @@ func IPSB(ip string) (*IPGeoData, error) { body, _ := ioutil.ReadAll(content.Body) res := gjson.ParseBytes(body) + if res.Get("country").String() == "" { + // 什么都拿不到,证明被Cloudflare风控了 + os.Exit(1) + } + return &IPGeoData{ Asnumber: res.Get("asn").String(), Country: res.Get("country").String(),