mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
i forgor
This commit is contained in:
@@ -6,8 +6,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@@ -114,12 +114,17 @@ func LookupIPData(geoIP *db.GeoIPManager, ip net.IP) *DataStruct {
|
|||||||
hostname = []string{""}
|
hostname = []string{""}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sd *string
|
||||||
|
if len(cityRecord.Subdivisions) > 0 {
|
||||||
|
sd = ToPtr(cityRecord.Subdivisions[0].Names["en"])
|
||||||
|
}
|
||||||
|
|
||||||
data := &DataStruct{
|
data := &DataStruct{
|
||||||
IP: ToPtr(ip.String()),
|
IP: ToPtr(ip.String()),
|
||||||
Hostname: ToPtr(strings.TrimSuffix(hostname[0], ".")),
|
Hostname: ToPtr(strings.TrimSuffix(hostname[0], ".")),
|
||||||
Org: ToPtr(fmt.Sprintf("AS%d %s", asnRecord.AutonomousSystemNumber, asnRecord.AutonomousSystemOrganization)),
|
Org: ToPtr(fmt.Sprintf("AS%d %s", asnRecord.AutonomousSystemNumber, asnRecord.AutonomousSystemOrganization)),
|
||||||
City: ToPtr(cityRecord.City.Names["en"]),
|
City: ToPtr(cityRecord.City.Names["en"]),
|
||||||
Region: ToPtr(cityRecord.Subdivisions[0].Names["en"]),
|
Region: sd,
|
||||||
Country: ToPtr(cityRecord.Country.IsoCode),
|
Country: ToPtr(cityRecord.Country.IsoCode),
|
||||||
Timezone: ToPtr(cityRecord.Location.Timezone),
|
Timezone: ToPtr(cityRecord.Location.Timezone),
|
||||||
Loc: ToPtr(fmt.Sprintf("%.4f,%.4f", cityRecord.Location.Latitude, cityRecord.Location.Longitude)),
|
Loc: ToPtr(fmt.Sprintf("%.4f,%.4f", cityRecord.Location.Latitude, cityRecord.Location.Longitude)),
|
||||||
|
|||||||
Reference in New Issue
Block a user