ip

package
v0.0.0-...-fee140a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 1 Imported by: 0

README

ip

Contains tools for modifying and enriching IP address data. Enriched IP address information is abstracted from the source into an aggregated data structure that is composed of one of many shared data structures:

  • location: contains geolocation information
  • asn: contains autonomous system information

Documentation

Overview

package ip provides tools for modifying IP address data.

Index

Constants

View Source
const ErrInvalidIPAddress = errors.Error("invalid IP address")

ErrInvalidIPAddress is returned when an invalid IP address is referenced in any function or method.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN

type ASN struct {
	Number       uint   `json:"number,omitempty"`
	Organization string `json:"organization,omitempty"`
}

ASN is an abstracted data structure used for returning autonomous system number (ASN) enrichment results.

type Coordinates

type Coordinates struct {
	Latitude  float32 `json:"latitude,omitempty"`
	Longitude float32 `json:"longitude,omitempty"`
}

Coordinates is an abstracted data structure used for returning coordinates enrichment results.

type EnrichmentRecord

type EnrichmentRecord struct {
	ASN      *ASN      `json:"asn,omitempty"`
	Location *Location `json:"location,omitempty"`
}

EnrichmentRecord is an aggregation of information commonly provided by IP address enrichment services.

type Getter

type Getter interface {
	Get(string) (*EnrichmentRecord, error)
}

Getter provides a method for getting an enrichment record from any IP address enrichment source.

type Location

type Location struct {
	Coordinates *Coordinates `json:"coordinates,omitempty"`
	Continent   string       `json:"continent,omitempty"`
	Country     string       `json:"country,omitempty"`
	Region      string       `json:"region,omitempty"`
	City        string       `json:"city,omitempty"`
	PostalCode  string       `json:"postal_code,omitempty"`
	TimeZone    string       `json:"time_zone,omitempty"`
	Accuracy    float32      `json:"accuracy,omitempty"`
}

Location is an abstracted data structure used for returning geolocation enrichment results.

Directories

Path Synopsis
package database provides tools for enriching IP addresses from enrichment databases.
package database provides tools for enriching IP addresses from enrichment databases.

Jump to

Keyboard shortcuts

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