ripe

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: MIT Imports: 11 Imported by: 39

Documentation

Overview

Package ripe provides ASN and IP information

Index

Constants

View Source
const (
	// RIPEAPI holds RIPE API URL
	RIPEAPI = "https://stat.ripe.net"
	// RIPEPrefixURL holds RIPE prefix path
	RIPEPrefixURL = "/data/prefix-overview/data.json?max_related=50&resource="
	// RIPEASNURL holds RIPE ASN path
	RIPEASNURL = "/data/as-overview/data.json?resource=AS"
	// RIPEGeoURL holds Geo path
	RIPEGeoURL = "/data/geoloc/data.json?resource="
	// RIPEMyIPURL holds myIP path
	RIPEMyIPURL = "/data/whats-my-ip/data.json"
)

Variables

This section is empty.

Functions

func IsASN added in v0.1.7

func IsASN(key string) bool

IsASN checks if the key is a number

func IsIP added in v0.1.9

func IsIP(key string) bool

IsIP return true if key is IPv4/6

func IsPrefix added in v0.1.9

func IsPrefix(key string) bool

IsPrefix evaluates IPv(4/6) CIDR

func MyIPAddr added in v0.2.5

func MyIPAddr() (string, error)

MyIPAddr gets public ip address

Types

type ASN

type ASN struct {
	Number  string
	Data    map[string]interface{}
	GeoData map[string]interface{}
}

ASN represents ASN information

func (*ASN) GetData

func (a *ASN) GetData() bool

GetData gets ASN information from RIPE NCC

func (*ASN) GetGeoData added in v0.1.8

func (a *ASN) GetGeoData() bool

GetGeoData gets Geo information from RIPE NCC

func (*ASN) GetOVData added in v0.1.8

func (a *ASN) GetOVData() bool

GetOVData gets ASN overview information from RIPE NCC

func (*ASN) PrettyPrint

func (a *ASN) PrettyPrint()

PrettyPrint print ASN information (holder)

func (*ASN) Set added in v0.1.7

func (a *ASN) Set(r string)

Set ASN

type Geo added in v0.2.5

type Geo struct {
	Status string
	Data   struct {
		Locations []struct {
			City      string
			Country   string
			Longitude float64
			Latitude  float64
		}
	}
}

Geo represents RIPE NCC Geo format

type Prefix added in v0.1.7

type Prefix struct {
	Resource string
	Data     map[string]interface{}
	GeoData  Geo
}

Prefix represents prefix information

func (*Prefix) GetData added in v0.1.7

func (p *Prefix) GetData() bool

GetData gets prefix information from RIPE NCC

func (*Prefix) GetGeoData added in v0.2.5

func (p *Prefix) GetGeoData() error

GetGeoData gets Geo information from RIPE NCC

func (*Prefix) PrettyPrint added in v0.1.7

func (p *Prefix) PrettyPrint()

PrettyPrint print ASN information (holder)

func (*Prefix) Set added in v0.1.7

func (p *Prefix) Set(r string)

Set sets the resource value

Jump to

Keyboard shortcuts

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