client

package
v0.0.0-...-7e7373f Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package client represents the full RIPEstat DATA API.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the RIPEstat client

func NewClient

func NewClient() *Client

NewClient creates a new RIPEstat client

func (*Client) ASNNeighbours

func (c *Client) ASNNeighbours(resource, starttime string) (map[string]interface{}, error)

ASNNeighbours GETs nformation on the network neighbours for a given ASN. This includes statistical information as well as the list of observed ASN neighbours.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
starttime := ""     // ISO8601 or Unix timestamp for query start
r, err := c.ASNNeighbours(resource, starttime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
latest_time
neighbour_counts
neighbours
query_endtime
query_starttime
resource

func (*Client) ASNNeighboursHistory

func (c *Client) ASNNeighboursHistory(resource, starttime, endtime, maxrows string) (map[string]interface{}, error)

ASNNeighboursHistory GETs information about neigbouring ASNs of a queried ASN extended with history.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
starttime := ""     // ISO8601 or Unix timestamp for query start
endtime := ""       // ISO8601 or Unix timestamp for query start
maxRows := ""       // Defines the limit of neighbours to be included in the result, e.g. max_rows=50 means the result will be truncated to 50 neighbours.
r, err := c.ASNNeighboursHistory(resource, starttime, endtime, maxRows)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
latest_time
neighbours
query_endtime
query_starttime
resource

func (*Client) ASOverview

func (c *Client) ASOverview(as string) (map[string]interface{}, error)

ASOverview GETs general informations about an ASN like its announcement status and the name of its holder according to the WHOIS service.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
r, err := c.ASOverview(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["announced":%!q(bool=false) "block":map["desc":"For documentation and sample code; reserved by [RFC5398]" "name":"IANA Special-Purpose Autonomous System (AS) Numbers Registry" "resource":"64496-64511"] "holder":"-Reserved AS-" "resource":"64496" "type":"as"]

func (*Client) ASPathLength

func (c *Client) ASPathLength(as, sortBy string) (map[string]interface{}, error)

ASPathLength GETs AS-path metrics (e.g. shortest or longest AS-path to other ASNs we are peering with) for the queried ASN.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
sortBy := "number"  // number(default), count, location, geo Sort by the given field. In the case of "geo", sort by approximating a world map on to a circle.
r, err := c.ASPathLength(resource, sortBy)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["resource":"64496" "sort_by":"number" "stats":[]]

func (*Client) ASRoutingConsistency

func (c *Client) ASRoutingConsistency(resource string) (map[string]interface{}, error)

ASRoutingConsistency GETs the difference between the routing and the registration state of an ASN. A filter for BGP routes is applied removing non-globally visible prefixes that are not seen by at least 10 RIS full-table peers.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
r, err := c.ASRoutingConsistency(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

authority
exports
imports
prefixes
query_endtime
query_starttime
resource

func (*Client) AbuseContactFinder

func (c *Client) AbuseContactFinder(resource string) (map[string]interface{}, error)

AbuseContactFinder GETs abuse contact informations for a Internet number resource. Note that this information is in many cases incorrect or not available.

Additional information:

  • the resources RIR name (if available)
  • whether the queries resource is related to a special purpose Internet number resource (if available)
  • blacklist informations (if available)
  • additional information about the matchin autnum or inet(6)num object in the RIPE DB (e.g. holder name)
  • less and more specific IP prefixes/ranges for IP based queries
Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23"
r, err := c.AbuseContactFinder(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["anti_abuse_contacts":map["abuse_c":[map["description":"abuse-c" "email":"abuse@ripe.net" "key":"OPS4-RIPE"]] "emails":[] "extracted_emails":[] "objects_with_remarks":[]] "authorities":["ripe"] "blacklist_info":[] "global_network_info":map["description":"RIPE NCC (Status: ALLOCATED)" "name":"RIPE NCC (Status: ALLOCATED)" "source":"IANA IPv4 Address Space Registry" "source_url":"http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.csv"] "holder_info":map["name":"RIPE-NCC" "resource":"193.0.0.0 - 193.0.7.255"] "less_specifics":["193.0.0.0-193.0.23.255"] "more_specifics":[] "resource":"193.0.0.0/21" "special_resources":[]]

func (*Client) AddressSpaceHierarchy

func (c *Client) AddressSpaceHierarchy(resource string) (map[string]interface{}, error)

AddressSpaceHierarchy GETs address space objects (inetnum, inet6num...) from the RIPE DB (whois) related (exact, more- and less-specific) to the queried resource. Less- and more-specific results are first-level only, further levels would have to be retrieved iteratively Due to performance issues on the backend side, data calls are limited to a maximum prefix size of /16 for IPv4 resources!

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/21" // prefix or IP range
r, err := c.AddressSpaceHierarchy(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["exact":[map["admin-c":"BRD-RIPE" "country":"NL" "created":"2003-03-17T12:15:57Z" "descr":"RIPE Network Coordination CentreAmsterdam, Netherlands" "inetnum":"193.0.0.0/21" "last-modified":"2017-12-04T14:42:31Z" "mnt-by":"RIPE-NCC-MNT" "netname":"RIPE-NCC" "org":"ORG-RIEN1-RIPE" "remarks":"Used for RIPE NCC infrastructure." "source":"RIPE" "status":"ASSIGNED PA" "tech-c":"OPS4-RIPE"]] "less_specific":[map["admin-c":"BRD-RIPE" "country":"NL" "created":"2012-03-09T15:03:38Z" "inetnum":"193.0.0.0-193.0.23.255" "last-modified":"2017-07-19T12:31:22Z" "mnt-by":"RIPE-NCC-HM-MNTRIPE-NCC-MNT" "mnt-lower":"RIPE-NCC-MNT" "mnt-routes":"RIPE-NCC-MNT" "netname":"NL-RIPENCC-OPS-990305" "org":"ORG-RIEN1-RIPE" "remarks":"Amsterdam, Netherlands" "source":"RIPE" "status":"ALLOCATED PA" "tech-c":"OPS4-RIPE"]] "more_specific":[] "parameters":map["resource":"193.0.0.0/21"] "resource":"193.0.0.0/21" "rir":"ripe"]

func (*Client) AddressSpaceUsage

func (c *Client) AddressSpaceUsage(resource string) (map[string]interface{}, error)

AddressSpaceUsage GETs the usage ratio of this prefix or IP range according to the objects currently present in the RIPE Whois database. The data is represented as assignments, allocations and statistic on the distribution of the IPs covered by the queried resource.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix or IP range
r, err := c.AddressSpaceUsage(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["allocations":[map["allocation":"193.0.0.0-193.0.23.255" "asn_name":"NL-RIPENCC-OPS-990305" "assignments":%!q(float64=1) "status":"ALLOCATED PA"]] "assignments":[map["address_range":"193.0.0.0/21" "asn_name":"RIPE-NCC" "parent_allocation":"193.0.0.0-193.0.23.255" "status":"ASSIGNED PA"]] "ip_stats":[map["ips":%!q(float64=512) "status":"ASSIGNED PA"]] "resource":"193.0.0.0/23"]

func (*Client) AllocationHistory

func (c *Client) AllocationHistory(resource, starttime, endtime string) (map[string]interface{}, error)

AllocationHistory GETs information supplied by IANA and RIRs for allocations and direct assignments of prefixes and AS numbers of time.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"             // ASN
starttime := "2011-10-10T12:00" // ISO8601 or Unix timestamp for query start
endtime := ""                   // ISO8601 or Unix timestamp for query start
r, err := c.AllocationHistory(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
delete(data, "latest_time")
fmt.Printf("%q", data)
Output:

map["earliest_time":"2000-08-01T00:00:00" "prefixes":[map["prefix":"2001:c78:ff11::/48" "timelines":[map["endtime":"2011-12-31T16:00:00" "starttime":"2011-10-10T16:00:00"] map["endtime":"2012-04-02T16:00:00" "starttime":"2012-02-01T00:00:00"] map["endtime":"2012-08-17T00:00:00" "starttime":"2012-04-11T08:00:00"]]] map["prefix":"2001:c78:ff12::/47" "timelines":[map["endtime":"2011-12-31T16:00:00" "starttime":"2011-10-10T16:00:00"] map["endtime":"2012-08-17T00:00:00" "starttime":"2012-02-01T00:00:00"]]] map["prefix":"198.57.8.0/24" "timelines":[map["endtime":"2013-03-27T00:00:00" "starttime":"2013-01-22T00:00:00"] map["endtime":"2013-05-02T16:00:00" "starttime":"2013-03-27T16:00:00"] map["endtime":"2013-07-31T00:00:00" "starttime":"2013-05-03T16:00:00"] map["endtime":"2013-08-04T00:00:00" "starttime":"2013-07-31T16:00:00"] map["endtime":"2013-08-10T16:00:00" "starttime":"2013-08-04T16:00:00"] map["endtime":"2013-09-20T00:00:00" "starttime":"2013-08-11T08:00:00"] map["endtime":"2013-10-03T00:00:00" "starttime":"2013-09-20T16:00:00"] map["endtime":"2013-10-17T00:00:00" "starttime":"2013-10-03T16:00:00"] map["endtime":"2014-01-31T16:00:00" "starttime":"2013-10-17T16:00:00"] map["endtime":"2014-03-12T16:00:00" "starttime":"2014-03-01T00:00:00"] map["endtime":"2014-05-07T08:00:00" "starttime":"2014-03-13T08:00:00"] map["endtime":"2014-06-04T16:00:00" "starttime":"2014-05-08T00:00:00"] map["endtime":"2014-10-21T00:00:00" "starttime":"2014-06-06T00:00:00"]]]] "resource":"64496"]

func (*Client) AnnouncedPrefixes

func (c *Client) AnnouncedPrefixes(resource, starttime, endtime, minPeersSeeing string) (map[string]interface{}, error)

AnnouncedPrefixes GETs all announced prefixes for a given ASN. The results can be restricted to a specific time period.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"  // ASN
starttime := ""      // ISO8601 or Unix timestamp for query start
endtime := ""        // ISO8601 or Unix timestamp for query start
minPeersSeeing := "" // Minimum number of RIS peers seeing the prefix for it to be included in the results.
r, err := c.AnnouncedPrefixes(resource, starttime, endtime, minPeersSeeing)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
delete(data, "latest_time")
fmt.Printf("%q", data)
Output:

map["earliest_time":"2000-08-01T00:00:00" "prefixes":[] "resource":"64496"]

func (*Client) AtlasProbeDeployment

func (c *Client) AtlasProbeDeployment(resource, starttime, endtime string) (map[string]interface{}, error)

AtlasProbeDeployment GETs information on the number of RIPE Atlas probes in a region, a country or network (ASN). It supports history, with a general start in 2014. The information is based on data from the RIPE Atlas probe archive, ftp://ftp.ripe.net/ripe/atlas/probes/archive/, which is processed once a day.

Example
c := NewClient().WithSourceApp("go-ripestat")
// Due to the ambigious nature of abbreviated identifiers for regions and countries (e.g. me for Middle East and Montenegro) region and country resources should be prefixes with "region_" or "cc_".
// Looking up a network can be specified on the IP version by using the prefix "asn4_" for IP v4 networks and "asn6_" for IP v6 networks.
// For mixed results the resources just need to be comma separated.
resource := "64496" // region, country, network (ASN) or mixed
starttime := ""     // ISO8601 or Unix timestamp for query start
endtime := ""       // ISO8601 or Unix timestamp for query start
r, err := c.AtlasProbeDeployment(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

deployments
endtime
merge
query_date
resource
starttime

func (*Client) AtlasProbes

func (c *Client) AtlasProbes(resource string) (map[string]interface{}, error)

AtlasProbes GETs information on the RIPE Atlas probes in an network (ASN), a prefix or a country. The information is based on data coming from the RIPE Atlas REST API, https://atlas.ripe.net/docs/api/v2/manual/.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "AT" // prefix, ASN or country
r, err := c.AtlasProbes(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

probes
resource
stats

func (*Client) AtlasTargets

func (c *Client) AtlasTargets(resource string) (map[string]interface{}, error)

AtlasTargets GETs information on the RIPE Atlas measurements that target an network (ASN), a prefix or a hostname. The information is based on data coming from the RIPE Atlas REST API, https://atlas.ripe.net/docs/api/v2/manual/.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "example.com" // prefix, ASN or hostname
r, err := c.AtlasTargets(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
fmt.Printf("%v", data["authenticated"])
Output:

false

func (*Client) BGPState

func (c *Client) BGPState(resource, timestamp, rrcs, unixtimestamps string) (map[string]interface{}, error)

BGPState GETs the state of BGP routes for a resource at a certain point in time, as observed by all the RIS collectors. This is derived by applying a computation of state to the RIB dump (granularity=8h) that occurred exactly before that time, using the BGP updates observed between the RIB time and the query time.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"  // Prefix, IP address, AS or a list of valid comma-separated resources
timestamp := ""      // ISO8601 or Unix timestamp
rrcs := ""           // Single-value or comma-separated values of RRC numbers (4 or 0,4,12,15)
unixTimestamps := "" // format the timestamps in the result as Unix timestamp.
r, err := c.BGPState(resource, timestamp, rrcs, unixTimestamps)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["bgp_state":[] "nr_routes":%!q(float64=0) "resource":"64496"]

func (*Client) BGPUpdateActivity

func (c *Client) BGPUpdateActivity(resource, starttime, endtime, maxSamples, minSamplingPeriod, numHours, hideEmptySamples string) (map[string]interface{}, error)

BGPUpdateActivity GETs the number of BGP updates seen over time.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"     // prefix, IP range or AS
starttime := ""         // ISO8601 or Unix timestamp
endtime := ""           // ISO8601 or Unix timestamp
maxSamples := ""        // Positive integer, or 0 to disable
minSamplingPeriod := "" // The smallest possible time period for each data point. It will be automatically increased to satisfy 'max_points'
numHours := ""          // If 'starttime' is not given then this parameter will be used to calculate it from the 'endtime' (which defaults to now).
hideEmptySamples := ""  // If true (default) then samples with 0 updates will not be returned
r, err := c.BGPUpdateActivity(resource, starttime, endtime, maxSamples, minSamplingPeriod, numHours, hideEmptySamples)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["max_samples":%!q(float64=50) "related_prefixes":[] "resource":"64496" "resource_type":"asn" "sampling_period":%!q(float64=21600) "sampling_period_human":"6 hours" "updates":[]]

func (*Client) BGPUpdates

func (c *Client) BGPUpdates(resource, starttime, endtime, rrcs, unixtimestamps string) (map[string]interface{}, error)

BGPUpdates GETs the BGP updates observed for a resource over a certain period of time.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"  // Prefix, IP address, AS or a list of valid comma-separated resources
starttime := ""      // ISO8601 or Unix timestamp
endtime := ""        // ISO8601 or Unix timestamp
rrcs := ""           // Single-value or comma-separated values of RRC numbers (4 or 0,4,12,15)
unixTimestamps := "" // format the timestamps in the result as Unix timestamp.
r, err := c.BGPUpdates(resource, starttime, endtime, rrcs, unixTimestamps)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["nr_updates":%!q(float64=0) "resource":"64496" "updates":[]]

func (*Client) BGPlay

func (c *Client) BGPlay(resource, starttime, endtime, rrcs, unixtimestamps string) (map[string]interface{}, error)

BGPlay GETs a representation of what occurred to the BGP routes of a resource over a period of time. It includes data that defines the initial BGP state at the start time of the query, and all the BGP updates observed from then until the end time, as well as a description of all the AS nodes, and RIS BGP peers involved in the result.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496"  // Prefix, IP address, AS or a list of valid comma-separated resources
starttime := ""      // ISO8601 or Unix timestamp
endtime := ""        // ISO8601 or Unix timestamp
rrcs := ""           // Single-value or comma-separated values of RRC numbers (4 or 0,4,12,15)
unixTimestamps := "" // format the timestamps in the result as Unix timestamp.
r, err := c.BGPlay(resource, starttime, endtime, rrcs, unixTimestamps)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["events":[] "initial_state":[] "nodes":[] "resource":"64496" "sources":[] "targets":[]]

func (*Client) Blacklist

func (c *Client) Blacklist(resource, starttime, endtime string) (map[string]interface{}, error)

Blacklist GETs blacklist related data for a queried resource.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix or IP range
starttime := ""      // ISO8601 or Unix timestamp
endtime := ""        // ISO8601 or Unix timestamp
r, err := c.Blacklist(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["resource":"193.0.0.0/23" "sources":map["uceprotect-level1":[map["details":"no details" "prefix":"193.0.0.1/32" "timelines":[map["endtime":"2016-09-06T08:10:00" "starttime":"2016-08-31T00:10:00"] map["endtime":"2016-12-01T16:10:00" "starttime":"2016-11-25T00:10:00"] map["endtime":"2016-12-13T00:10:00" "starttime":"2016-12-06T08:10:00"] map["endtime":"2017-03-25T16:10:00" "starttime":"2017-03-20T00:10:00"]]] map["details":"no details" "prefix":"193.0.1.102/32" "timelines":[map["endtime":"2018-10-28T08:10:00" "starttime":"2018-10-21T16:10:00"] map["endtime":"2018-11-15T00:10:00" "starttime":"2018-11-08T08:10:00"] map["endtime":"2019-04-04T08:10:00" "starttime":"2019-03-28T16:10:00"] map["endtime":"2019-04-18T08:10:00" "starttime":"2019-04-11T16:10:00"] map["endtime":"2019-06-18T00:10:00" "starttime":"2019-06-11T08:10:00"]]] map["details":"no details" "prefix":"193.0.1.101/32" "timelines":[map["endtime":"2018-10-19T16:10:00" "starttime":"2018-10-13T00:10:00"]]] map["details":"no details" "prefix":"193.0.0.170/32" "timelines":[map["endtime":"2019-01-11T00:10:00" "starttime":"2018-12-04T00:10:00"] map["endtime":"2019-01-26T08:10:00" "starttime":"2019-01-12T08:10:00"] map["endtime":"2019-02-12T16:12:00" "starttime":"2019-01-28T00:10:00"]]] map["details":"no details" "prefix":"193.0.1.241/32" "timelines":[map["endtime":"2018-09-15T08:10:00" "starttime":"2018-09-08T16:10:00"] map["endtime":"2019-01-18T00:10:00" "starttime":"2019-01-11T08:10:00"]]]]]]

func (*Client) CountryASNs

func (c *Client) CountryASNs(resource, queryTime, levelOfDetail string) (map[string]interface{}, error)

CountryASNs GETs information on a country's registered and routed ASNs. Registered ASNs are based on registration information made public by the Regional Internet Registries. The routing information is based on the data collected with the RIPE NCC's RIS system, https://ris.ripe.net. The data call supports history, with data points being aligned to times dumps are created in RIS (00:00, 08:00 and 16:00 UTC). By default, the data call returns just the number of registered and routed ASNs. This is mainly to prevent returning thousands of ASNs.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "nl"    // The country has to be provided as an ISO-3166-1 alpha-2 country code
queryTime := ""     // Defines the time of the lookup. This value needs to be or will be aligned to the RIS dump times!
levelOfDetail := "" // Defines the level of detail in which the data is being returned. Levels are: 0 - Least detailed output 1 - Most detailed output
r, err := c.CountryASNs(resource, queryTime, levelOfDetail)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

countries
latest_time
lod
query_time
resource

func (*Client) CountryResourceList

func (c *Client) CountryResourceList(resource, time, v4Format string) (map[string]interface{}, error)

CountryResourceList GETs the Internet resources associated with a country, including ASNs, IPv4 ranges and IPv4/6 CIDR prefixes. This data is derived from the RIR Statistics files maintained by the various RIRs.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "at" // 2-digit ISO-3166 country code
time := ""
v4Format := ""
r, err := c.CountryResourceList(resource, time, v4Format)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data["resources"].(map[string]interface{}))
Output:

asn
ipv4
ipv6

func (*Client) CountryResourceStats

func (c *Client) CountryResourceStats(resource, starttime, endtime, resolution string) (map[string]interface{}, error)

CountryResourceStats GETs statistics on Internet resources for a country - this includes:

number of ASNs seen in routing data and registration data
number of prefixes in routing data and registration data (split into IPv4 and IPv6)
amount of IPv4 space seen in routing data as well as registration data

The results can be restricted to a specific time period as well the granularity is variable but can be set explicitly.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "at" // 2-digit ISO-3166 country code
starttime := ""
endtime := ""
resolution := "" // 5m, 1h, 1d, 1w
r, err := c.CountryResourceStats(resource, starttime, endtime, resolution)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
hd_latest_time
latest_time
query_endtime
query_starttime
resolution
resource
stats

func (*Client) DNSChain

func (c *Client) DNSChain(resource string) (map[string]interface{}, error)

DNSChain GETs the recursive chain of DNS forward (A/AAAA/CNAME) and reverse (PTR) records starting form either a hostname or an IP address.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "example.com" // Hostname or IP address (Ipv4 or IPv6)
r, err := c.DNSChain(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["authoritative_nameservers":["a.iana-servers.net" "b.iana-servers.net"] "forward_nodes":map["example.com":["93.184.216.34" "2606:2800:220:1:248:1893:25c8:1946"]] "nameservers":["193.0.19.101" "193.0.19.102" "2001:67c:2e8:11::c100:1365" "2001:67c:2e8:11::c100:1366" "2001:67c:2e8:11::c100:1367" "193.0.19.103"] "resource":"example.com" "reverse_nodes":map["2606:2800:220:1:248:1893:25c8:1946":[] "93.184.216.34":[]]]

func (*Client) ExampleResources

func (c *Client) ExampleResources() (map[string]interface{}, error)

ExampleResources GETs sample resources for ASN, IPv4 and IPv6 resources. All are taken from routing data.

Example
c := NewClient().WithSourceApp("go-ripestat")
r, err := c.ExampleResources()
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

asn
ipv4
ipv6
range4

func (*Client) Geolocation

func (c *Client) Geolocation(resource, timestamp string) (map[string]interface{}, error)

Geolocation geolocation information for the given IP space, or for announced IP prefixes in the case of ASNs. IPv4 information is based on GeoLite data created by MaxMind, which is Copyright 2008 MaxMind, Inc. All Rights Reserved. Please consult MaxMind's license before using this data for non-internal usage. For details on the accuracy of this data, please visit MaxMind's product website.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "example.com" // prefix, IP range, ASN or hostname
timestamp := ""
r, err := c.Geolocation(resource, timestamp)
if err != nil {
	panic(err)
}
fmt.Printf("%q", r)
Output:

map[]

func (*Client) GeolocationHistory

func (c *Client) GeolocationHistory(resource, starttime, endtime string) (map[string]interface{}, error)

GeolocationHistory GETs information on the changes in geolocation for the given IP space, or for announced IP prefixes in the case of ASNs. IPv4 information is based on GeoLite data created by MaxMind, which is Copyright 2008 MaxMind, Inc. All Rights Reserved. Please consult MaxMind's license before using this data for non-internal usage. For details on the accuracy of this data, please visit MaxMind's product website.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "example.com" // prefix, IP range, ASN or hostname
starttime := "1514764800"
endtime := ""
r, err := c.GeolocationHistory(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["months":[map["distributions":[map["city":"Norwell" "country":"US" "percentage":%!q(float64=100)]] "month":"2018-01-01T00:00:00"] map["distributions":[map["city":"Norwell" "country":"US" "percentage":%!q(float64=100)]] "month":"2018-02-01T00:00:00"] map["distributions":[map["city":"Norwell" "country":"US" "percentage":%!q(float64=100)]] "month":"2018-03-01T00:00:00"]] "resource":"example.com"]

func (*Client) HistoricalWhois

func (c *Client) HistoricalWhois(resource, version string) (map[string]interface{}, error)

HistoricalWhois GETs information on objects that are stored in the RIPE DB. The result is aligned to a specific object, which is identified by an object type and an object key, which is similar to the Whois data call. In contrast to the Whois data call, this data call puts a focus on historical changes of an object and its related objects. Historical changes are given in the form of versions, one version - by default the latest version - is presented with details. Related objects are separated into referencing and referenced objects. Referencing objects are objects that have a reference to the object in focus and referenced objects are referenced from the object in focus.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // This is a prefix (v4/v6), an AS number, or a string of the format "object-type:object-key" for looking up generic database objects.
version := ""       // Given as a numerical value, the value must match exactly the historical version number. Given as a time-based value, the version that was valid at the given time will be returned.
r, err := c.HistoricalWhois(resource, version)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
delete(data, "latest_time")
fmt.Printf("%q", data)
Output:

map["access":"standard" "database":"RIPE" "num_versions":%!q(float64=0) "objects":[] "referenced_by":map[] "referencing":[] "resource":"64496" "suggestions":[] "terms_and_conditions":"" "version":%!q(float64=64496) "versions":[]]

func (*Client) IANARegistryInfo

func (c *Client) IANARegistryInfo(resource, bestMatchOnly string) (map[string]interface{}, error)

IANARegistryInfo GETs information from various data sources maintained by IANA. These include:

IANA 16-bit Autonomous System (AS) Numbers Registry (http://www.iana.org/assignments/as-numbers/as-numbers-1.csv)
IANA 32-bit Autonomous System (AS) Numbers Registry (http://www.iana.org/assignments/as-numbers/as-numbers-2.csv)
Etc. - the detailed list of data sources included can be seen in the methodology information of the data call. Note: Output format for the methodology information is JSON!

The data call supports a "resource" parameter which filters all results down to entries that are topologically related to the given resource. The data is refreshed once a day to guarantee up-to-date information.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // IP address, prefix or ASN
bestMatchOnly := ""
r, err := c.IANARegistryInfo(resource, bestMatchOnly)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
delete(data, "load_time")
fmt.Printf("%q", data)
Output:

map["resource":"64496" "resources":[map["description":"For documentation and sample code; reserved by [RFC5398]" "details":map["Reason for Reservation":"For documentation and sample code; reserved by [RFC5398]" "Reference":"[RFC5398]"] "resource":"64496-64511" "source":"IANA Special-Purpose Autonomous System (AS) Numbers Registry" "source_url":"http://www.iana.org/assignments/iana-as-numbers-special-registry/special-purpose-as-numbers.csv" "type_properties":["asn" "range"]] map["description":"Reserved for use in documentation and sample code (Reference: RFC5398)" "details":map["Description":"Reserved for use in documentation and sample code" "RDAP":"" "Reference":"[RFC5398]" "Registration\n        Date":"2008-12-03" "WHOIS":""] "resource":"64496-64511" "source":"IANA 16-bit Autonomous System (AS) Numbers Registry" "source_url":"http://www.iana.org/assignments/as-numbers/as-numbers-1.csv" "type_properties":["asn" "range"]] map["description":"See Sub-registry 16-bit AS numbers (Reference: RFC1930)" "details":map["Description":"See Sub-registry 16-bit AS numbers" "RDAP":"" "Reference":"[RFC1930]" "Registration\n        Date":"" "WHOIS":""] "resource":"0-65535" "source":"IANA 32-bit Autonomous System (AS) Numbers Registry" "source_url":"http://www.iana.org/assignments/as-numbers/as-numbers-2.csv" "type_properties":["asn" "range"]]] "returned":%!q(float64=3)]

func (*Client) LookingGlass

func (c *Client) LookingGlass(resource string) (map[string]interface{}, error)

LookingGlass GETs information commonly coming from a Looking Glass. The data is based on a data feed from the RIPE NCC's network of BGP route collectors (RIS, see https://www.ripe.net/data-tools/stats/ris for more information). The data processing usually happens with a small delay and can be considered near real-time. The output is structured by collector node (RRC) accompanied by the location and the BGP peers which provide the routing information.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "192/23" // A prefix or an IP address.
r, err := c.LookingGlass(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
delete(data, "latest_time")
fmt.Printf("%q", data)
Output:

map["parameters":map["resource":"192.0.0.0/23"] "rrcs":[]]

func (*Client) MaxmindGeoLite

func (c *Client) MaxmindGeoLite(resource, queryTime string) (map[string]interface{}, error)

MaxmindGeoLite GETs geolocation information for the given IP space based on MaxMind's GeoLite2 data source.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix or IP address
queryTime := ""
r, err := c.MaxmindGeoLite(resource, queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["earliest_time":"2018-03-27T00:00:00" "latest_time":"2019-07-16T00:00:00" "located_resources":[map["locations":[map["city":"" "country":"NL" "covered_percentage":%!q(float64=100) "latitude":%!q(float64=52.3824) "longitude":%!q(float64=4.8995) "resources":["193.0.0.0/21"]]] "resource":"193.0.0.0/23" "unknown_percentage":%!q(float64=0)]] "parameters":map["query_time":"2019-07-16T00:00:00" "resolution":"raw" "resource":"193.0.0.0/23"] "result_time":"2019-07-16T00:00:00" "unknown_percentage":map["v4":%!q(float64=0)]]

func (*Client) MaxmindGeoLiteAnnouncedByAS

func (c *Client) MaxmindGeoLiteAnnouncedByAS(resource string) (map[string]interface{}, error)

MaxmindGeoLiteAnnouncedByAS GETs geolocation information for prefixes that are announced by an autonomous system. Annoucement information is based on RIS (http://ris.ripe.net), geolocation information is based on MaxMind's GeoLite2 data. Prefix information (IPv4/IPv6) is based on GeoLite2 data created by MaxMind, which is Copyright 2008 MaxMind, Inc. All Rights Reserved. Please consult MaxMind's license before using this data for non-internal usage. For details on the accuracy of this data, please visit MaxMind's product website.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
r, err := c.MaxmindGeoLiteAnnouncedByAS(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["earliest_time":"2018-03-27T00:00:00" "latest_time":"2019-07-16T00:00:00" "located_resources":[] "parameters":map["query_time":"2019-07-16T00:00:00" "resolution":"raw" "resource":"64496"] "result_time":"2019-07-16T00:00:00" "unknown_percentage":map["v4":%!q(float64=100) "v6":%!q(float64=100)]]

func (*Client) MlabActivityCount

func (c *Client) MlabActivityCount(resource, starttime, endtime string) (map[string]interface{}, error)

MlabActivityCount GETs the ount of all the hosts within a certain resource for which any network tests occurred. The data is based on active host measurements collected by the Measurement Lab platform (M-Lab). The measurements are commonly ran using the M-Lab Network Detection Tool (NDT), available as a stand-alone network speed test application, and also included in a popular BitTorrent client. Note that due to the nature the data is processed data can be delayed for around two days at the beginning of each month! The results published, including host details are covered by the M-Lab acceptable use policy.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "at" // IPv4 Prefix, IPv4 address or 2-digit ISO-3166 country code
starttime := ""
endtime := ""
r, err := c.MlabActivityCount(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["nr_ips":%!q(float64=1487) "perc_coverage":<nil> "resource":"at"]

func (*Client) MlabBandwidth

func (c *Client) MlabBandwidth(resource, starttime, endtime string) (map[string]interface{}, error)

MlabBandwidth a set of all the measured network bandwidths for a certain resource. The data is based on active host measurements collected by the Measurement Lab platform (M-Lab). The bandwidth of a host is determined as the maximum network throughput value for all the tests/measurements performed by that host during the specified time period. The value of the measurement throughput is computed as the number of octets transmitted between the host and the chosen M-Lab server, divided by their transfer time. The measurements are commonly ran using the M-Lab Network Detection Tool (NDT), available as a stand-alone network speed test application, and also included in a popular BitTorrent client. Note that due to the nature the data is processed data can be delayed for around two days at the beginning of each month! The results published, including host details are covered by the M-Lab acceptable use policy.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "at" // IPv4 Prefix, IPv4 address or 2-digit ISO-3166 country code
starttime := ""
endtime := ""
r, err := c.MlabBandwidth(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

bandwidths
query_endtime
query_starttime
resource

func (*Client) MlabClients

func (c *Client) MlabClients(resource, starttime, endtime string) (map[string]interface{}, error)

MlabClients GETs a set of all the hosts within a certain resource for which any network tests occurred. The data is based on active host measurements collected by the Measurement Lab platform (M-Lab). The measurements are commonly ran using the M-Lab Network Detection Tool (NDT), available as a stand-alone network speed test application, and also included in a popular BitTorrent client. Note that due to the nature the data is processed data can be delayed for around two days at the beginning of each month! The results published, including host details are covered by the M-Lab acceptable use policy.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193.0.0.0/16" // IPv4 Prefix, IPv4 address or 2-digit ISO-3166 country code
starttime := "2013-08-21T07:00"
endtime := "2013-18-22T12:00"
r, err := c.MlabClients(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

clients
nr_clients
perc_coverage
query_endtime
query_starttime
resource

func (*Client) NetworkInfo

func (c *Client) NetworkInfo(resource string) (map[string]interface{}, error)

NetworkInfo GETs the containing prefix and announcing ASN of a given IP address.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "140.78.90.50" // Any IP address one wants to get network info for
r, err := c.NetworkInfo(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["asns":["1205"] "prefix":"140.78.0.0/16"]

func (*Client) PrefixCount

func (c *Client) PrefixCount(resource, starttime, endtime, minPeersSeeing, resolution string) (map[string]interface{}, error)

PrefixCount GETs the number of prefixes announced by a given ASN over time.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
starttime := ""
endtime := ""
minPeersSeeing := ""
resolution := "" // 8h, 2d, 12d
r, err := c.PrefixCount(resource, starttime, endtime, minPeersSeeing, resolution)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

ipv4
ipv6
query_endtime
query_starttime
resolution
resource

func (*Client) PrefixOverview

func (c *Client) PrefixOverview(resource, minPeersSeeing, maxRelated, queryTime string) (map[string]interface{}, error)

PrefixOverview GETs a summary of the given prefix, including whether and by whom it is announced.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "192/23" // prefix
minPeersSeeing := ""
maxRelated := ""
queryTime := ""
r, err := c.PrefixOverview(resource, minPeersSeeing, maxRelated, queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

actual_num_related
announced
asns
block
is_less_specific
num_filtered_out
query_time
related_prefixes
resource
type

func (*Client) PrefixRoutingConsistency

func (c *Client) PrefixRoutingConsistency(resource string) (map[string]interface{}, error)

PrefixRoutingConsistency GETs the given routes (prefix originating from an ASN) between Routing Registries and actual routing behaviour as seen by the RIPE NCC route collectors (RIS).

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix
r, err := c.PrefixRoutingConsistency(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["resource":"193.0.0.0/23" "routes":[map["asn_name":"RIPE-NCC-AS - Reseaux IP Europeens Network Coordination Centre (RIPE NCC)" "in_bgp":%!q(bool=true) "in_whois":%!q(bool=true) "irr_sources":["RIPE" "RIPE"] "origin":%!q(float64=3333) "prefix":"193.0.0.0/21"]]]

func (*Client) PrefixSizeDistribution

func (c *Client) PrefixSizeDistribution(resource, timestamp, minPeersSeeing string) (map[string]interface{}, error)

PrefixSizeDistribution GETs the total amount of prefixes announced by a given ASN per subnet size and IP version.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
timestamp := ""
minPeersSeeing := ""
r, err := c.PrefixSizeDistribution(resource, timestamp, minPeersSeeing)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["ipv4":[] "ipv6":[] "resource":"64496"]

func (*Client) RIR

func (c *Client) RIR(resource, starttime, endtime, levelOfDetail string) (map[string]interface{}, error)

RIR GETs which RIR(s) allocated/assigned a resource. Depending on the level of detail ("lod" parameter) this can include additional information like registration status or country of registration. The data is based on RIR stats files, see ftp://ftp.ripe.net/pub/stats/.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
starttime := ""
endtime := ""
levelOfDetail := "" // 0 - Least detailed output 1 - Default output 2 - Most detailed output
r, err := c.RIR(resource, starttime, endtime, levelOfDetail)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
delete(data, "latest")
fmt.Printf("%q", data)
Output:

map["lod":%!q(float64=1) "resource":"64496" "rirs":[]]

func (*Client) RIRGeo

func (c *Client) RIRGeo(resource, queryTime string) (map[string]interface{}, error)

RIRGeo GETs geographical information for Internet resources based on RIR Statistics data.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // IP resource or ASN
queryTime := ""
r, err := c.RIRGeo(resource, queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
latest_time
located_resources
parameters
result_time

func (*Client) RIRPrefixSizeDistribution

func (c *Client) RIRPrefixSizeDistribution(resource, queryTime string) (map[string]interface{}, error)

RIRPrefixSizeDistribution GETs the number of allocations and assignments (below the queried resource) according to registration data provided by Regional Internet Registries.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "192/23" // prefix
queryTime := ""
r, err := c.RIRPrefixSizeDistribution(resource, queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

query_time
resource
rirs

func (*Client) RISAsns

func (c *Client) RISAsns(queryTime, listASNs, asnTypes string) (map[string]interface{}, error)

RISAsns GETs high-level information on ASNs in RIS, including:

  • total number of ASNs
  • listing of all ASNs

The data call supports history, with each data point being aligned to times a dump is created in RIS (00:00, 08:00 and 16:00 UTC). By default, the data call returns the total number of ASNs; more details can be obtained using parameters. Note the term "transit" related to this data call means any ASN that is seen in the AS paths, collected by RIS, that is not the origin of a route.

Example
c := NewClient().WithSourceApp("go-ripestat")
queryTime := ""
listASNs := ""
asnTypes := "" // "o" stands for originating and will show originating ASNs separately. "t" does the same for transitting ASNs (keep in mind the definition of a transit in this case).
r, err := c.RISAsns(queryTime, listASNs, asnTypes)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

counts
earliest_time
latest_time
list_asns
query_time

func (*Client) RISFirstLastSeen

func (c *Client) RISFirstLastSeen(resource, include string) (map[string]interface{}, error)

RISFirstLastSeen GETs information on when a prefix or ASN was first and last seen in RIS data. The data generally goes back to 2000. For the recency of the data you can check the parameter "latest_time", which usually is not more than 8 hours behind real-time. The "low_visibility" flag, which can be optionally included, shows if the data point was seen by a low or high number of peers.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // prefix or ASN
// This parameter defines additional data to be included.
// "more_specific" includes more specific IP ranges, which only works for prefix lookups. By default "more_specific" is not set as it makes the lookup slower.
// "low_visibility_flag" includes the flag to indicate low visibility. By default it is not included.
include := ""
r, err := c.RISFirstLastSeen(resource, include)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

include
latest_time
resource
resources
stats

func (*Client) RISFullTableThreshold

func (c *Client) RISFullTableThreshold(queryTime string) (map[string]interface{}, error)

RISFullTableThreshold GETs the cut-off threshold for the number of prefixes that a BGP full-table peer requires to have. Peers to RIS (http://ris.ripe.net) that share less than this amount of prefixes are not considered full-table peers and hence are not considered in calculations like routing visibility. The threshold is obviously different between address families (IPv4 and IPv6) and time. For this reason the data call also supports historical lookups.

Example
c := NewClient().WithSourceApp("go-ripestat")
queryTime := ""
r, err := c.RISFullTableThreshold(queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
latest_time
parameters
result_time
v4
v6

func (*Client) RISPeerCount

func (c *Client) RISPeerCount(starttime, endtime, v4FullPrefixThreshold, v6FullPrefixThreshold string) (map[string]interface{}, error)

RISPeerCount GETs information on the number of peers as seen by the RIS system. The data call supports history and each data point is aligned to the RIS RIB dump times (every 8 hours starting from midnight each day). Additionally the data shows the number of full-table peers with paramters to change the threshold (per address family).

Example
c := NewClient().WithSourceApp("go-ripestat")
starttime := ""
endtime := ""
v4FullPrefixThreshold := ""
v6FullPrefixThreshold := ""
r, err := c.RISPeerCount(starttime, endtime, v4FullPrefixThreshold, v6FullPrefixThreshold)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

endtime
peer_count
starttime
v4_full_prefix_threshold
v6_full_prefix_threshold

func (*Client) RISPeerings

func (c *Client) RISPeerings(resource, queryTime string) (map[string]interface{}, error)

RISPeerings GETs routes for advertisements of a given IP resource, or that are originated from a given ASN, as seen by the RIPE NCC route collectors. Historical lookups are supported - a query has to be aligned to the times (00:00, 08:00 and 16:00 UTC) when RIS data has been collected. By default, the data call returns the latest data.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "192/23" // prefix
queryTime := ""
r, err := c.RISPeerings(resource, queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

peerings
query_endtime
query_starttime
resource

func (*Client) RISPeers

func (c *Client) RISPeers(queryTime string) (map[string]interface{}, error)

RISPeers GETs information on the peers of RIS - ASN, IP address and number of shared routes. The data is grouped by RIS collectors. Historical lookups are supported - a query has to be aligned to the times (00:00, 08:00 and 16:00 UTC) when RIS data has been collected. By default, the data call returns the latest data.

Example
c := NewClient().WithSourceApp("go-ripestat")
queryTime := ""
r, err := c.RISPeers(queryTime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
latest_time
parameters
peers

func (*Client) RISPrefixes

func (c *Client) RISPrefixes(resource, queryTime, listPrefixes, types, af, noise string) (map[string]interface{}, error)

RISPrefixes GETs information on prefixes related to an ASN. The data call distinguishes prefixes in the originated and transitted ASN. Note that this distinction is purely based on the perspective of the RIPE NCC's RIS system and does NOT imply the underlying (business) relationships between networks! The data call supports history, with each data point being aligned to times a dump is created in RIS (00:00, 08:00 and 16:00 UTC). By default, the data call returns just the count of prefixes related to the looked up ASN. This is mainly to prevent returning thousands of prefixes. See parameter settings below to further tailor the output to your needs.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN
queryTime := ""
listPrefixes := ""
types := "" // "o" will show originating prefixes and "t" transitting. The combination shows both, which is the default.
af := ""    // "v4","v6" or "v4,v6"
noise := "" // "keep" or "filter"
r, err := c.RISPrefixes(resource, queryTime, listPrefixes, types, af, noise)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

af
counts
earliest_time
latest_time
list_prefixes
noise
query_time
resource
types

func (*Client) RPKIHistory

func (c *Client) RPKIHistory(prefix, prefixFamily, prefixMaskLength, maxLength, asn, trustAnchor, fields string) (map[string]interface{}, error)

RPKIHistory GETs a timeseries of RPKI objects. Note: The data offered by this data call is provided on a best-effort basis. It covers the time period Jan 2011 to Dec 2018, and has know gaps in between. We're working to fill those gaps and provide data from Jan 2019 onwards. Stay tuned!

Example
c := NewClient().WithSourceApp("go-ripestat")
prefix := "prefix_cwe=193.0/16"
prefixFamily := "4"
prefixMaskLength := ""
maxLength := ""
asn := "3333"
trustAnchor := ""
fields := "prefix_count" // "address_space", "asn_count", "prefix_count", "roa_count"
r, err := c.RPKIHistory(prefix, prefixFamily, prefixMaskLength, maxLength, asn, trustAnchor, fields)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

asn
fields
prefix_cwe
prefix_family
sourceapp
timeseries

func (*Client) RPKIValidationStatus

func (c *Client) RPKIValidationStatus(resource, prefix string) (map[string]interface{}, error)

RPKIValidationStatus GETs the RPKI validity state for a combination of prefix and Autonomous System. This combination will be used to perform the lookup against the RIPE NCC's RPKI Validator, and then return its RPKI validity state.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "3333" // ASN
prefix := "193/21"
r, err := c.RPKIValidationStatus(resource, prefix)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_starttime")
delete(data, "query_endtime")
fmt.Printf("%q", data)
Output:

map["prefix":"193.0.0.0/21" "resource":"3333" "status":"valid" "validating_roas":[map["max_length":%!q(float64=21) "origin":"AS3333" "prefix":"193.0.0.0/21" "source":"RIPE NCC RPKI Root" "validity":"valid"]]]

func (*Client) RRCInfo

func (c *Client) RRCInfo() (map[string]interface{}, error)

RRCInfo GETs information on collector nodes (RRCs) of the RIS network (http://ris.ripe.net). This includes geographical and topological location and information on collectors' peers.

Example
c := NewClient().WithSourceApp("go-ripestat")
r, err := c.RRCInfo()
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

parameters
rrcs

func (*Client) RelatedPrefixes

func (c *Client) RelatedPrefixes(resource string) (map[string]interface{}, error)

RelatedPrefixes GETs prefixes that overlap or are adjacent to the specified IP resource.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix or IP range
r, err := c.RelatedPrefixes(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["prefixes":[map["asn_name":"RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC), EU" "origin_asn":"3333" "prefix":"193.0.0.0/21" "relationship":"Overlap - Less Specific"] map["asn_name":"HOSTWINDS - Hostwinds LLC., US" "origin_asn":"54290" "prefix":"192.255.128.0/17" "relationship":"Adjacency - Left"]] "resource":"193.0.0.0/23"]

func (*Client) ReverseDNS

func (c *Client) ReverseDNS(resource string) (map[string]interface{}, error)

ReverseDNS GETs the details of reverse DNS delegations for IP prefixes in the RIPE region.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix
r, err := c.ReverseDNS(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

delegations
query_time
resource

func (*Client) ReverseDNSConsistency

func (c *Client) ReverseDNSConsistency(resource, ipv4, ipv6 string) (map[string]interface{}, error)

ReverseDNSConsistency GETs the reverse DNS delegations and its consistency with routed and registered IP space. The input can be a single prefix or an ASN, in which case all routed and registered prefixes for this ASN are used as an input.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // prefix or ASN
ipv4 := ""
ipv6 := ""
r, err := c.ReverseDNSConsistency(resource, ipv4, ipv6)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["ipv4":%!q(bool=true) "ipv6":%!q(bool=true) "prefixes":map["ipv4":map[] "ipv6":map[]] "resource":"64496" "source":"routes"]

func (*Client) ReverseDNSIP

func (c *Client) ReverseDNSIP(resource string) (map[string]interface{}, error)

ReverseDNSIP GETs the reverse DNS info against a single IP address.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193.0.6.139" // IP address
r, err := c.ReverseDNSIP(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["error":"" "resource":"193.0.6.139" "result":["www.ripe.net"]]

func (*Client) RoutingHistory

func (c *Client) RoutingHistory(resource, maxRows, includeFirstHop, normaliseVisibility, minPeers, starttime, endtime string) (map[string]interface{}, error)

RoutingHistory GETs the history of announcements for prefixes, including the origin ASN and the first hop. The data comes from the RIS route collectors.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // prefix or ASN
maxRows := ""
includeFirstHop := ""
normaliseVisibility := ""
minPeers := ""
starttime := ""
endtime := ""
r, err := c.RoutingHistory(resource, maxRows, includeFirstHop, normaliseVisibility, minPeers, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

by_origin
query_endtime
query_starttime
resource
time_granularity

func (*Client) RoutingStatus

func (c *Client) RoutingStatus(resource, timestamp, minPeersSeeing string) (map[string]interface{}, error)

RoutingStatus GETs a summary of the current BGP routing state of a given IP prefix or ASN, as observed by the RIS route collectors. Historical lookups are supported - a query has to be aligned to the times (00:00, 08:00 and 16:00 UTC) when RIS data has been collected.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // prefix, IP address or ASN
timestamp := ""
minPeersSeeing := ""
r, err := c.RoutingStatus(resource, timestamp, minPeersSeeing)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

announced_space
first_seen
last_seen
observed_neighbours
query_time
resource
visibility

func (*Client) SearchComplete

func (c *Client) SearchComplete(resource, limit string) (map[string]interface{}, error)

SearchComplete GETs example resource that are directly or indirectly related to the given input.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "RIPE" // term that should tried to be matched against resources
limit := ""
r, err := c.SearchComplete(resource, limit)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["categories":[map["category":"ASNs" "suggestions":[map["description":"RIPE-MEETING-AS, NL" "label":"AS2121" "value":"AS2121"] map["description":"RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC), NL" "label":"AS3333" "value":"AS3333"] map["description":"RIPE-NCC-RIS-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC), NL" "label":"AS12654" "value":"AS12654"] map["description":"RIPE, DE" "label":"AS12898" "value":"AS12898"] map["description":"RIPE-AT-AS, AT" "label":"AS34964" "value":"AS34964"] map["description":"RIPE-NCC-RIS-4BYTE-AS, NL" "label":"AS196615" "value":"AS196615"] map["description":"RIPE-NCC-AUTHDNS-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC), NL" "label":"AS197000" "value":"AS197000"] map["description":"RIPE-NCC-DR-AS, SE" "label":"AS201965" "value":"AS201965"]]] map["category":"Domains" "suggestions":[map["description":"riperam.org ranks #6325 on Alexa.com" "label":"riperam.org" "value":"riperam.org"] map["description":"ripe.net ranks #30289 on Alexa.com" "label":"ripe.net" "value":"ripe.net"] map["description":"ripemom.com ranks #148120 on Alexa.com" "label":"ripemom.com" "value":"ripemom.com"] map["description":"ripegoal.com ranks #329552 on Alexa.com" "label":"ripegoal.com" "value":"ripegoal.com"] map["description":"ripeinc.com ranks #389362 on Alexa.com" "label":"ripeinc.com" "value":"ripeinc.com"] map["description":"riper.am ranks #401003 on Alexa.com" "label":"riper.am" "value":"riper.am"] map["description":"ripetwats.com ranks #492938 on Alexa.com" "label":"ripetwats.com" "value":"ripetwats.com"] map["description":"ripenapps.com ranks #525763 on Alexa.com" "label":"ripenapps.com" "value":"ripenapps.com"] map["description":"ripe-life.com ranks #688146 on Alexa.com" "label":"ripe-life.com" "value":"ripe-life.com"] map["description":"ripetheband.com ranks #688147 on Alexa.com" "label":"ripetheband.com" "value":"ripetheband.com"] map["description":"ripeningrooms.com ranks #770290 on Alexa.com" "label":"ripeningrooms.com" "value":"ripeningrooms.com"] map["description":"ripedeli.co.nz ranks #781608 on Alexa.com" "label":"ripedeli.co.nz" "value":"ripedeli.co.nz"] map["description":"ripen.dk ranks #846782 on Alexa.com" "label":"ripen.dk" "value":"ripen.dk"] map["description":"ripegelato.com ranks #971751 on Alexa.com" "label":"ripegelato.com" "value":"ripegelato.com"] map["description":"ripemen.tumblr.com ranks #971752 on Alexa.com" "label":"ripemen.tumblr.com" "value":"ripemen.tumblr.com"] map["description":"ripen.com ranks #971753 on Alexa.com" "label":"ripen.com" "value":"ripen.com"]]] map["category":"Site Navigation" "suggestions":[map["description":"Go to RIPEstat Home" "label":"RIPEstat Home" "link":"/" "value":"RIPEstat Home"] map["description":"Go to About RIPEstat" "label":"About RIPEstat" "link":"/index/about-ripestat" "value":"About RIPEstat"]]] map["category":"Special" "suggestions":[map["description":"Go to the RIPE Atlas Measurement Targets widget" "label":"RIPE Atlas Measurement Targets" "link":"/widget/atlas-targets" "value":"Go to RIPE Atlas Measurement Targets"] map["description":"Go to the RIPE Atlas Probes widget" "label":"RIPE Atlas Probes" "link":"/widget/atlas-probes" "value":"Go to RIPE Atlas Probes"]]]] "limit":%!q(float64=50) "query_term":"RIPE"]

func (*Client) SpeedcheckerBandwidthMeasurements

func (c *Client) SpeedcheckerBandwidthMeasurements(resource, starttime, endtime string) (map[string]interface{}, error)

SpeedcheckerBandwidthMeasurements GETs bandwidth measurement results collected on the Speedchecker platform. The bandwith is measured with HTML5 clients (e.g. https://www.broadbandspeedchecker.co.uk) as well as with Speedchecker's mobile applications. The unit of measurement is kilobits per second (Kbps). Since 2018-05-28 data is synchronized live between Speedchecker and RIPEstat, which means that every measurement done on the Speedchecker platform will show up in this data call after a few seconds.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "193/23" // prefix
starttime := ""
endtime := ""
r, err := c.SpeedcheckerBandwidthMeasurements(resource, starttime, endtime)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

earliest_time
endtime
latest_time
measurements
resource
starttime
statistics

func (*Client) Visibility

func (c *Client) Visibility(resource, queryTime, include string) (map[string]interface{}, error)

Visibility GETs information on the visibility of a resource as observed from RIS (http://ris.ripe.net). Historical lookups are supported - a query has to be aligned to the times (00:00, 08:00 and 16:00 UTC) when RIS data has been collected. By default, the data call returns the latest data.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // IP address or ASN
queryTime := ""
include := "" // optionally, "peers_seeing" includes details on peers that are seeing a resource as only the peers that are not seeing a resource.
r, err := c.Visibility(resource, queryTime, include)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

include
lastest_time
query_time
related_prefixes
resource
visibilities

func (*Client) WhatsMyIP

func (c *Client) WhatsMyIP() (map[string]interface{}, error)

WhatsMyIP GETs the IP address of the requestor.

Example
c := NewClient().WithSourceApp("go-ripestat")
r, err := c.WhatsMyIP()
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

ip

func (*Client) Whois

func (c *Client) Whois(resource string) (map[string]interface{}, error)

Whois GETs whois information from the relevant Regional Internet Registry and Routing Registry.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "64496" // ASN or IP Address
r, err := c.Whois(resource)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

authorities
irr_records
query_time
records
resource

func (*Client) WhoisObjectLastUpdated

func (c *Client) WhoisObjectLastUpdated(object, objectType, source, timestamp, compareWithLive string) (map[string]interface{}, error)

WhoisObjectLastUpdated GETs information of when a certain object was last updated in the whois database.

Example
c := NewClient().WithSourceApp("go-ripestat")
object := "AS64996"     // the exact object to query for
objectType := "aut-num" // aut-num, inetnum, person, etc
source := "RIPE"        // RIPE or APNIC
timestamp := ""
compareWithLive := "" // When True (default), the version at the last changed time will be compared with the current live object and indicate if it's different.
r, err := c.WhoisObjectLastUpdated(object, objectType, source, timestamp, compareWithLive)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
delete(data, "query_time")
fmt.Printf("%q", data)
Output:

map["last_updated":<nil> "object":"AS64996" "same_as_live":"yes"]

func (*Client) WithSourceApp

func (c *Client) WithSourceApp(s string) *Client

WithSourceApp sets the `sourceapp` parameter for every request made by this client.

func (*Client) Zonemaster

func (c *Client) Zonemaster(resource, method string) (map[string]interface{}, error)

Zonemaster GETs the test results of DNS checks run by Zonemaster. The data call has two modes, one to get an overview of available tests ("resource" parameter is hostname) and one to get the test details ("resource" parameter is test ID and "method" parameter is "details"). Please note that this data call is in development and features/availability can change.

Example
c := NewClient().WithSourceApp("go-ripestat")
resource := "0.0.193.in-addr.arpa" // The hostname the DNS checks are based on or the ID of the test result
method := ""                       // This is necessary when retrieving test details and when the "resource" parameter is a test ID
r, err := c.Zonemaster(resource, method)
if err != nil {
	panic(err)
}
data := r["data"].(map[string]interface{})
printMapKeysSorted(data)
Output:

parameters
result

Jump to

Keyboard shortcuts

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