# BGP ## Get BGP time series `client.Radar.BGP.Timeseries(ctx, query) (*BGPTimeseriesResponse, error)` **get** `/radar/bgp/timeseries` Retrieves BGP updates over time. When requesting updates for an autonomous system, only BGP updates of type announcement are returned. ### Parameters - `query BGPTimeseriesParams` - `AggInterval param.Field[BGPTimeseriesParamsAggInterval]` Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). - `const BGPTimeseriesParamsAggInterval15m BGPTimeseriesParamsAggInterval = "15m"` - `const BGPTimeseriesParamsAggInterval1h BGPTimeseriesParamsAggInterval = "1h"` - `const BGPTimeseriesParamsAggInterval1d BGPTimeseriesParamsAggInterval = "1d"` - `const BGPTimeseriesParamsAggInterval1w BGPTimeseriesParamsAggInterval = "1w"` - `ASN param.Field[[]string]` Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from results. For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. - `DateEnd param.Field[[]Time]` End of the date range (inclusive). - `DateRange param.Field[[]string]` Filters results by date range. For example, use `7d` and `7dcontrol` to compare this week with the previous week. Use this parameter or set specific start and end dates (`dateStart` and `dateEnd` parameters). - `DateStart param.Field[[]Time]` Start of the date range. - `Format param.Field[BGPTimeseriesParamsFormat]` Format in which results will be returned. - `const BGPTimeseriesParamsFormatJson BGPTimeseriesParamsFormat = "JSON"` - `const BGPTimeseriesParamsFormatCsv BGPTimeseriesParamsFormat = "CSV"` - `Name param.Field[[]string]` Array of names used to label the series in the response. - `Prefix param.Field[[]string]` Filters results by BGP network prefix. - `UpdateType param.Field[[]BGPTimeseriesParamsUpdateType]` Filters results by BGP update type. - `const BGPTimeseriesParamsUpdateTypeAnnouncement BGPTimeseriesParamsUpdateType = "ANNOUNCEMENT"` - `const BGPTimeseriesParamsUpdateTypeWithdrawal BGPTimeseriesParamsUpdateType = "WITHDRAWAL"` ### Returns - `type BGPTimeseriesResponse struct{…}` - `Meta BGPTimeseriesResponseMeta` - `AggInterval BGPTimeseriesResponseMetaAggInterval` - `const BGPTimeseriesResponseMetaAggInterval15m BGPTimeseriesResponseMetaAggInterval = "15m"` - `const BGPTimeseriesResponseMetaAggInterval1h BGPTimeseriesResponseMetaAggInterval = "1h"` - `const BGPTimeseriesResponseMetaAggInterval1d BGPTimeseriesResponseMetaAggInterval = "1d"` - `const BGPTimeseriesResponseMetaAggInterval1w BGPTimeseriesResponseMetaAggInterval = "1w"` - `ConfidenceInfo BGPTimeseriesResponseMetaConfidenceInfo` - `Annotations []BGPTimeseriesResponseMetaConfidenceInfoAnnotation` - `DataSource BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource` Data source for annotations. - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAll BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIBots BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBGP BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBots BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceCT BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CT"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNS BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDos BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFw BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFwPg BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTP BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceIQI BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceNet BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "NET"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceSpeed BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI BGPTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"` - `Description string` - `EndDate Time` - `EventType BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType` Event type for annotations. - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeEvent BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeGeneral BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeOutage BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePipeline BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"` - `const BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly BGPTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "TRAFFIC_ANOMALY"` - `IsInstantaneous bool` Whether event is a single point in time or a time range. - `LinkedURL string` - `StartDate Time` - `Level int64` Provides an indication of how much confidence Cloudflare has in the data. - `DateRange []BGPTimeseriesResponseMetaDateRange` - `EndTime Time` Adjusted end of date range. - `StartTime Time` Adjusted start of date range. - `LastUpdated Time` - `Serie0 BGPTimeseriesResponseSerie0` - `Timestamps []Time` - `Values []string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Timeseries(context.TODO(), radar.BGPTimeseriesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "aggInterval": "15m", "confidenceInfo": { "annotations": [ { "dataSource": "ALL", "description": "Cable cut in Tonga", "endDate": "2019-12-27T18:11:19.117Z", "eventType": "EVENT", "isInstantaneous": true, "linkedUrl": "https://example.com", "startDate": "2019-12-27T18:11:19.117Z" } ], "level": 0 }, "dateRange": [ { "endTime": "2022-09-17T10:22:57.555Z", "startTime": "2022-09-16T10:22:57.555Z" } ], "lastUpdated": "2019-12-27T18:11:19.117Z" }, "serie_0": { "timestamps": [ "2019-12-27T18:11:19.117Z" ], "values": [ "10" ] } }, "success": true } ``` # Leaks # Events ## Get BGP route leak events `client.Radar.BGP.Leaks.Events.List(ctx, query) (*V4PagePagination[BGPLeakEventListResponse], error)` **get** `/radar/bgp/leaks/events` Retrieves the BGP route leak events. ### Parameters - `query BGPLeakEventListParams` - `DateEnd param.Field[Time]` End of the date range (inclusive). - `DateRange param.Field[string]` Filters results by date range. - `DateStart param.Field[Time]` Start of the date range (inclusive). - `EventID param.Field[int64]` The unique identifier of a event. - `Format param.Field[BGPLeakEventListParamsFormat]` Format in which results will be returned. - `const BGPLeakEventListParamsFormatJson BGPLeakEventListParamsFormat = "JSON"` - `const BGPLeakEventListParamsFormatCsv BGPLeakEventListParamsFormat = "CSV"` - `InvolvedASN param.Field[int64]` ASN that is causing or affected by a route leak event. - `InvolvedCountry param.Field[string]` Country code of a involved ASN in a route leak event. - `LeakASN param.Field[int64]` The leaking AS of a route leak event. - `Page param.Field[int64]` Current page number, starting from 1. - `PerPage param.Field[int64]` Number of entries per page. - `SortBy param.Field[BGPLeakEventListParamsSortBy]` Sorts results by the specified field. - `const BGPLeakEventListParamsSortByID BGPLeakEventListParamsSortBy = "ID"` - `const BGPLeakEventListParamsSortByLeaks BGPLeakEventListParamsSortBy = "LEAKS"` - `const BGPLeakEventListParamsSortByPeers BGPLeakEventListParamsSortBy = "PEERS"` - `const BGPLeakEventListParamsSortByPrefixes BGPLeakEventListParamsSortBy = "PREFIXES"` - `const BGPLeakEventListParamsSortByOrigins BGPLeakEventListParamsSortBy = "ORIGINS"` - `const BGPLeakEventListParamsSortByTime BGPLeakEventListParamsSortBy = "TIME"` - `SortOrder param.Field[BGPLeakEventListParamsSortOrder]` Sort order. - `const BGPLeakEventListParamsSortOrderAsc BGPLeakEventListParamsSortOrder = "ASC"` - `const BGPLeakEventListParamsSortOrderDesc BGPLeakEventListParamsSortOrder = "DESC"` ### Returns - `type BGPLeakEventListResponse struct{…}` - `ASNInfo []BGPLeakEventListResponseASNInfo` - `ASN int64` - `CountryCode string` - `OrgName string` - `Events []BGPLeakEventListResponseEvent` - `ID int64` - `Countries []string` - `DetectedTs string` - `Finished bool` - `LeakASN int64` - `LeakCount int64` - `LeakSeg []int64` - `LeakType int64` - `MaxTs string` - `MinTs string` - `OriginCount int64` - `PeerCount int64` - `PrefixCount int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Radar.BGP.Leaks.Events.List(context.TODO(), radar.BGPLeakEventListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": { "asn_info": [ { "asn": 0, "country_code": "country_code", "org_name": "org_name" } ], "events": [ { "id": 0, "countries": [ "string" ], "detected_ts": "detected_ts", "finished": true, "leak_asn": 0, "leak_count": 0, "leak_seg": [ 0 ], "leak_type": 0, "max_ts": "max_ts", "min_ts": "min_ts", "origin_count": 0, "peer_count": 0, "prefix_count": 0 } ] }, "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` # Top ## Get top prefixes by BGP updates `client.Radar.BGP.Top.Prefixes(ctx, query) (*BGPTopPrefixesResponse, error)` **get** `/radar/bgp/top/prefixes` Retrieves the top network prefixes by BGP updates. ### Parameters - `query BGPTopPrefixesParams` - `ASN param.Field[[]string]` Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from results. For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. - `DateEnd param.Field[[]Time]` End of the date range (inclusive). - `DateRange param.Field[[]string]` Filters results by date range. For example, use `7d` and `7dcontrol` to compare this week with the previous week. Use this parameter or set specific start and end dates (`dateStart` and `dateEnd` parameters). - `DateStart param.Field[[]Time]` Start of the date range. - `Format param.Field[BGPTopPrefixesParamsFormat]` Format in which results will be returned. - `const BGPTopPrefixesParamsFormatJson BGPTopPrefixesParamsFormat = "JSON"` - `const BGPTopPrefixesParamsFormatCsv BGPTopPrefixesParamsFormat = "CSV"` - `Limit param.Field[int64]` Limits the number of objects returned in the response. - `Name param.Field[[]string]` Array of names used to label the series in the response. - `UpdateType param.Field[[]BGPTopPrefixesParamsUpdateType]` Filters results by BGP update type. - `const BGPTopPrefixesParamsUpdateTypeAnnouncement BGPTopPrefixesParamsUpdateType = "ANNOUNCEMENT"` - `const BGPTopPrefixesParamsUpdateTypeWithdrawal BGPTopPrefixesParamsUpdateType = "WITHDRAWAL"` ### Returns - `type BGPTopPrefixesResponse struct{…}` - `Meta BGPTopPrefixesResponseMeta` - `DateRange []BGPTopPrefixesResponseMetaDateRange` - `EndTime Time` Adjusted end of date range. - `StartTime Time` Adjusted start of date range. - `Top0 []BGPTopPrefixesResponseTop0` - `Prefix string` - `Value string` A numeric string. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Top.Prefixes(context.TODO(), radar.BGPTopPrefixesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "dateRange": [ { "endTime": "2022-09-17T10:22:57.555Z", "startTime": "2022-09-16T10:22:57.555Z" } ] }, "top_0": [ { "prefix": "2804:77cc:8000::/33", "value": "10" } ] }, "success": true } ``` # Ases ## Get top ASes by BGP updates `client.Radar.BGP.Top.Ases.Get(ctx, query) (*BGPTopAseGetResponse, error)` **get** `/radar/bgp/top/ases` Retrieves the top autonomous systems by BGP updates (announcements only). ### Parameters - `query BGPTopAseGetParams` - `ASN param.Field[[]string]` Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from results. For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. - `DateEnd param.Field[[]Time]` End of the date range (inclusive). - `DateRange param.Field[[]string]` Filters results by date range. For example, use `7d` and `7dcontrol` to compare this week with the previous week. Use this parameter or set specific start and end dates (`dateStart` and `dateEnd` parameters). - `DateStart param.Field[[]Time]` Start of the date range. - `Format param.Field[BGPTopAseGetParamsFormat]` Format in which results will be returned. - `const BGPTopAseGetParamsFormatJson BGPTopAseGetParamsFormat = "JSON"` - `const BGPTopAseGetParamsFormatCsv BGPTopAseGetParamsFormat = "CSV"` - `Limit param.Field[int64]` Limits the number of objects returned in the response. - `Name param.Field[[]string]` Array of names used to label the series in the response. - `Prefix param.Field[[]string]` Filters results by BGP network prefix. - `UpdateType param.Field[[]BGPTopAseGetParamsUpdateType]` Filters results by BGP update type. - `const BGPTopAseGetParamsUpdateTypeAnnouncement BGPTopAseGetParamsUpdateType = "ANNOUNCEMENT"` - `const BGPTopAseGetParamsUpdateTypeWithdrawal BGPTopAseGetParamsUpdateType = "WITHDRAWAL"` ### Returns - `type BGPTopAseGetResponse struct{…}` - `Meta BGPTopAseGetResponseMeta` - `DateRange []BGPTopAseGetResponseMetaDateRange` - `EndTime Time` Adjusted end of date range. - `StartTime Time` Adjusted start of date range. - `Top0 []BGPTopAseGetResponseTop0` - `ASN int64` - `AsName string` - `Value string` Percentage of updates by this AS out of the total updates by all autonomous systems. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) ase, err := client.Radar.BGP.Top.Ases.Get(context.TODO(), radar.BGPTopAseGetParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", ase.Meta) } ``` #### Response ```json { "result": { "meta": { "dateRange": [ { "endTime": "2022-09-17T10:22:57.555Z", "startTime": "2022-09-16T10:22:57.555Z" } ] }, "top_0": [ { "asn": 714, "ASName": "Apple-Engineering", "value": "0.73996" } ] }, "success": true } ``` ## Get top ASes by prefix count `client.Radar.BGP.Top.Ases.Prefixes(ctx, query) (*BGPTopAsePrefixesResponse, error)` **get** `/radar/bgp/top/ases/prefixes` Retrieves the full list of autonomous systems on the global routing table ordered by announced prefixes count. The data comes from public BGP MRT data archives and updates every 2 hours. ### Parameters - `query BGPTopAsePrefixesParams` - `Country param.Field[string]` Alpha-2 country code. - `Format param.Field[BGPTopAsePrefixesParamsFormat]` Format in which results will be returned. - `const BGPTopAsePrefixesParamsFormatJson BGPTopAsePrefixesParamsFormat = "JSON"` - `const BGPTopAsePrefixesParamsFormatCsv BGPTopAsePrefixesParamsFormat = "CSV"` - `Limit param.Field[int64]` Maximum number of ASes to return. ### Returns - `type BGPTopAsePrefixesResponse struct{…}` - `ASNs []BGPTopAsePrefixesResponseASN` - `ASN int64` - `Country string` - `Name string` - `PfxsCount int64` - `Meta BGPTopAsePrefixesResponseMeta` - `DataTime string` - `QueryTime string` - `TotalPeers int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Top.Ases.Prefixes(context.TODO(), radar.BGPTopAsePrefixesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ASNs) } ``` #### Response ```json { "result": { "asns": [ { "asn": 0, "country": "country", "name": "name", "pfxs_count": 0 } ], "meta": { "data_time": "data_time", "query_time": "query_time", "total_peers": 0 } }, "success": true } ``` # Hijacks # Events ## Get BGP hijack events `client.Radar.BGP.Hijacks.Events.List(ctx, query) (*V4PagePagination[BGPHijackEventListResponse], error)` **get** `/radar/bgp/hijacks/events` Retrieves the BGP hijack events. ### Parameters - `query BGPHijackEventListParams` - `DateEnd param.Field[Time]` End of the date range (inclusive). - `DateRange param.Field[string]` Filters results by date range. - `DateStart param.Field[Time]` Start of the date range (inclusive). - `EventID param.Field[int64]` The unique identifier of a event. - `Format param.Field[BGPHijackEventListParamsFormat]` Format in which results will be returned. - `const BGPHijackEventListParamsFormatJson BGPHijackEventListParamsFormat = "JSON"` - `const BGPHijackEventListParamsFormatCsv BGPHijackEventListParamsFormat = "CSV"` - `HijackerASN param.Field[int64]` The potential hijacker AS of a BGP hijack event. - `InvolvedASN param.Field[int64]` The potential hijacker or victim AS of a BGP hijack event. - `InvolvedCountry param.Field[string]` The country code of the potential hijacker or victim AS of a BGP hijack event. - `MaxConfidence param.Field[int64]` Filters events by maximum confidence score (1-4 low, 5-7 mid, 8+ high). - `MinConfidence param.Field[int64]` Filters events by minimum confidence score (1-4 low, 5-7 mid, 8+ high). - `Page param.Field[int64]` Current page number, starting from 1. - `PerPage param.Field[int64]` Number of entries per page. - `Prefix param.Field[string]` - `SortBy param.Field[BGPHijackEventListParamsSortBy]` Sorts results by the specified field. - `const BGPHijackEventListParamsSortByID BGPHijackEventListParamsSortBy = "ID"` - `const BGPHijackEventListParamsSortByTime BGPHijackEventListParamsSortBy = "TIME"` - `const BGPHijackEventListParamsSortByConfidence BGPHijackEventListParamsSortBy = "CONFIDENCE"` - `SortOrder param.Field[BGPHijackEventListParamsSortOrder]` Sort order. - `const BGPHijackEventListParamsSortOrderAsc BGPHijackEventListParamsSortOrder = "ASC"` - `const BGPHijackEventListParamsSortOrderDesc BGPHijackEventListParamsSortOrder = "DESC"` - `VictimASN param.Field[int64]` The potential victim AS of a BGP hijack event. ### Returns - `type BGPHijackEventListResponse struct{…}` - `ASNInfo []BGPHijackEventListResponseASNInfo` - `ASN int64` - `CountryCode string` - `OrgName string` - `Events []BGPHijackEventListResponseEvent` - `ID int64` - `ConfidenceScore int64` - `Duration int64` - `EventType int64` - `HijackMsgsCount int64` - `HijackerASN int64` - `HijackerCountry string` - `IsStale bool` - `MaxHijackTs string` - `MaxMsgTs string` - `MinHijackTs string` - `OnGoingCount int64` - `PeerASNs []int64` - `PeerIPCount int64` - `Prefixes []string` - `Tags []BGPHijackEventListResponseEventsTag` - `Name string` - `Score int64` - `VictimASNs []int64` - `VictimCountries []string` - `TotalMonitors int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Radar.BGP.Hijacks.Events.List(context.TODO(), radar.BGPHijackEventListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": { "asn_info": [ { "asn": 0, "country_code": "country_code", "org_name": "org_name" } ], "events": [ { "id": 0, "confidence_score": 0, "duration": 0, "event_type": 0, "hijack_msgs_count": 0, "hijacker_asn": 0, "hijacker_country": "hijacker_country", "is_stale": true, "max_hijack_ts": "max_hijack_ts", "max_msg_ts": "max_msg_ts", "min_hijack_ts": "min_hijack_ts", "on_going_count": 0, "peer_asns": [ 0 ], "peer_ip_count": 0, "prefixes": [ "string" ], "tags": [ { "name": "name", "score": 0 } ], "victim_asns": [ 0 ], "victim_countries": [ "string" ] } ], "total_monitors": 0 }, "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` # Routes ## Get Multi-Origin AS (MOAS) prefixes `client.Radar.BGP.Routes.Moas(ctx, query) (*BGPRouteMoasResponse, error)` **get** `/radar/bgp/routes/moas` Retrieves all Multi-Origin AS (MOAS) prefixes in the global routing tables. ### Parameters - `query BGPRouteMoasParams` - `Format param.Field[BGPRouteMoasParamsFormat]` Format in which results will be returned. - `const BGPRouteMoasParamsFormatJson BGPRouteMoasParamsFormat = "JSON"` - `const BGPRouteMoasParamsFormatCsv BGPRouteMoasParamsFormat = "CSV"` - `InvalidOnly param.Field[bool]` Lookup only RPKI invalid MOASes. - `Origin param.Field[int64]` Lookup MOASes originated by the given ASN. - `Prefix param.Field[string]` ### Returns - `type BGPRouteMoasResponse struct{…}` - `Meta BGPRouteMoasResponseMeta` - `DataTime string` - `QueryTime string` - `TotalPeers int64` - `Moas []BGPRouteMoasResponseMoa` - `Origins []BGPRouteMoasResponseMoasOrigin` - `Origin int64` - `PeerCount int64` - `RPKIValidation string` - `Prefix string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Routes.Moas(context.TODO(), radar.BGPRouteMoasParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "data_time": "data_time", "query_time": "query_time", "total_peers": 0 }, "moas": [ { "origins": [ { "origin": 0, "peer_count": 0, "rpki_validation": "rpki_validation" } ], "prefix": "prefix" } ] }, "success": true } ``` ## Get prefix-to-ASN mapping `client.Radar.BGP.Routes.Pfx2as(ctx, query) (*BGPRoutePfx2asResponse, error)` **get** `/radar/bgp/routes/pfx2as` Retrieves the prefix-to-ASN mapping from global routing tables. ### Parameters - `query BGPRoutePfx2asParams` - `Format param.Field[BGPRoutePfx2asParamsFormat]` Format in which results will be returned. - `const BGPRoutePfx2asParamsFormatJson BGPRoutePfx2asParamsFormat = "JSON"` - `const BGPRoutePfx2asParamsFormatCsv BGPRoutePfx2asParamsFormat = "CSV"` - `LongestPrefixMatch param.Field[bool]` Return only results with the longest prefix match for the given prefix. For example, specify a /32 prefix to lookup the origin ASN for an IPv4 address. - `Origin param.Field[int64]` Lookup prefixes originated by the given ASN. - `Prefix param.Field[string]` - `RPKIStatus param.Field[BGPRoutePfx2asParamsRPKIStatus]` Return only results with matching rpki status: valid, invalid or unknown. - `const BGPRoutePfx2asParamsRPKIStatusValid BGPRoutePfx2asParamsRPKIStatus = "VALID"` - `const BGPRoutePfx2asParamsRPKIStatusInvalid BGPRoutePfx2asParamsRPKIStatus = "INVALID"` - `const BGPRoutePfx2asParamsRPKIStatusUnknown BGPRoutePfx2asParamsRPKIStatus = "UNKNOWN"` ### Returns - `type BGPRoutePfx2asResponse struct{…}` - `Meta BGPRoutePfx2asResponseMeta` - `DataTime string` - `QueryTime string` - `TotalPeers int64` - `PrefixOrigins []BGPRoutePfx2asResponsePrefixOrigin` - `Origin int64` - `PeerCount int64` - `Prefix string` - `RPKIValidation string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Routes.Pfx2as(context.TODO(), radar.BGPRoutePfx2asParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "data_time": "data_time", "query_time": "query_time", "total_peers": 0 }, "prefix_origins": [ { "origin": 0, "peer_count": 0, "prefix": "prefix", "rpki_validation": "rpki_validation" } ] }, "success": true } ``` ## Get BGP routing table stats `client.Radar.BGP.Routes.Stats(ctx, query) (*BGPRouteStatsResponse, error)` **get** `/radar/bgp/routes/stats` Retrieves the BGP routing table stats. ### Parameters - `query BGPRouteStatsParams` - `ASN param.Field[int64]` Filters results by Autonomous System. Specify a single Autonomous System Number (ASN) as integer. - `Format param.Field[BGPRouteStatsParamsFormat]` Format in which results will be returned. - `const BGPRouteStatsParamsFormatJson BGPRouteStatsParamsFormat = "JSON"` - `const BGPRouteStatsParamsFormatCsv BGPRouteStatsParamsFormat = "CSV"` - `Location param.Field[string]` Filters results by location. Specify an alpha-2 location code. ### Returns - `type BGPRouteStatsResponse struct{…}` - `Meta BGPRouteStatsResponseMeta` - `DataTime string` - `QueryTime string` - `TotalPeers int64` - `Stats BGPRouteStatsResponseStats` - `DistinctOrigins int64` - `DistinctOriginsIPV4 int64` - `DistinctOriginsIPV6 int64` - `DistinctPrefixes int64` - `DistinctPrefixesIPV4 int64` - `DistinctPrefixesIPV6 int64` - `RoutesInvalid int64` - `RoutesInvalidIPV4 int64` - `RoutesInvalidIPV6 int64` - `RoutesTotal int64` - `RoutesTotalIPV4 int64` - `RoutesTotalIPV6 int64` - `RoutesUnknown int64` - `RoutesUnknownIPV4 int64` - `RoutesUnknownIPV6 int64` - `RoutesValid int64` - `RoutesValidIPV4 int64` - `RoutesValidIPV6 int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Routes.Stats(context.TODO(), radar.BGPRouteStatsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "data_time": "data_time", "query_time": "query_time", "total_peers": 0 }, "stats": { "distinct_origins": 0, "distinct_origins_ipv4": 0, "distinct_origins_ipv6": 0, "distinct_prefixes": 0, "distinct_prefixes_ipv4": 0, "distinct_prefixes_ipv6": 0, "routes_invalid": 0, "routes_invalid_ipv4": 0, "routes_invalid_ipv6": 0, "routes_total": 0, "routes_total_ipv4": 0, "routes_total_ipv6": 0, "routes_unknown": 0, "routes_unknown_ipv4": 0, "routes_unknown_ipv6": 0, "routes_valid": 0, "routes_valid_ipv4": 0, "routes_valid_ipv6": 0 } }, "success": true } ``` ## List ASes from global routing tables `client.Radar.BGP.Routes.Ases(ctx, query) (*BGPRouteAsesResponse, error)` **get** `/radar/bgp/routes/ases` Retrieves all ASes in the current global routing tables with routing statistics. ### Parameters - `query BGPRouteAsesParams` - `Format param.Field[BGPRouteAsesParamsFormat]` Format in which results will be returned. - `const BGPRouteAsesParamsFormatJson BGPRouteAsesParamsFormat = "JSON"` - `const BGPRouteAsesParamsFormatCsv BGPRouteAsesParamsFormat = "CSV"` - `Limit param.Field[int64]` Limits the number of objects returned in the response. - `Location param.Field[string]` Filters results by location. Specify an alpha-2 location code. - `SortBy param.Field[BGPRouteAsesParamsSortBy]` Sorts results by the specified field. - `const BGPRouteAsesParamsSortByCone BGPRouteAsesParamsSortBy = "cone"` - `const BGPRouteAsesParamsSortByPfxs BGPRouteAsesParamsSortBy = "pfxs"` - `const BGPRouteAsesParamsSortByIPV4 BGPRouteAsesParamsSortBy = "ipv4"` - `const BGPRouteAsesParamsSortByIPV6 BGPRouteAsesParamsSortBy = "ipv6"` - `const BGPRouteAsesParamsSortByRPKIValid BGPRouteAsesParamsSortBy = "rpki_valid"` - `const BGPRouteAsesParamsSortByRPKIInvalid BGPRouteAsesParamsSortBy = "rpki_invalid"` - `const BGPRouteAsesParamsSortByRPKIUnknown BGPRouteAsesParamsSortBy = "rpki_unknown"` - `SortOrder param.Field[BGPRouteAsesParamsSortOrder]` Sort order. - `const BGPRouteAsesParamsSortOrderAsc BGPRouteAsesParamsSortOrder = "ASC"` - `const BGPRouteAsesParamsSortOrderDesc BGPRouteAsesParamsSortOrder = "DESC"` ### Returns - `type BGPRouteAsesResponse struct{…}` - `ASNs []BGPRouteAsesResponseASN` - `ASN int64` - `ConeSize int64` AS's customer cone size. - `Country string` Alpha-2 code for the AS's registration country. - `IPV4Count int64` Number of IPv4 addresses originated by the AS. - `IPV6Count string` Number of IPv6 addresses originated by the AS. - `Name string` Name of the AS. - `PfxsCount int64` Number of total IP prefixes originated by the AS. - `RPKIInvalid int64` Number of RPKI invalid prefixes originated by the AS. - `RPKIUnknown int64` Number of RPKI unknown prefixes originated by the AS. - `RPKIValid int64` Number of RPKI valid prefixes originated by the AS. - `Meta BGPRouteAsesResponseMeta` - `DataTime string` The timestamp of when the data is generated. - `QueryTime string` The timestamp of the query. - `TotalPeers int64` Total number of route collector peers used to generate this data. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Routes.Ases(context.TODO(), radar.BGPRouteAsesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ASNs) } ``` #### Response ```json { "result": { "asns": [ { "asn": 0, "coneSize": 0, "country": "US", "ipv4Count": 0, "ipv6Count": "1.21e24", "name": "name", "pfxsCount": 0, "rpkiInvalid": 0, "rpkiUnknown": 0, "rpkiValid": 0 } ], "meta": { "dataTime": "2024-06-03T14:00:00", "queryTime": "2024-06-03T14:00:00", "totalPeers": 0 } }, "success": true } ``` ## Get real-time BGP routes for a prefix `client.Radar.BGP.Routes.Realtime(ctx, query) (*BGPRouteRealtimeResponse, error)` **get** `/radar/bgp/routes/realtime` Retrieves real-time BGP routes for a prefix, using public real-time data collectors (RouteViews and RIPE RIS). ### Parameters - `query BGPRouteRealtimeParams` - `Format param.Field[BGPRouteRealtimeParamsFormat]` Format in which results will be returned. - `const BGPRouteRealtimeParamsFormatJson BGPRouteRealtimeParamsFormat = "JSON"` - `const BGPRouteRealtimeParamsFormatCsv BGPRouteRealtimeParamsFormat = "CSV"` - `Prefix param.Field[string]` ### Returns - `type BGPRouteRealtimeResponse struct{…}` - `Meta BGPRouteRealtimeResponseMeta` - `ASNInfo []BGPRouteRealtimeResponseMetaASNInfo` - `AsName string` Name of the autonomous system. - `ASN int64` AS number. - `CountryCode string` Alpha-2 code for the AS's registration country. - `OrgID string` Organization ID. - `OrgName string` Organization name. - `Collectors []BGPRouteRealtimeResponseMetaCollector` - `Collector string` Public route collector ID. - `LatestRealtimeTs string` Latest real-time stream timestamp for this collector. - `LatestRibTs string` Latest RIB dump MRT file timestamp for this collector. - `LatestUpdatesTs string` Latest BGP updates MRT file timestamp for this collector. - `PeersCount int64` Total number of collector peers used from this collector. - `PeersV4Count int64` Total number of collector peers used from this collector for IPv4 prefixes. - `PeersV6Count int64` Total number of collector peers used from this collector for IPv6 prefixes. - `DataTime string` The most recent data timestamp for from the real-time sources. - `PrefixOrigins []BGPRouteRealtimeResponseMetaPrefixOrigin` - `Origin int64` Origin ASN. - `Prefix string` IP prefix of this query. - `RPKIValidation string` Prefix-origin RPKI validation: valid, invalid, unknown. - `TotalPeers int64` Total number of peers. - `TotalVisible int64` Total number of peers seeing this prefix. - `Visibility float64` Ratio of peers seeing this prefix to total number of peers. - `QueryTime string` The timestamp of this query. - `Routes []BGPRouteRealtimeResponseRoute` - `AsPath []int64` AS-level path for this route, from collector to origin. - `Collector string` Public collector ID for this route. - `Communities []string` BGP community values. - `Prefix string` IP prefix of this query. - `Timestamp string` Latest timestamp of change for this route. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.Routes.Realtime(context.TODO(), radar.BGPRouteRealtimeParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "asn_info": [ { "as_name": "as_name", "asn": 0, "country_code": "country_code", "org_id": "org_id", "org_name": "org_name" } ], "collectors": [ { "collector": "collector", "latest_realtime_ts": "latest_realtime_ts", "latest_rib_ts": "latest_rib_ts", "latest_updates_ts": "latest_updates_ts", "peers_count": 0, "peers_v4_count": 0, "peers_v6_count": 0 } ], "data_time": "data_time", "prefix_origins": [ { "origin": 0, "prefix": "prefix", "rpki_validation": "rpki_validation", "total_peers": 0, "total_visible": 0, "visibility": 0 } ], "query_time": "query_time" }, "routes": [ { "as_path": [ 0 ], "collector": "collector", "communities": [ "string" ], "prefix": "prefix", "timestamp": "timestamp" } ] }, "success": true } ``` # IPs ## Get announced IP address space time series `client.Radar.BGP.IPs.Timeseries(ctx, query) (*BgpipTimeseriesResponse, error)` **get** `/radar/bgp/ips/timeseries` Retrieves time series data for the announced IP space count, represented as the number of IPv4 /24s and IPv6 /48s, for a given ASN. ### Parameters - `query BGPIPTimeseriesParams` - `ASN param.Field[[]string]` Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from results. For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. - `DateEnd param.Field[[]Time]` End of the date range (inclusive). - `DateRange param.Field[[]string]` Filters results by date range. For example, use `7d` and `7dcontrol` to compare this week with the previous week. Use this parameter or set specific start and end dates (`dateStart` and `dateEnd` parameters). - `DateStart param.Field[[]Time]` Start of the date range. - `Format param.Field[BgpipTimeseriesParamsFormat]` Format in which results will be returned. - `const BgpipTimeseriesParamsFormatJson BgpipTimeseriesParamsFormat = "JSON"` - `const BgpipTimeseriesParamsFormatCsv BgpipTimeseriesParamsFormat = "CSV"` - `IncludeDelay param.Field[bool]` Includes data delay meta information. - `IPVersion param.Field[[]BgpipTimeseriesParamsIPVersion]` Filters results by IP version (Ipv4 vs. IPv6). - `const BgpipTimeseriesParamsIPVersionIPv4 BgpipTimeseriesParamsIPVersion = "IPv4"` - `const BgpipTimeseriesParamsIPVersionIPv6 BgpipTimeseriesParamsIPVersion = "IPv6"` - `Location param.Field[[]string]` Filters results by location. Specify a comma-separated list of alpha-2 location codes. - `Name param.Field[[]string]` Array of names used to label the series in the response. ### Returns - `type BgpipTimeseriesResponse struct{…}` - `Meta BgpipTimeseriesResponseMeta` Metadata for the results. - `AggInterval BgpipTimeseriesResponseMetaAggInterval` Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). - `const BgpipTimeseriesResponseMetaAggIntervalFifteenMinutes BgpipTimeseriesResponseMetaAggInterval = "FIFTEEN_MINUTES"` - `const BgpipTimeseriesResponseMetaAggIntervalOneHour BgpipTimeseriesResponseMetaAggInterval = "ONE_HOUR"` - `const BgpipTimeseriesResponseMetaAggIntervalOneDay BgpipTimeseriesResponseMetaAggInterval = "ONE_DAY"` - `const BgpipTimeseriesResponseMetaAggIntervalOneWeek BgpipTimeseriesResponseMetaAggInterval = "ONE_WEEK"` - `const BgpipTimeseriesResponseMetaAggIntervalOneMonth BgpipTimeseriesResponseMetaAggInterval = "ONE_MONTH"` - `ConfidenceInfo BgpipTimeseriesResponseMetaConfidenceInfo` - `Annotations []BgpipTimeseriesResponseMetaConfidenceInfoAnnotation` - `DataSource BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource` Data source for annotations. - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAll BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIBots BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBGP BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceBots BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceCT BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "CT"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNS BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceDos BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFw BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceFwPg BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTP BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceIQI BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceNet BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "NET"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceSpeed BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"` - `Description string` - `EndDate Time` - `EventType BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType` Event type for annotations. - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeEvent BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeGeneral BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeOutage BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypePipeline BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"` - `const BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly BgpipTimeseriesResponseMetaConfidenceInfoAnnotationsEventType = "TRAFFIC_ANOMALY"` - `IsInstantaneous bool` Whether event is a single point in time or a time range. - `LinkedURL string` - `StartDate Time` - `Level int64` Provides an indication of how much confidence Cloudflare has in the data. - `DateRange []BgpipTimeseriesResponseMetaDateRange` - `EndTime Time` Adjusted end of date range. - `StartTime Time` Adjusted start of date range. - `LastUpdated Time` Timestamp of the last dataset update. - `Normalization BgpipTimeseriesResponseMetaNormalization` Normalization method applied to the results. Refer to [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). - `const BgpipTimeseriesResponseMetaNormalizationPercentage BgpipTimeseriesResponseMetaNormalization = "PERCENTAGE"` - `const BgpipTimeseriesResponseMetaNormalizationMin0Max BgpipTimeseriesResponseMetaNormalization = "MIN0_MAX"` - `const BgpipTimeseriesResponseMetaNormalizationMinMax BgpipTimeseriesResponseMetaNormalization = "MIN_MAX"` - `const BgpipTimeseriesResponseMetaNormalizationRawValues BgpipTimeseriesResponseMetaNormalization = "RAW_VALUES"` - `const BgpipTimeseriesResponseMetaNormalizationPercentageChange BgpipTimeseriesResponseMetaNormalization = "PERCENTAGE_CHANGE"` - `const BgpipTimeseriesResponseMetaNormalizationRollingAverage BgpipTimeseriesResponseMetaNormalization = "ROLLING_AVERAGE"` - `const BgpipTimeseriesResponseMetaNormalizationOverlappedPercentage BgpipTimeseriesResponseMetaNormalization = "OVERLAPPED_PERCENTAGE"` - `const BgpipTimeseriesResponseMetaNormalizationRatio BgpipTimeseriesResponseMetaNormalization = "RATIO"` - `Units []BgpipTimeseriesResponseMetaUnit` Measurement units for the results. - `Name string` - `Value string` - `Delay BgpipTimeseriesResponseMetaDelay` - `ASNData BgpipTimeseriesResponseMetaDelayASNData` - `DelaySecs float64` - `DelayStr string` - `Healthy bool` - `Latest BgpipTimeseriesResponseMetaDelayASNDataLatest` - `EntriesCount float64` - `Path string` - `Timestamp float64` - `CountryData BgpipTimeseriesResponseMetaDelayCountryData` - `DelaySecs float64` - `DelayStr string` - `Healthy bool` - `Latest BgpipTimeseriesResponseMetaDelayCountryDataLatest` - `Count float64` - `Timestamp float64` - `Healthy bool` - `NowTs float64` - `Serie0 BgpipTimeseriesResponseSerie0` - `IPV4 []string` - `IPV6 []string` - `Timestamps []Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.IPs.Timeseries(context.TODO(), radar.BGPIPTimeseriesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "aggInterval": "FIFTEEN_MINUTES", "confidenceInfo": { "annotations": [ { "dataSource": "ALL", "description": "Cable cut in Tonga", "endDate": "2019-12-27T18:11:19.117Z", "eventType": "EVENT", "isInstantaneous": true, "linkedUrl": "https://example.com", "startDate": "2019-12-27T18:11:19.117Z" } ], "level": 0 }, "dateRange": [ { "endTime": "2022-09-17T10:22:57.555Z", "startTime": "2022-09-16T10:22:57.555Z" } ], "lastUpdated": "2019-12-27T18:11:19.117Z", "normalization": "PERCENTAGE", "units": [ { "name": "*", "value": "requests" } ], "delay": { "asn_data": { "delaySecs": 0, "delayStr": "delayStr", "healthy": true, "latest": { "entries_count": 0, "path": "path", "timestamp": 0 } }, "country_data": { "delaySecs": 0, "delayStr": "delayStr", "healthy": true, "latest": { "count": 0, "timestamp": 0 } }, "healthy": true, "nowTs": 0 } }, "serie_0": { "ipv4": [ "10" ], "ipv6": [ "10" ], "timestamps": [ "2019-12-27T18:11:19.117Z" ] } }, "success": true } ``` # RPKI # ASPA ## Get ASPA objects snapshot `client.Radar.BGP.RPKI.ASPA.Snapshot(ctx, query) (*BgprpkiaspaSnapshotResponse, error)` **get** `/radar/bgp/rpki/aspa/snapshot` Retrieves current or historical ASPA (Autonomous System Provider Authorization) objects. ASPA objects define which ASNs are authorized upstream providers for a customer ASN. ### Parameters - `query BGPRPKIASPASnapshotParams` - `CustomerASN param.Field[int64]` Filter by customer ASN (the ASN publishing the ASPA object). - `Date param.Field[Time]` Filters results by the specified datetime (ISO 8601). - `Format param.Field[BgprpkiaspaSnapshotParamsFormat]` Format in which results will be returned. - `const BgprpkiaspaSnapshotParamsFormatJson BgprpkiaspaSnapshotParamsFormat = "JSON"` - `const BgprpkiaspaSnapshotParamsFormatCsv BgprpkiaspaSnapshotParamsFormat = "CSV"` - `IncludeASNInfo param.Field[bool]` Include ASN metadata (name, country) in response. - `ProviderASN param.Field[int64]` Filter by provider ASN (an authorized upstream provider in ASPA objects). ### Returns - `type BgprpkiaspaSnapshotResponse struct{…}` - `ASNInfo BgprpkiaspaSnapshotResponseASNInfo` - `Number13335 BgprpkiaspaSnapshotResponseASNInfo13335` - `ASN int64` ASN number. - `Country string` Alpha-2 country code. - `Name string` AS name. - `ASPAObjects []BgprpkiaspaSnapshotResponseASPAObject` - `CustomerASN int64` The customer ASN publishing the ASPA object. - `Providers []int64` - `Meta BgprpkiaspaSnapshotResponseMeta` - `DataTime Time` Timestamp of the underlying data. - `QueryTime Time` Timestamp when the query was executed. - `TotalCount int64` Total number of ASPA objects. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.RPKI.ASPA.Snapshot(context.TODO(), radar.BGPRPKIASPASnapshotParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ASNInfo) } ``` #### Response ```json { "result": { "asnInfo": { "13335": { "asn": 0, "country": "country", "name": "name" } }, "aspaObjects": [ { "customerAsn": 0, "providers": [ 0 ] } ], "meta": { "dataTime": "2019-12-27T18:11:19.117Z", "queryTime": "2019-12-27T18:11:19.117Z", "totalCount": 0 } }, "success": true } ``` ## Get ASPA changes over time `client.Radar.BGP.RPKI.ASPA.Changes(ctx, query) (*BgprpkiaspaChangesResponse, error)` **get** `/radar/bgp/rpki/aspa/changes` Retrieves ASPA (Autonomous System Provider Authorization) changes over time. Returns daily aggregated changes including additions, removals, and modifications of ASPA objects. ### Parameters - `query BGPRPKIASPAChangesParams` - `ASN param.Field[int64]` Filter changes involving this ASN (as customer or provider). - `DateEnd param.Field[Time]` End of the date range (inclusive). - `DateStart param.Field[Time]` Start of the date range (inclusive). - `Format param.Field[BgprpkiaspaChangesParamsFormat]` Format in which results will be returned. - `const BgprpkiaspaChangesParamsFormatJson BgprpkiaspaChangesParamsFormat = "JSON"` - `const BgprpkiaspaChangesParamsFormatCsv BgprpkiaspaChangesParamsFormat = "CSV"` - `IncludeASNInfo param.Field[bool]` Include ASN metadata (name, country) in response. ### Returns - `type BgprpkiaspaChangesResponse struct{…}` - `ASNInfo BgprpkiaspaChangesResponseASNInfo` - `Number13335 BgprpkiaspaChangesResponseASNInfo13335` - `ASN int64` ASN number. - `Country string` Alpha-2 country code. - `Name string` AS name. - `Changes []BgprpkiaspaChangesResponseChange` - `CustomersAdded int64` Number of new ASPA objects created. - `CustomersRemoved int64` Number of ASPA objects deleted. - `Date Time` Date of the changes in ISO 8601 format. - `Entries []BgprpkiaspaChangesResponseChangesEntry` - `CustomerASN int64` The customer ASN affected. - `Providers []int64` - `Type BgprpkiaspaChangesResponseChangesEntriesType` - `const BgprpkiaspaChangesResponseChangesEntriesTypeCustomerAdded BgprpkiaspaChangesResponseChangesEntriesType = "CustomerAdded"` - `const BgprpkiaspaChangesResponseChangesEntriesTypeCustomerRemoved BgprpkiaspaChangesResponseChangesEntriesType = "CustomerRemoved"` - `const BgprpkiaspaChangesResponseChangesEntriesTypeProvidersAdded BgprpkiaspaChangesResponseChangesEntriesType = "ProvidersAdded"` - `const BgprpkiaspaChangesResponseChangesEntriesTypeProvidersRemoved BgprpkiaspaChangesResponseChangesEntriesType = "ProvidersRemoved"` - `ProvidersAdded int64` Number of providers added to existing objects. - `ProvidersRemoved int64` Number of providers removed from existing objects. - `TotalCount int64` Running total of active ASPA objects after this day. - `Meta BgprpkiaspaChangesResponseMeta` - `DataTime Time` Timestamp of the underlying data. - `QueryTime Time` Timestamp when the query was executed. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.RPKI.ASPA.Changes(context.TODO(), radar.BGPRPKIASPAChangesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ASNInfo) } ``` #### Response ```json { "result": { "asnInfo": { "13335": { "asn": 0, "country": "country", "name": "name" } }, "changes": [ { "customersAdded": 0, "customersRemoved": 0, "date": "2019-12-27T18:11:19.117Z", "entries": [ { "customerAsn": 0, "providers": [ 0 ], "type": "CustomerAdded" } ], "providersAdded": 0, "providersRemoved": 0, "totalCount": 0 } ], "meta": { "dataTime": "2019-12-27T18:11:19.117Z", "queryTime": "2019-12-27T18:11:19.117Z" } }, "success": true } ``` ## Get ASPA count time series `client.Radar.BGP.RPKI.ASPA.Timeseries(ctx, query) (*BgprpkiaspaTimeseriesResponse, error)` **get** `/radar/bgp/rpki/aspa/timeseries` Retrieves ASPA (Autonomous System Provider Authorization) object count over time. Supports filtering by RIR or location (country code) to generate multiple named series. If no RIR or location filter is specified, returns total count. ### Parameters - `query BGPRPKIASPATimeseriesParams` - `DateEnd param.Field[Time]` End of the date range (inclusive). - `DateStart param.Field[Time]` Start of the date range (inclusive). - `Format param.Field[BgprpkiaspaTimeseriesParamsFormat]` Format in which results will be returned. - `const BgprpkiaspaTimeseriesParamsFormatJson BgprpkiaspaTimeseriesParamsFormat = "JSON"` - `const BgprpkiaspaTimeseriesParamsFormatCsv BgprpkiaspaTimeseriesParamsFormat = "CSV"` - `Location param.Field[[]string]` Filters results by location. Specify a comma-separated list of alpha-2 location codes. - `Name param.Field[[]string]` Array of names used to label the series in the response. - `Rir param.Field[[]BgprpkiaspaTimeseriesParamsRir]` Filter by Regional Internet Registry (RIR). Multiple RIRs generate multiple series. - `const BgprpkiaspaTimeseriesParamsRirRipeNcc BgprpkiaspaTimeseriesParamsRir = "RIPE_NCC"` - `const BgprpkiaspaTimeseriesParamsRirArin BgprpkiaspaTimeseriesParamsRir = "ARIN"` - `const BgprpkiaspaTimeseriesParamsRirApnic BgprpkiaspaTimeseriesParamsRir = "APNIC"` - `const BgprpkiaspaTimeseriesParamsRirLacnic BgprpkiaspaTimeseriesParamsRir = "LACNIC"` - `const BgprpkiaspaTimeseriesParamsRirAfrinic BgprpkiaspaTimeseriesParamsRir = "AFRINIC"` ### Returns - `type BgprpkiaspaTimeseriesResponse struct{…}` - `Meta BgprpkiaspaTimeseriesResponseMeta` - `DataTime Time` Timestamp of the underlying data. - `QueryTime Time` Timestamp when the query was executed. - `Serie0 BgprpkiaspaTimeseriesResponseSerie0` - `Timestamps []Time` - `Values []string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/radar" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Radar.BGP.RPKI.ASPA.Timeseries(context.TODO(), radar.BGPRPKIASPATimeseriesParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Meta) } ``` #### Response ```json { "result": { "meta": { "dataTime": "2019-12-27T18:11:19.117Z", "queryTime": "2019-12-27T18:11:19.117Z" }, "serie_0": { "timestamps": [ "2019-12-27T18:11:19.117Z" ], "values": [ "10" ] } }, "success": true } ```