百度智能云

All Product Document

          CDN

          Tool Interface

          IP detection GetIpInfo

          Verify whether the designated IP belongs to CDN service node of Baidu Kaifang Cloud.

          cli := client.GetDefaultClient()                     
          ipStr := "1.2.3.4"                                   
          ipInfo, err := cli.GetIpInfo(ipStr, "describeIp")    
                                                               
          fmt.Printf("ipInfo:%+v\n", ipInfo)                   
          fmt.Printf("err:%+v\n", err)                         

          The second parameter of GetIpInfo can only be "DescribeIp". ipInfo contains detailed information about IP, including region and ISP. If it is not a node of Baidu AI Cloud CDN, both the region and ISP are empty.

          Previous
          Log Interface
          Next
          CDNCLI