From cfc5445ed9cf24b0bf87fcff4215b167387373bd Mon Sep 17 00:00:00 2001 From: wangsiyuan <2392948297@qq.com> Date: Wed, 28 Aug 2024 17:49:12 +0800 Subject: [PATCH] Update main.go --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 3ffc766..9a29f15 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "net/http" + "strconv" "strings" ) @@ -29,9 +30,11 @@ func getIPInfoAndRespond(w http.ResponseWriter, r *http.Request) { // 获取IP信息 IPinfo := modules.GetIPInformation(ip) - fmt.Println("IP", IPinfo.IP) - fmt.Println("IsPrivate", IPinfo.IsPrivate) - fmt.Println("PrivateCIDR", IPinfo.PrivateCIDR) + if IPinfo.IsPrivate != false { + log.Println("tag:main", "IP: "+IPinfo.IP+", IsPrivate: "+strconv.FormatBool(IPinfo.IsPrivate)+", PrivateCIDR: "+IPinfo.PrivateCIDR) + } else { + log.Println("tag:main", "IP: "+IPinfo.IP+", IsPrivate: "+strconv.FormatBool(IPinfo.IsPrivate)) + } // 检查是否为私有IP if IPinfo.IsPrivate == true { @@ -41,9 +44,6 @@ func getIPInfoAndRespond(w http.ResponseWriter, r *http.Request) { // 使用mmdb查询ip IpIformation := modules.MmdbQueryIP(IPinfo.IP) - // 使用MySql查询ip - //dsn := modules.Readconfig() - //IpIformation := modules.MysqlQuery(ip, dsn) log.Println("tag:main", IpIformation) jsonData, err := json.Marshal(IpIformation)