network

package
v0.0.0-...-8083d74 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IP GeoLocation API.
	GEO_IP_API = "http://ip-api.com/json"

	// Default value to use in the GeoLocation struct.
	// This is used when the GEO_IP_API cannot be reached.
	DEFAULT_GEO_VAL = "Unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoLocation

type GeoLocation struct {
	Country    string `json:"country"`
	RegionName string `json:"region_name"`
	City       string `json:"city"`
	ZipCode    string `json:"zip_code"`
	ASNumber   string `json:"as_number"`
}

`GeoLocation` represents the information about a geographical location derived from an IP Address.

func GetGeoLocation

func GetGeoLocation(ip string) (GeoLocation, error)

`GetGeoLocation` retrieves the geolocation information for the given IP address using the GEO_IP_API.

Jump to

Keyboard shortcuts

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