ripe

package
v0.0.0-...-550a133 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 11 Imported by: 0

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

func IsASN(key string) bool

IsASN checks if the key is a number

func IsIP

func IsIP(key string) bool

IsIP return true if key is IPv4/6

func IsPrefix

func IsPrefix(key string) bool

IsPrefix evaluates IPv(4/6) CIDR

func MyIPAddr

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

func (a *ASN) GetGeoData() bool

GetGeoData gets Geo information from RIPE NCC

func (*ASN) GetOVData

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

func (a *ASN) Set(r string)

Set ASN

type Geo

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

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

Prefix represents prefix information

func (*Prefix) GetData

func (p *Prefix) GetData() bool

GetData gets prefix information from RIPE NCC

func (*Prefix) GetGeoData

func (p *Prefix) GetGeoData() error

GetGeoData gets Geo information from RIPE NCC

func (*Prefix) PrettyPrint

func (p *Prefix) PrettyPrint()

PrettyPrint print ASN information (holder)

func (*Prefix) Set

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