ipinfo

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

package that holds objects and functions related to querying the site IPInfo.io and get information related to a given IP address. this package can be useful in target enumeration and analysis.

information regarding IPInfo.io's API can be found at https://ipinfo.io/developers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASNStruct

type ASNStruct struct {
	Asn    string `json:"asn"`
	Name   string `json:"name"`
	Domain string `json:"domain"`
	Route  string `json:"route"`
	Type   string `json:"type"`
}

structure designed to hold the ASN info piece of the IPInfo return JSON.

type AbuseStruct

type AbuseStruct struct {
	Address string `json:"address"`
	Country string `json:"country"`
	Email   string `json:"email"`
	Name    string `json:"name"`
	Network string `json:"network"`
	Phone   string `json:"phone"`
}

structure designed to hold the Abuse info pice of the IPInfo return JSON.

type CompanyStruct

type CompanyStruct struct {
	Name   string `json:"name"`
	Domain string `json:"domain"`
	Type   string `json:"type"`
}

structure designed to hold the Company info piece of the IPInfo return JSON.

type ConfigFunc

type ConfigFunc func(*ConfigStruct)

func WithToken

func WithToken(token string) ConfigFunc

function designed to set the token value for a given ConfigStruct. this should be passed into the NewQueryer function upon creation of a new IPInfoQuery object.

type ConfigStruct

type ConfigStruct struct {
	Token string
}

structure defining the configuration settings for the IPInfoQuery object.

type IPInfoQuery

type IPInfoQuery struct {
	Options ConfigStruct
}

structure defining the main IPInfo object that the user will create to query IPInfo.io

func NewQueryer

func NewQueryer(options ...ConfigFunc) (IPQueryer *IPInfoQuery, err error)

function designed to create a new IPInfoQuery object and return it to the user.

func (*IPInfoQuery) QueryAddress

func (iq *IPInfoQuery) QueryAddress(ipaddress string) (info IPInfoStruct, err error)

function designed to reach out to ipinfo.io and return information related to the given IP address. this data will be returned in a struct that can be passed as JSON if desired. if something goes wrong during this function, an empty struct will be returned along with an error.

type IPInfoStruct

type IPInfoStruct struct {
	IP           string `json:"ip"`
	Hostname     string `json:"hostname"`
	Anycast      bool   `json:"anycast"`
	City         string `json:"city"`
	Region       string `json:"region"`
	Country      string `json:"country"`
	Location     string `json:"loc"`
	Organization string `json:"org"`
	ZipCode      string `json:"postal"`
	Timezone     string `json:"timezone"`
	Readme       string `json:"readme"`
	Bogon        bool   `json:"bogon"`

	Asn     ASNStruct     `json:"asn"`
	Company CompanyStruct `json:"company"`
	Privacy PrivacyStruct `json:"privacy"`
	Abuse   AbuseStruct   `json:"abuse"`
}

structure designed to hold the return value from IPInfo.io's query.

func (*IPInfoStruct) IsInternalAddress

func (inf *IPInfoStruct) IsInternalAddress() (internal bool, err error)

function designed to determine whether the queried IP address is part of an internal network or open to the public. this is determined by checking the Bogon flag that gets returned by IPInfo.io.

type PrivacyStruct

type PrivacyStruct struct {
	Vpn     bool   `json:"vpn"`
	Proxy   bool   `json:"proxy"`
	Tor     bool   `json:"tor"`
	Relay   bool   `json:"relay"`
	Hosting bool   `json:"hosting"`
	Service string `json:"service"`
}

structure designed to hold the Privacy info piece of the IPInfo return JSON.

Jump to

Keyboard shortcuts

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