ipintel

package
v0.0.0-...-8b173c7 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2013 License: BSD-1-Clause Imports: 14 Imported by: 0

README

IP-Intel

This plugin provides geolocation information for IP addresses using the IP Intelligence services at neustar.biz.

It requires registration of a free developer account to get access to the required API keys. These should be placed in the configuration file for this plugin:

[api]
key = xxxxxxxxxxxxxxxxxxxxxxxxxxxx
shared = xxxxxx

In order for an API request to be successful, a signature is calculated from the API key and shared secret, plus the current unix timestamp. The API allows for a 5 minute clock drift. If the system clock this bot is running on, has more than a 5-minute deviation from the neustar server, the request will fail with a 403: Not Authorized error. For this purpose, the configuration defines the drift key, which should hold the number of seconds to add/subtract to the current timestamp, in order to fall within this error margin. It should be a positive or negative integer.

drift = 300

Commands

  • loc <ipaddress>: Fetches location data for the given IP address. IP Intelligence supports only IPv4 (32-bit) addresses, and they must be in standard IPv4 dot-decimal notation. E.g.: 127.0.0.1, 255.255.255.1.
  • mibbit <hexstring>: Decodes the 8-digit hex string that prefixes mibbit addresses, into its original IPv4 address. For instance, a user joins through the mibbit IRC service and has the mask 626ff0ce@xxxx.mibbit.com. The 626ff0ce component encodes the user's own IP address.

Examples

<steve> ?loc 173.194.65.139
<bot> steve: 173.194.65.139 (Mapped), Network org.: google inc., Carrier: 
      google inc., TLD: net, SLD: 1e100. Location: north america/united 
      states/california/mountain view (37.388020, -122.074310). Postalcode: 
      94041, Timezone: -8

* joe [626ff0ce@xxxx.mibbit.com] has joined #test
<steve> ?mibbit 626ff0ce
<bot> steve: 626ff0ce -> 98.111.240.206

Documentation

Overview

This plugin provides geolocation information for IP addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(profile string) plugin.Plugin

Types

type Plugin

type Plugin struct {
	*plugin.Base
}

func (*Plugin) Load

func (p *Plugin) Load(c *proto.Client) (err error)

type Response

type Response struct {
	IPInfo struct {
		IPAddress string `json:"ip_address"`
		IPType    string `json:"ip_type"`

		Network struct {
			Organization string `json:"organization"`
			Carrier      string `json:"carrier"`

			Domain struct {
				TLD string `json:"tld"`
				SLD string `json:"sld"`
			} `json:"Domain"`
		} `json:"Network"`

		Location struct {
			Continent string  `json:"continent"`
			Latitude  float32 `json:"latitude"`
			Longitude float32 `json:"longitude"`

			CountryData struct {
				Name string `json:"country"`
			} `json:"CountryData"`

			StateData struct {
				Name string `json:"state"`
			} `json:"StateData"`

			CityData struct {
				Name       string `json:"city"`
				PostalCode string `json:"postal_code"`
				TimeZone   int    `json:"time_zone"`
			} `json:"StateData"`
		} `json:"location"`
	} `json:"ipinfo"`
}

Response holds the unmarshalled response data for a single API call.

Jump to

Keyboard shortcuts

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