feat: geo ip.
This commit is contained in:
@@ -2,15 +2,20 @@ package qqwry
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
g := NewClient()
|
||||
assert.NotNil(t, g)
|
||||
|
||||
country, city, isp, err := g.Query("47.108.149.89")
|
||||
res, err := g.Query("47.108.149.89")
|
||||
assert.Nil(t, err)
|
||||
fmt.Println("国家:", country, "城市:", city, "服务商:", isp)
|
||||
fmt.Println("国家:", res.Country, "省:", res.Province, "城市:", res.City, "服务商:", res.ISP)
|
||||
assert.Equal(t, res.Country, "中国")
|
||||
assert.Equal(t, res.Province, "四川省")
|
||||
assert.Equal(t, res.City, "成都市")
|
||||
assert.Equal(t, res.ISP, "阿里云")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user