iplocation

package
v0.0.0-...-336072d Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: LGPL-2.1 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetIPAddressOkRespCode         = 200
	GetIPAddressBadRequestRespCode = 400
	GetIPAddressNotFoundRespCode   = 404

	IPLocatorOkRespCode         = "200"
	IPLocatorBadRequestRespCode = "400"
	IPLocatorNotFoundRespCode   = "404"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IPLocator(ctx context.Context, ip string) (*IPLocatorResp, error)

	GetIPAddress(ctx context.Context) (*GetIPAddressResp, error)
}

Client api interface

func New

func New() Client

New a Client

type GetIPAddressResp

type GetIPAddressResp struct {
	IP              string `json:"ip"`
	IPVersion       int8   `json:"ip_version"` // IPVersion just 4/6
	ResponseCode    int64  `json:"response_code"`
	ResponseMessage string `json:"response_message"`
}

GetIPAddressResp ...

type IPLocatorResp

type IPLocatorResp struct {
	IP              string `json:"ip"`
	IPNumber        string `json:"ip_number"` // IPVersion just 4/6
	IPVersion       int8   `json:"ip_version"`
	CountryName     string `json:"country_name"`
	CountryCode2    string `json:"country_code2"` // CountryCode2 maybe US ?
	ISP             string `json:"isp"`
	ResponseCode    string `json:"response_code"`
	ResponseMessage string `json:"response_message"`
}

IPLocatorResp ...

Jump to

Keyboard shortcuts

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