infra_ip

package
v1.0.1-0...-bd443ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IIpInfo

type IIpInfo interface {
	GetIpInfo(ctx context.Context, ip string) (*IpInfoCommon, error)
	GetIpInfoRegionCityOrEmpty(ctx context.Context, ip string) string
}

type IpInfo

type IpInfo struct {
	As          string  `json:"as"`
	City        string  `json:"city"`
	Country     string  `json:"country"`
	CountryCode string  `json:"countryCode"`
	Message     string  `json:"message"`
	Isp         string  `json:"isp"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	Org         string  `json:"org"`
	Query       string  `json:"query"`
	Region      string  `json:"region"`
	RegionName  string  `json:"regionName"`
	Status      string  `json:"status"`
	Timezone    string  `json:"timezone"`
	Zip         string  `json:"zip"`
}

*

{
	"status": "success",
	"country": "美国",
	"countryCode": "US",
	"region": "CA",
	"regionName": "加利福尼亚州",
	"city": "洛杉矶",
	"zip": "90009",
	"lat": 34.0522,
	"lon": -118.244,
	"timezone": "America/Los_Angeles",
	"isp": "Psychz Networks",
	"org": "Psychz Networks",
	"as": "AS40676 Psychz Networks",
	"query": "45.34.23.12"
}

type IpInfoApiOne

type IpInfoApiOne struct {
	Url string
}

func NewIpInfoApiOne

func NewIpInfoApiOne() *IpInfoApiOne

func (*IpInfoApiOne) GetIpInfo

func (i *IpInfoApiOne) GetIpInfo(ctx context.Context, ip string) (*IpInfoCommon, error)

func (*IpInfoApiOne) GetIpInfoRegionCityOrEmpty

func (i *IpInfoApiOne) GetIpInfoRegionCityOrEmpty(ctx context.Context, ip string) string

type IpInfoCommon

type IpInfoCommon struct {
	RegionName  string  `json:"region_name"`
	City        string  `json:"city"`
	Country     string  `json:"country"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	RawResponse string  `json:"raw_response"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL