feat: geo ip.

This commit is contained in:
tx7do
2023-10-19 15:05:49 +08:00
parent 92be8b878a
commit 01bdf5cc06
21 changed files with 343 additions and 38 deletions

View File

@@ -1,17 +0,0 @@
package geoip
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestGeoIp(t *testing.T) {
g, err := NewGeoIp()
assert.Nil(t, err)
ret, err := g.GetAreaFromIP("47.108.149.89")
assert.Nil(t, err)
assert.Equal(t, ret.Country, "中国")
assert.Equal(t, ret.Province, "四川省")
assert.Equal(t, ret.City, "成都")
}