isp

package
v0.0.0-...-4cdd4fd Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package isp provides isp lookup functions for IPv4 addresses

Index

Constants

View Source
const (
	// DefaultCacheSize determines the default size for the ip cache
	DefaultCacheSize = 100000
)

Variables

This section is empty.

Functions

func ASN

func ASN(ip goexpr.Expr) goexpr.Expr

ASN returns the ASN number for a given IPv4 address as an int

func ASName

func ASName(ip goexpr.Expr) goexpr.Expr

ASName returns the ASN name for a given IPv4 address

func ISP

func ISP(ip goexpr.Expr) goexpr.Expr

ISP returns the ISP name for a given IPv4 address

func ORG

func ORG(ip goexpr.Expr) goexpr.Expr

ORG returns the Organization name for a given IPv4 address (similar to ISP but may have different data depending on provider used).

func SetProvider

func SetProvider(prov Provider, cacheSize int)

SetProvider sets the ISP data provider

Types

type Provider

type Provider interface {
	// ISP looks up the name of the Internet Service Provider corresponding to the
	// given ip.
	ISP(ip string) (isp string, found bool)

	// ORG looks up the name of the Organization corresponding to the given ip
	// (may be different than ISP).
	ORG(ip string) (org string, found bool)

	// ASN looks up the Autonomous System Number corresponding to the given ip.
	ASN(ip string) (asn int, found bool)

	// ASName looks up the Autonomous System Name corresponding to the given ip.
	ASName(ip string) (asnName string, found bool)
}

Provider implements the actual looking up of ISP and ASN information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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