Skip to content

IPDataInfo/ipdata-go

Repository files navigation

IPData.info Go SDK — Free IP Geolocation & Threat Intelligence API

Go Reference CI License: MIT

Official Go client for ipdata.info — a free, fast IP geolocation, ASN, and threat-intelligence API. Look up country, city, ASN, timezone, currency, and security flags (proxy/VPN/Tor/hosting) for any IPv4 or IPv6 address. Powered by ipdata.info.

Get a free API key

The public endpoint is free — 50 requests/min, no signup, no key. For higher rate limits and batch lookups, create a free API key at ipdata.info/register and manage it in your dashboard.

Install

go get github.com/IPDataInfo/ipdata-go

Quickstart

package main

import (
	"context"
	"fmt"

	ipdata "github.com/IPDataInfo/ipdata-go"
)

func main() {
	client := ipdata.New() // free tier; or ipdata.New(ipdata.WithAPIKey("KEY"))

	info, _ := client.Lookup(context.Background(), "8.8.8.8")
	fmt.Println(info.City, info.Country, info.ASNOrg) // Mountain View United States Google LLC
}

Methods

Method What it returns
Lookup(ctx, ip) Full geolocation record (own IP if ip == "")
Geo(ctx, ip) Geo subset (city/region/country/lat/lon/tz)
ASN(ctx, ip) ASN + ISP/registry for an IP
Batch(ctx, ips) Many IPs at once (requires an API key)
ASNDetail(ctx, n) ASN detail incl. prefixes
ASNWhoisHistory(ctx, n) ASN whois history
ASNChanges(ctx) ASN change feed
ThreatDomain/ThreatHash/ThreatURL(ctx, x) Threat-intel lookup (domain / hash / URL)

Full response schema: ipdata.info API docs · SDK list.

Configuration

ipdata.New(
	ipdata.WithAPIKey("KEY"),        // sent as X-Api-Key; switches to pro.ipdata.info
	ipdata.WithBaseURL("https://ipdata.info"),
	ipdata.WithHTTPClient(customHTTPClient), // custom timeout/proxy
)

Errors from non-2xx responses are returned as *ipdata.APIError with Status and Message.

Rate limits

  • Free (ipdata.info): 50 req/min, no key.
  • Paid (pro.ipdata.info): higher limits + Batch, with an API key.

Other SDKs

12 official SDKs — see ipdata.info/docs/sdks: Python, Node.js, Go, PHP, Java, Rust, .NET, Kotlin, Swift, Dart, Bash, Objective-C.

License

MIT © ipdata.info

About

Official Go SDK for the ipdata.info IP geolocation, ASN & threat-intelligence API

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages