Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPAPICOMResolver ¶
type IPAPICOMResolver struct {
}
IPAPICOMResolver is an IP address resolver based on the ip-api.com service.
func NewIPAPICOMResolver ¶
func NewIPAPICOMResolver() *IPAPICOMResolver
NewIPAPICOMResolver returns an IP address resolver based on the ip-api.com service.
func (*IPAPICOMResolver) Name ¶
func (i *IPAPICOMResolver) Name() string
Name returns the resolver name.
type IPAPICOResolver ¶
type IPAPICOResolver struct {
}
IPAPICOResolver is an IP address resolver based on the ipapi.co service.
func NewIPAPICOResolver ¶
func NewIPAPICOResolver() *IPAPICOResolver
NewIPAPICOResolver returns an IP address resolver based on the ipapi.co service.
func (*IPAPICOResolver) Name ¶
func (i *IPAPICOResolver) Name() string
Name returns the resolver name.
type IPWHOISResolver ¶
type IPWHOISResolver struct {
}
IPWHOISResolver is an IP address resolver based on the ipwho.is service.
func NewIPWHOISResolver ¶
func NewIPWHOISResolver() *IPWHOISResolver
NewIPWHOISResolver returns an IP address resolver based on the ipwho.is service.
func (*IPWHOISResolver) Name ¶
func (i *IPWHOISResolver) Name() string
Name returns the resolver name.
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
Location is a geolocation resolver that runs several resolvers concurrently to resolve an IP address.
func NewLocation ¶
NewLocation returns a new Location backed by the given resolvers.
type Resolver ¶
type Resolver interface {
// Name returns the resolver name.
Name() string
// Resolve resolves the geolocation of ip.
Resolve(ctx context.Context, ip string) (*Result, error)
}
Resolver is the IP address resolver interface.
type Result ¶
type Result struct {
IP string `json:"ip"` // IP address
Country string `json:"country"` // Country
Province string `json:"province"` // Province, autonomous region or municipality
City string `json:"city"` // City
ISP string `json:"isp"` // ISP
}
Result is the geolocation result of an IP address.