peeringdb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: GPL-3.0 Imports: 9 Imported by: 3

README

PeeringDB API - Go package

Go Reference Go Report Card

This is a Go package that allows developer to interact with the PeeringDB API in the easiest way possible. There are no binaries provided with this package. It can only be used as a library.

Installation

Install the library package with go get github.com/gmazoyer/peeringdb.

Example

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/gmazoyer/peeringdb"
)

func main() {
	// Create an API client (optionally with an API key)
	api := peeringdb.NewAPI(
		peeringdb.WithAPIKey("your-api-key"),
	)
	ctx := context.Background()

	// Look up a network by its ASN
	network, err := api.GetASN(ctx, 201281)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Network: %s (AS%d)\n", network.Name, network.ASN)

	// List all facilities linked to this network
	for _, netfacID := range network.NetworkFacilitySet {
		netfac, err := api.GetNetworkFacilityByID(ctx, netfacID)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Printf("  Facility: %s (%s, %s)\n", netfac.Name, netfac.City, netfac.Country)
	}
}

More examples are available in the package documentation.

You can also find a real life example with the PeeringDB synchronization tool.

Documentation

Overview

Package peeringdb provides structures and functions to interact with the PeeringDB API. The API documentation is available here: https://www.peeringdb.com/apidocs/

The PeeringDB API is based on REST principles and returns data formatted in JSON. This package queries the API with the correct URL and parameters, parses the JSON response, and converts it into Go structures. Currently, this package only supports GET requests and cannot be used to modify any PeeringDB records.

All calls to the PeeringDB API use the "depth=1" parameter. This means that sets are expanded as integer slices instead of slices of structures, which speeds up the API processing time. To get the structures for a given set, you just need to iterate over the set and call the appropriate function to retrieve structures from IDs.

Example
api := NewAPI()
ctx := context.Background()

// Look for the organization given a name
search := url.Values{}
search.Set("name", "Guillaume Mazoyer")

// Get the organization
organizations, err := api.GetOrganization(ctx, search)
if err != nil {
	fmt.Println(err)
	return
}

if len(organizations) < 1 {
	fmt.Printf("No organization found with name '%s'\n", search.Get("name"))
	return
}

if len(organizations) > 1 {
	fmt.Printf("More than one organizations found with name '%s'\n",
		search.Get("name"))
	return
}

org := organizations[0]

// Find if there are networks linked to the organization
for _, networkID := range org.NetworkSet {
	network, err := api.GetNetworkByID(ctx, networkID)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Print(network.Name)
	}
}

Index

Examples

Constants

View Source
const Version = "0.1.0"

Variables

View Source
var (
	// ErrBuildingRequest is returned if the HTTP request to call the API
	// cannot be built as expected.
	ErrBuildingRequest = errors.New("error building request for peeringdb api")
	// ErrQueryingAPI is returned if there is an issue while making the
	// request to the API.
	ErrQueryingAPI = errors.New("error querying peeringdb api")
	// ErrRateLimitExceeded is returned if the API rate limit is exceeded.
	ErrRateLimitExceeded = errors.New("rate limit exceeded")
	// ErrInvalidID is returned when a resource ID is invalid (e.g. <= 0).
	ErrInvalidID = errors.New("invalid resource ID")
)

Functions

This section is empty.

Types

type API

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

API is the structure used to interact with the PeeringDB API.

func NewAPI

func NewAPI(opts ...Option) *API

NewAPI returns a new API instance configured with the given options.

func (*API) GetASN

func (api *API) GetASN(ctx context.Context, asn int) (*Network, error)

GetASN returns the Network matching the given AS number. If the AS number cannot be found, an error is returned.

Example
api := NewAPI()
as201281, err := api.GetASN(context.Background(), 201281)

if err != nil {
	fmt.Println(err.Error())
	return
}

fmt.Printf("Name: %s\n", as201281.Name)
fmt.Printf("ASN:  %d\n", as201281.ASN)

func (*API) GetAllCampuses

func (api *API) GetAllCampuses(ctx context.Context) ([]Campus, error)

GetAllCampuses returns all Campus structures available from the API.

func (*API) GetAllCarrierFacilities

func (api *API) GetAllCarrierFacilities(ctx context.Context) ([]CarrierFacility, error)

GetAllCarrierFacilities returns all CarrierFacility structures available from the API.

func (*API) GetAllCarriers

func (api *API) GetAllCarriers(ctx context.Context) ([]Carrier, error)

GetAllCarriers returns all Carrier structures available from the API.

func (*API) GetAllFacilities

func (api *API) GetAllFacilities(ctx context.Context) ([]Facility, error)

GetAllFacilities returns all Facility structures available from the API.

func (*API) GetAllInternetExchangeFacilities

func (api *API) GetAllInternetExchangeFacilities(ctx context.Context) ([]InternetExchangeFacility, error)

GetAllInternetExchangeFacilities returns all InternetExchangeFacility structures available from the API.

func (*API) GetAllInternetExchangeLANs

func (api *API) GetAllInternetExchangeLANs(ctx context.Context) ([]InternetExchangeLAN, error)

GetAllInternetExchangeLANs returns all InternetExchangeLAN structures available from the API.

func (*API) GetAllInternetExchangePrefixes

func (api *API) GetAllInternetExchangePrefixes(ctx context.Context) ([]InternetExchangePrefix, error)

GetAllInternetExchangePrefixes returns all InternetExchangePrefix structures available from the API.

func (*API) GetAllInternetExchanges

func (api *API) GetAllInternetExchanges(ctx context.Context) ([]InternetExchange, error)

GetAllInternetExchanges returns all InternetExchange structures available from the API.

func (*API) GetAllNetworkContacts

func (api *API) GetAllNetworkContacts(ctx context.Context) ([]NetworkContact, error)

GetAllNetworkContacts returns all NetworkContact structures available from the API.

func (*API) GetAllNetworkFacilities

func (api *API) GetAllNetworkFacilities(ctx context.Context) ([]NetworkFacility, error)

GetAllNetworkFacilities returns all NetworkFacility structures available from the API.

func (*API) GetAllNetworkInternetExchangeLANs

func (api *API) GetAllNetworkInternetExchangeLANs(ctx context.Context) ([]NetworkInternetExchangeLAN, error)

GetAllNetworkInternetExchangeLANs returns all NetworkInternetExchangeLAN structures available from the API.

func (*API) GetAllNetworks

func (api *API) GetAllNetworks(ctx context.Context) ([]Network, error)

GetAllNetworks returns all Network structures available from the API.

func (*API) GetAllOrganizations

func (api *API) GetAllOrganizations(ctx context.Context) ([]Organization, error)

GetAllOrganizations returns all Organization structures available from the API.

func (*API) GetCampus

func (api *API) GetCampus(ctx context.Context, search url.Values) ([]Campus, error)

GetCampus returns a slice of Campus structures matching the given search parameters.

func (*API) GetCampusByID

func (api *API) GetCampusByID(ctx context.Context, id int) (*Campus, error)

GetCampusByID returns the Campus matching the given ID, or nil if not found.

func (*API) GetCarrier

func (api *API) GetCarrier(ctx context.Context, search url.Values) ([]Carrier, error)

GetCarrier returns a slice of Carrier structures matching the given search parameters.

func (*API) GetCarrierByID

func (api *API) GetCarrierByID(ctx context.Context, id int) (*Carrier, error)

GetCarrierByID returns the Carrier matching the given ID, or nil if not found.

func (*API) GetCarrierFacility

func (api *API) GetCarrierFacility(ctx context.Context, search url.Values) ([]CarrierFacility, error)

GetCarrierFacility returns a slice of CarrierFacility structures matching the given search parameters.

func (*API) GetCarrierFacilityByID

func (api *API) GetCarrierFacilityByID(ctx context.Context, id int) (*CarrierFacility, error)

GetCarrierFacilityByID returns the CarrierFacility matching the given ID, or nil if not found.

func (*API) GetFacility

func (api *API) GetFacility(ctx context.Context, search url.Values) ([]Facility, error)

GetFacility returns a slice of Facility structures matching the given search parameters.

func (*API) GetFacilityByID

func (api *API) GetFacilityByID(ctx context.Context, id int) (*Facility, error)

GetFacilityByID returns the Facility matching the given ID, or nil if not found.

func (*API) GetInternetExchange

func (api *API) GetInternetExchange(ctx context.Context, search url.Values) ([]InternetExchange, error)

GetInternetExchange returns a slice of InternetExchange structures matching the given search parameters.

func (*API) GetInternetExchangeByID

func (api *API) GetInternetExchangeByID(ctx context.Context, id int) (*InternetExchange, error)

GetInternetExchangeByID returns the InternetExchange matching the given ID, or nil if not found.

func (*API) GetInternetExchangeFacility

func (api *API) GetInternetExchangeFacility(ctx context.Context, search url.Values) ([]InternetExchangeFacility, error)

GetInternetExchangeFacility returns a slice of InternetExchangeFacility structures matching the given search parameters.

func (*API) GetInternetExchangeFacilityByID

func (api *API) GetInternetExchangeFacilityByID(ctx context.Context, id int) (*InternetExchangeFacility, error)

GetInternetExchangeFacilityByID returns the InternetExchangeFacility matching the given ID, or nil if not found.

func (*API) GetInternetExchangeLAN

func (api *API) GetInternetExchangeLAN(ctx context.Context, search url.Values) ([]InternetExchangeLAN, error)

GetInternetExchangeLAN returns a slice of InternetExchangeLAN structures matching the given search parameters.

func (*API) GetInternetExchangeLANByID

func (api *API) GetInternetExchangeLANByID(ctx context.Context, id int) (*InternetExchangeLAN, error)

GetInternetExchangeLANByID returns the InternetExchangeLAN matching the given ID, or nil if not found.

func (*API) GetInternetExchangePrefix

func (api *API) GetInternetExchangePrefix(ctx context.Context, search url.Values) ([]InternetExchangePrefix, error)

GetInternetExchangePrefix returns a slice of InternetExchangePrefix structures matching the given search parameters.

func (*API) GetInternetExchangePrefixByID

func (api *API) GetInternetExchangePrefixByID(ctx context.Context, id int) (*InternetExchangePrefix, error)

GetInternetExchangePrefixByID returns the InternetExchangePrefix matching the given ID, or nil if not found.

func (*API) GetNetwork

func (api *API) GetNetwork(ctx context.Context, search url.Values) ([]Network, error)

GetNetwork returns a slice of Network structures matching the given search parameters.

func (*API) GetNetworkByID

func (api *API) GetNetworkByID(ctx context.Context, id int) (*Network, error)

GetNetworkByID returns the Network matching the given ID, or nil if not found.

func (*API) GetNetworkContact

func (api *API) GetNetworkContact(ctx context.Context, search url.Values) ([]NetworkContact, error)

GetNetworkContact returns a slice of NetworkContact structures matching the given search parameters.

func (*API) GetNetworkContactByID

func (api *API) GetNetworkContactByID(ctx context.Context, id int) (*NetworkContact, error)

GetNetworkContactByID returns the NetworkContact matching the given ID, or nil if not found.

func (*API) GetNetworkFacility

func (api *API) GetNetworkFacility(ctx context.Context, search url.Values) ([]NetworkFacility, error)

GetNetworkFacility returns a slice of NetworkFacility structures matching the given search parameters.

func (*API) GetNetworkFacilityByID

func (api *API) GetNetworkFacilityByID(ctx context.Context, id int) (*NetworkFacility, error)

GetNetworkFacilityByID returns the NetworkFacility matching the given ID, or nil if not found.

func (*API) GetNetworkInternetExchangeLAN

func (api *API) GetNetworkInternetExchangeLAN(ctx context.Context, search url.Values) ([]NetworkInternetExchangeLAN, error)

GetNetworkInternetExchangeLAN returns a slice of NetworkInternetExchangeLAN structures matching the given search parameters.

func (*API) GetNetworkInternetExchangeLANByID

func (api *API) GetNetworkInternetExchangeLANByID(ctx context.Context, id int) (*NetworkInternetExchangeLAN, error)

GetNetworkInternetExchangeLANByID returns the NetworkInternetExchangeLAN matching the given ID, or nil if not found.

func (*API) GetOrganization

func (api *API) GetOrganization(ctx context.Context, search url.Values) ([]Organization, error)

GetOrganization returns a slice of Organization structures matching the given search parameters.

func (*API) GetOrganizationByID

func (api *API) GetOrganizationByID(ctx context.Context, id int) (*Organization, error)

GetOrganizationByID returns the Organization matching the given ID, or nil if not found.

type Campus

type Campus struct {
	ID               int           `json:"id"`
	OrganizationID   int           `json:"org_id"`
	OrganizationName string        `json:"org_name"`
	Organization     Organization  `json:"organization,omitempty"`
	Name             string        `json:"name"`
	NameLong         string        `json:"name_long"`
	AKA              string        `json:"aka"`
	Website          string        `json:"website"`
	Notes            string        `json:"notes"`
	Created          time.Time     `json:"created"`
	Updated          time.Time     `json:"updated"`
	Status           string        `json:"status"`
	City             string        `json:"city"`
	Country          string        `json:"country"`
	State            string        `json:"state"`
	Zipcode          string        `json:"zipcode"`
	FacilitySet      []int         `json:"fac_set"`
	SocialMedia      []SocialMedia `json:"social_media"`
}

Campus is the representation of a site where facilities are.

type Carrier

type Carrier struct {
	ID               int           `json:"id"`
	OrganizationID   int           `json:"org_id"`
	OrganizationName string        `json:"org_name"`
	Organization     Organization  `json:"organization,omitempty"`
	Name             string        `json:"name"`
	AKA              string        `json:"aka"`
	NameLong         string        `json:"name_long"`
	Website          string        `json:"website"`
	Notes            string        `json:"notes"`
	Created          time.Time     `json:"created"`
	Updated          time.Time     `json:"updated"`
	Status           string        `json:"status"`
	SocialMedia      []SocialMedia `json:"social_media"`
}

Carrier is the representation of a network able to provide transport from one facility to another.

type CarrierFacility

type CarrierFacility struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	CarrierID  int       `json:"carrier_id"`
	Carrier    Carrier   `json:"carrier,omitempty"`
	FacilityID int       `json:"fac_id"`
	Facility   Facility  `json:"fac,omitempty"`
	Created    time.Time `json:"created"`
	Updated    time.Time `json:"updated"`
	Status     string    `json:"status"`
}

CarrierFacility links a Carrier with a Facility, indicating in which facilities a carrier operates.

type Facility

type Facility struct {
	ID                        int           `json:"id"`
	OrganizationID            int           `json:"org_id"`
	OrganizationName          string        `json:"org_name"`
	Organization              Organization  `json:"organization,omitempty"`
	CampusID                  int           `json:"campus_id"`
	Campus                    Campus        `json:"campus,omitempty"`
	Name                      string        `json:"name"`
	AKA                       string        `json:"aka"`
	NameLong                  string        `json:"name_long"`
	Website                   string        `json:"website"`
	CLLI                      string        `json:"clli"`
	Rencode                   string        `json:"rencode"`
	Npanxx                    string        `json:"npanxx"`
	Notes                     string        `json:"notes"`
	NetCount                  int           `json:"net_count"`
	IXCount                   int           `json:"ix_count"`
	CarrierCount              int           `json:"carrier_count"`
	SalesEmail                string        `json:"sales_email"`
	SalesPhone                string        `json:"sales_phone"`
	TechEmail                 string        `json:"tech_email"`
	TechPhone                 string        `json:"tech_phone"`
	AvailableVoltageServices  []string      `json:"available_voltage_services"`
	DiverseServingSubstations bool          `json:"diverse_serving_substations"`
	Property                  string        `json:"property"`
	RegionContinent           string        `json:"region_continent"`
	StatusDashboard           string        `json:"status_dashboard"`
	Created                   time.Time     `json:"created"`
	Updated                   time.Time     `json:"updated"`
	Status                    string        `json:"status"`
	Address1                  string        `json:"address1"`
	Address2                  string        `json:"address2"`
	City                      string        `json:"city"`
	Country                   string        `json:"country"`
	State                     string        `json:"state"`
	Zipcode                   string        `json:"zipcode"`
	Floor                     string        `json:"floor"`
	Suite                     string        `json:"suite"`
	Latitude                  float64       `json:"latitude"`
	Longitude                 float64       `json:"longitude"`
	SocialMedia               []SocialMedia `json:"social_media"`
}

Facility is the representation of a location where network operators and Internet exchange points are located. Most of the time you know a facility as a datacenter.

type InternetExchange

type InternetExchange struct {
	ID                     int           `json:"id"`
	OrganizationID         int           `json:"org_id"`
	Organization           Organization  `json:"org,omitempty"`
	Name                   string        `json:"name"`
	AKA                    string        `json:"aka"`
	NameLong               string        `json:"name_long"`
	City                   string        `json:"city"`
	Country                string        `json:"country"`
	RegionContinent        string        `json:"region_continent"`
	Media                  string        `json:"media"`
	Notes                  string        `json:"notes"`
	ProtoUnicast           bool          `json:"proto_unicast"`
	ProtoMulticast         bool          `json:"proto_multicast"`
	ProtoIPv6              bool          `json:"proto_ipv6"`
	Website                string        `json:"website"`
	URLStats               string        `json:"url_stats"`
	TechEmail              string        `json:"tech_email"`
	TechPhone              string        `json:"tech_phone"`
	PolicyEmail            string        `json:"policy_email"`
	PolicyPhone            string        `json:"policy_phone"`
	SalesPhone             string        `json:"sales_phone"`
	SalesEmail             string        `json:"sales_email"`
	FacilitySet            []int         `json:"fac_set"`
	InternetExchangeLANSet []int         `json:"ixlan_set"`
	NetworkCount           int           `json:"net_count"`
	FacilityCount          int           `json:"fac_count"`
	IxfNetCount            int           `json:"ixf_net_count"`
	IxfLastImport          time.Time     `json:"ixf_last_import"`
	IxfImportRequest       time.Time     `json:"ixf_import_request"`
	IxfImportRequestStatus string        `json:"ixf_import_request_status"`
	ServiceLevel           string        `json:"service_level"`
	Terms                  string        `json:"terms"`
	StatusDashboard        string        `json:"status_dashboard"`
	Created                time.Time     `json:"created"`
	Updated                time.Time     `json:"updated"`
	Status                 string        `json:"status"`
	SocialMedia            []SocialMedia `json:"social_media"`
}

InternetExchange represents an Internet exchange point. It is directly linked to the Organization that manages the IX.

type InternetExchangeFacility

type InternetExchangeFacility struct {
	ID                 int              `json:"id"`
	Name               string           `json:"name"`
	City               string           `json:"city"`
	Country            string           `json:"country"`
	InternetExchangeID int              `json:"ix_id"`
	InternetExchange   InternetExchange `json:"ix,omitempty"`
	FacilityID         int              `json:"fac_id"`
	Facility           Facility         `json:"fac,omitempty"`
	Created            time.Time        `json:"created"`
	Updated            time.Time        `json:"updated"`
	Status             string           `json:"status"`
}

InternetExchangeFacility links an InternetExchange with a Facility, indicating where an IX can be found or what IXs are in a given facility.

type InternetExchangeLAN

type InternetExchangeLAN struct {
	ID                         int              `json:"id"`
	InternetExchangeID         int              `json:"ix_id"`
	InternetExchange           InternetExchange `json:"ix,omitempty"`
	Name                       string           `json:"name"`
	Description                string           `json:"descr"`
	MTU                        int              `json:"mtu"`
	Dot1QSupport               bool             `json:"dot1q_support"`
	RouteServerASN             int              `json:"rs_asn"`
	ARPSponge                  string           `json:"arp_sponge"`
	NetworkSet                 []int            `json:"net_set"`
	InternetExchangePrefixSet  []int            `json:"ixpfx_set"`
	IXFIXPMemberListURL        string           `json:"ixf_ixp_member_list_url"`
	IXFIXPMemberListURLVisible string           `json:"ixf_ixp_member_list_url_visible"`
	IXFIXPImportEnabled        bool             `json:"ixf_ixp_import_enabled"`
	Created                    time.Time        `json:"created"`
	Updated                    time.Time        `json:"updated"`
	Status                     string           `json:"status"`
}

InternetExchangeLAN represents one of the networks (LANs) of an Internet exchange point, with details like MTU, VLAN support, etc.

type InternetExchangePrefix

type InternetExchangePrefix struct {
	ID                    int                 `json:"id"`
	InternetExchangeLANID int                 `json:"ixlan_id"`
	InternetExchangeLAN   InternetExchangeLAN `json:"ixlan,omitempty"`
	Protocol              string              `json:"protocol"`
	Prefix                string              `json:"prefix"`
	InDFZ                 bool                `json:"in_dfz"`
	Created               time.Time           `json:"created"`
	Updated               time.Time           `json:"updated"`
	Status                string              `json:"status"`
}

InternetExchangePrefix represents a prefix used by an Internet exchange point, directly linked to an InternetExchangeLAN.

type Network

type Network struct {
	ID                                int           `json:"id"`
	OrganizationID                    int           `json:"org_id"`
	Organization                      Organization  `json:"org,omitempty"`
	Name                              string        `json:"name"`
	AKA                               string        `json:"aka"`
	NameLong                          string        `json:"name_long"`
	Website                           string        `json:"website"`
	ASN                               int           `json:"asn"`
	LookingGlass                      string        `json:"looking_glass"`
	RouteServer                       string        `json:"route_server"`
	IRRASSet                          string        `json:"irr_as_set"`
	InfoType                          string        `json:"info_type"`
	InfoTypes                         []string      `json:"info_types"`
	InfoPrefixes4                     int           `json:"info_prefixes4"`
	InfoPrefixes6                     int           `json:"info_prefixes6"`
	InfoTraffic                       string        `json:"info_traffic"`
	InfoRatio                         string        `json:"info_ratio"`
	InfoScope                         string        `json:"info_scope"`
	InfoUnicast                       bool          `json:"info_unicast"`
	InfoMulticast                     bool          `json:"info_multicast"`
	InfoIPv6                          bool          `json:"info_ipv6"`
	InfoNeverViaRouteServers          bool          `json:"info_never_via_route_servers"`
	InternetExchangeCount             int           `json:"ix_count"`
	FacilityCount                     int           `json:"fac_count"`
	Notes                             string        `json:"notes"`
	NetworkInternetExchangeLANUpdated time.Time     `json:"netixlan_updated"`
	NetworkFacilityUpdated            time.Time     `json:"netfac_updated"`
	NetworkContactUpdated             time.Time     `json:"poc_updated"`
	PolicyURL                         string        `json:"policy_url"`
	PolicyGeneral                     string        `json:"policy_general"`
	PolicyLocations                   string        `json:"policy_locations"`
	PolicyRatio                       bool          `json:"policy_ratio"`
	PolicyContracts                   string        `json:"policy_contracts"`
	NetworkFacilitySet                []int         `json:"netfac_set"`
	NetworkInternetExchangeLANSet     []int         `json:"netixlan_set"`
	NetworkContactSet                 []int         `json:"poc_set"`
	AllowIXPUpdate                    bool          `json:"allow_ixp_update"`
	StatusDashboard                   string        `json:"status_dashboard"`
	RIRStatus                         string        `json:"rir_status"`
	RIRStatusUpdated                  time.Time     `json:"rir_status_updated"`
	Created                           time.Time     `json:"created"`
	Updated                           time.Time     `json:"updated"`
	Status                            string        `json:"status"`
	SocialMedia                       []SocialMedia `json:"social_media"`
}

Network represents an Autonomous System identified by an AS number and other details. It belongs to an Organization, contains one or more NetworkContact, and is part of several Facility and InternetExchangeLAN.

type NetworkContact

type NetworkContact struct {
	ID        int       `json:"id"`
	NetworkID int       `json:"net_id"`
	Network   Network   `json:"net"`
	Role      string    `json:"role"`
	Visible   string    `json:"visible"`
	Name      string    `json:"name"`
	Phone     string    `json:"phone"`
	Email     string    `json:"email"`
	URL       string    `json:"url"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
	Status    string    `json:"status"`
}

NetworkContact represents a contact for a network.

type NetworkFacility

type NetworkFacility struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	City       string    `json:"city"`
	Country    string    `json:"country"`
	NetworkID  int       `json:"net_id"`
	Network    Network   `json:"net,omitempty"`
	FacilityID int       `json:"fac_id"`
	Facility   Facility  `json:"fac,omitempty"`
	LocalASN   int       `json:"local_asn"`
	Created    time.Time `json:"created"`
	Updated    time.Time `json:"updated"`
	Status     string    `json:"status"`
}

NetworkFacility links a Network with a Facility, indicating where a network is located. It can be used to search common facilities between several networks to know where they can interconnect directly.

type NetworkInternetExchangeLAN

type NetworkInternetExchangeLAN struct {
	ID                     int                 `json:"id"`
	NetworkID              int                 `json:"net_id"`
	Network                Network             `json:"net,omitempty"`
	InternetExchangeID     int                 `json:"ix_id"`
	InternetExchange       InternetExchange    `json:"ix,omitempty"`
	Name                   string              `json:"name"`
	InternetExchangeLANID  int                 `json:"ixlan_id"`
	InternetExchangeLAN    InternetExchangeLAN `json:"ixlan,omitempty"`
	Notes                  string              `json:"notes"`
	Speed                  int                 `json:"speed"`
	ASN                    int                 `json:"asn"`
	IPAddr4                string              `json:"ipaddr4"`
	IPAddr6                string              `json:"ipaddr6"`
	IsRSPeer               bool                `json:"is_rs_peer"`
	BFDSupport             bool                `json:"bfd_support"`
	Operational            bool                `json:"operational"`
	NetworkSideID          int                 `json:"net_side_id"`
	InternetExchangeSideID int                 `json:"ix_side_id"`
	Created                time.Time           `json:"created"`
	Updated                time.Time           `json:"updated"`
	Status                 string              `json:"status"`
}

NetworkInternetExchangeLAN represents a network's connection to an Internet exchange LAN. It can be used to find common IX LANs between several networks.

type Option

type Option func(*API)

Option configures an API instance.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey sets the API key for authentication.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithURL

func WithURL(u string) Option

WithURL sets a custom API endpoint URL.

type Organization

type Organization struct {
	ID                  int           `json:"id"`
	Name                string        `json:"name"`
	AKA                 string        `json:"aka"`
	NameLong            string        `json:"name_long"`
	Website             string        `json:"website"`
	Notes               string        `json:"notes"`
	Require2FA          bool          `json:"require_2fa"`
	NetworkSet          []int         `json:"net_set"`
	FacilitySet         []int         `json:"fac_set"`
	InternetExchangeSet []int         `json:"ix_set"`
	CarrierSet          []int         `json:"carrier_set"`
	CampusSet           []int         `json:"campus_set"`
	Address1            string        `json:"address1"`
	Address2            string        `json:"address2"`
	City                string        `json:"city"`
	Country             string        `json:"country"`
	State               string        `json:"state"`
	Zipcode             string        `json:"zipcode"`
	Floor               string        `json:"floor"`
	Suite               string        `json:"suite"`
	Latitude            float64       `json:"latitude"`
	Longitude           float64       `json:"longitude"`
	Created             time.Time     `json:"created"`
	Updated             time.Time     `json:"updated"`
	Status              string        `json:"status"`
	SocialMedia         []SocialMedia `json:"social_media"`
}

Organization represents an enterprise linked to networks, facilities, and internet exchange points.

type SocialMedia

type SocialMedia struct {
	Service    string `json:"service"`
	Identifier string `json:"identifier"`
}

SocialMedia represents a social media link for a PeeringDB entity.

Jump to

Keyboard shortcuts

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