iptoasn

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: MIT Imports: 5 Imported by: 6

README

IP to ASN GoDoc

Package iptoasn uses Team Cymru's IP to ASN mapping service for querying BGP origin information about a given IP address. It supports both IPv4 and IPv6 (of course, this isn't 1982).

This uses the DNS interface to the IP to ASN service rather than the WHOIS interface.

Usage

ip, err := iptoasn.LookupIP("2001:db8::1")
as, err := iptoasn.LookupASN("as20712")

Command-line tool

A whoisip command is provided as a simple tool for performing IP or AS lookups using the library.

License

MIT

Documentation

Overview

Package iptoasn is an interface to Team Cymru's IP to ASN mapping service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN

type ASN struct {
	ASNum     uint32 `json:"as_num"`
	Country   string `json:"country"`
	Registry  string `json:"registry"`
	Allocated string `json:"allocated"`
	ASName    string `json:"as_name"`
}

ASN holds the description of a BGP ASN.

func LookupASN

func LookupASN(asn string) (ASN, error)

LookupASN queries the IP to ASN service to fetch an AS description.

type IP

type IP struct {
	ASNum     uint32 `json:"as_num"`
	IP        string `json:"ip"`
	BGPPrefix string `json:"bgp_prefix"`
	Country   string `json:"country"`
	Registry  string `json:"registry"`
	Allocated string `json:"allocated"`
	ASName    string `json:"as_name"`
}

IP holds the BGP origin information about a given IP address.

func LookupIP

func LookupIP(ip string) (IP, error)

LookupIP queries Team Cymru's IP to ASN mapping service and returns BGP origin information about the IP.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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