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.
There are two levels of structures in this package. The first level represents the top level of the JSON returned by the API. These structures are named *Resource. They all have a Meta field containing metadata returned by the API, and a Data field which is an array of the second level structures.
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.
For example, when requesting one or more objects from the PeeringDB API, the response is always formatted in the same way: first comes the metadata, then the data. The data is always in an array since it might contain more than one object. When asking the API for a network object (called Net and represented by the struct of the same name), this package parses the first level as a NetResource structure. This structure contains metadata in its Meta field (if there is any) and Net structures in the Data field (as an array).
Example ¶
api := NewAPI() // Look for the organization given a name search := make(map[string]interface{}) search["name"] = "Guillaume Mazoyer" // Get the organization, pointer to slice returned organizations, err := api.GetOrganization(search) // If an error as occurred, print it if err != nil { fmt.Println(err) return } // No organization found if len(*organizations) < 1 { fmt.Printf("No organization found with name '%s'\n", search["name"]) return } // Several organizations found if len(*organizations) > 1 { fmt.Printf("More than one organizations found with name '%s'\n", search["name"]) return } // Get the first found organization org := (*organizations)[0] // Find if there are networks linked to the organization if len(org.NetworkSet) > 0 { // For each network for _, networkID := range org.NetworkSet { // Get the details and print it network, err := api.GetNetworkByID(networkID) if err != nil { fmt.Println(err) } else { fmt.Print(network.Name) } } }
Output: Guillaume Mazoyer
Index ¶
- Variables
- type API
- func (api *API) GetASN(asn int) (*Network, error)
- func (api *API) GetAllCampuses() (*[]Campus, error)
- func (api *API) GetAllCarrierFacilities() (*[]CarrierFacility, error)
- func (api *API) GetAllCarriers() (*[]Carrier, error)
- func (api *API) GetAllFacilities() (*[]Facility, error)
- func (api *API) GetAllInternetExchangeFacilities() (*[]InternetExchangeFacility, error)
- func (api *API) GetAllInternetExchangeLANs() (*[]InternetExchangeLAN, error)
- func (api *API) GetAllInternetExchangePrefixes() (*[]InternetExchangePrefix, error)
- func (api *API) GetAllInternetExchanges() (*[]InternetExchange, error)
- func (api *API) GetAllNetworkContacts() (*[]NetworkContact, error)
- func (api *API) GetAllNetworkFacilities() (*[]NetworkFacility, error)
- func (api *API) GetAllNetworkInternetExchangeLANs() (*[]NetworkInternetExchangeLAN, error)
- func (api *API) GetAllNetworks() (*[]Network, error)
- func (api *API) GetAllOrganizations() (*[]Organization, error)
- func (api *API) GetCampus(search map[string]interface{}) (*[]Campus, error)
- func (api *API) GetCampusByID(id int) (*Campus, error)
- func (api *API) GetCarrier(search map[string]interface{}) (*[]Carrier, error)
- func (api *API) GetCarrierByID(id int) (*Carrier, error)
- func (api *API) GetCarrierFacility(search map[string]interface{}) (*[]CarrierFacility, error)
- func (api *API) GetCarrierFacilityByID(id int) (*CarrierFacility, error)
- func (api *API) GetFacility(search map[string]interface{}) (*[]Facility, error)
- func (api *API) GetFacilityByID(id int) (*Facility, error)
- func (api *API) GetInternetExchange(search map[string]interface{}) (*[]InternetExchange, error)
- func (api *API) GetInternetExchangeByID(id int) (*InternetExchange, error)
- func (api *API) GetInternetExchangeFacility(search map[string]interface{}) (*[]InternetExchangeFacility, error)
- func (api *API) GetInternetExchangeFacilityByID(id int) (*InternetExchangeFacility, error)
- func (api *API) GetInternetExchangeLAN(search map[string]interface{}) (*[]InternetExchangeLAN, error)
- func (api *API) GetInternetExchangeLANByID(id int) (*InternetExchangeLAN, error)
- func (api *API) GetInternetExchangePrefix(search map[string]interface{}) (*[]InternetExchangePrefix, error)
- func (api *API) GetInternetExchangePrefixByID(id int) (*InternetExchangePrefix, error)
- func (api *API) GetNetwork(search map[string]interface{}) (*[]Network, error)
- func (api *API) GetNetworkByID(id int) (*Network, error)
- func (api *API) GetNetworkContact(search map[string]interface{}) (*[]NetworkContact, error)
- func (api *API) GetNetworkContactByID(id int) (*NetworkContact, error)
- func (api *API) GetNetworkFacility(search map[string]interface{}) (*[]NetworkFacility, error)
- func (api *API) GetNetworkFacilityByID(id int) (*NetworkFacility, error)
- func (api *API) GetNetworkInternetExchangeLAN(search map[string]interface{}) (*[]NetworkInternetExchangeLAN, error)
- func (api *API) GetNetworkInternetExchangeLANByID(id int) (*NetworkInternetExchangeLAN, error)
- func (api *API) GetOrganization(search map[string]interface{}) (*[]Organization, error)
- func (api *API) GetOrganizationByID(id int) (*Organization, error)
- type Campus
- type Carrier
- type CarrierFacility
- type Facility
- type InternetExchange
- type InternetExchangeFacility
- type InternetExchangeLAN
- type InternetExchangePrefix
- type Network
- type NetworkContact
- type NetworkFacility
- type NetworkInternetExchangeLAN
- type Organization
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBuildingURL is the error that will be returned if the URL to call the // API cannot be built as expected. ErrBuildingURL = errors.New("error while building the URL to call the peeringdb api") // ErrBuildingRequest is the error that will be returned if the HTTP // request to call the API cannot be built as expected. ErrBuildingRequest = errors.New("error while building the request to send to the peeringdb api") // ErrQueryingAPI is the error that will be returned if there is an issue // while making the request to the API. ErrQueryingAPI = errors.New("error while querying peeringdb api") // ErrRateLimitExceeded is the error that will be returned if the API rate // limit is exceeded. ErrRateLimitExceeded = errors.New("rate limit exceeded") )
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. This is the main structure of this package. All functions to make API calls are associated to this structure.
func NewAPI ¶
func NewAPI() *API
NewAPI returns a pointer to a new API structure. It uses the publicly known PeeringDB API endpoint.
func NewAPIFromURL ¶
NewAPIFromURL returns a pointer to a new API structure from a given URL. If the given URL is empty it will use the default PeeringDB API URL.
func NewAPIFromURLWithAPIKey ¶
NewAPIFromURLWithAPIKey returns a pointer to a new API structure from a given URL. If the given URL is empty it will use the default PeeringDB API URL. It will use the provided API key for authentication while making API calls.
func NewAPIWithAPIKey ¶
NewAPIWithAuth returns a pointer to a new API structure. The API will point to the publicly known PeeringDB API endpoint and will use the provided API key for authentication while making API calls.
func (*API) GetASN ¶
GetASN is a simplified function to get PeeringDB details about a given AS number. It basically gets the Net object matching the AS number. If the AS number cannot be found, nil is returned.
Example ¶
api := NewAPI() as201281, err := api.GetASN(201281) if err != nil { fmt.Println(err.Error()) return } fmt.Printf("Name: %s\n", as201281.Name) fmt.Printf("ASN: %d\n", as201281.ASN)
Output: Name: Guillaume Mazoyer ASN: 201281
func (*API) GetAllCampuses ¶
GetAllCampuses returns a pointer to a slice of Campus structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllCarrierFacilities ¶
func (api *API) GetAllCarrierFacilities() (*[]CarrierFacility, error)
GetAllCarrierFacilities returns a pointer to a slice of CarrierFacility structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllCarriers ¶
GetAllCarriers returns a pointer to a slice of Carrier structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllFacilities ¶
GetAllFacilities returns a pointer to a slice of Facility structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllInternetExchangeFacilities ¶
func (api *API) GetAllInternetExchangeFacilities() (*[]InternetExchangeFacility, error)
GetAllInternetExchangeFacilities returns a pointer to a slice of InternetExchangeFacility structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllInternetExchangeLANs ¶
func (api *API) GetAllInternetExchangeLANs() (*[]InternetExchangeLAN, error)
GetAllInternetExchangeLANs returns a pointer to a slice of InternetExchangeLAN structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllInternetExchangePrefixes ¶
func (api *API) GetAllInternetExchangePrefixes() (*[]InternetExchangePrefix, error)
GetAllInternetExchangePrefixes returns a pointer to a slice of InternetExchangePrefix structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllInternetExchanges ¶
func (api *API) GetAllInternetExchanges() (*[]InternetExchange, error)
GetAllInternetExchanges returns a pointer to a slice of InternetExchange structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllNetworkContacts ¶
func (api *API) GetAllNetworkContacts() (*[]NetworkContact, error)
GetAllNetworkContacts returns a pointer to a slice of NetworkContact structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllNetworkFacilities ¶
func (api *API) GetAllNetworkFacilities() (*[]NetworkFacility, error)
GetAllNetworkFacilities returns a pointer to a slice of NetworkFacility structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllNetworkInternetExchangeLANs ¶
func (api *API) GetAllNetworkInternetExchangeLANs() (*[]NetworkInternetExchangeLAN, error)
GetAllNetworkInternetExchangeLANs returns a pointer to a slice of NetworkInternetExchangeLAN structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllNetworks ¶
GetAllNetworks returns a pointer to a slice of Network structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetAllOrganizations ¶
func (api *API) GetAllOrganizations() (*[]Organization, error)
GetAllOrganizations returns a pointer to a slice of Organization structures that the PeeringDB API can provide. If an error occurs, the returned error will be non-nil. The can be nil if no object could be found.
func (*API) GetCampus ¶
GetCampus returns a pointer to a slice of Campus structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetCampusByID ¶
GetCampusByID returns a pointer to a Campus structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetCarrier ¶
GetCarrier returns a pointer to a slice of Carrier structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetCarrierByID ¶
GetCarrierByID returns a pointer to a Carrier structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetCarrierFacility ¶
func (api *API) GetCarrierFacility(search map[string]interface{}) (*[]CarrierFacility, error)
GetCarrierFacility returns a pointer to a slice of CarrierFacility structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetCarrierFacilityByID ¶
func (api *API) GetCarrierFacilityByID(id int) (*CarrierFacility, error)
GetCarrierFacilityByID returns a pointer to a CarrierFacility structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetFacility ¶
GetFacility returns a pointer to a slice of Facility structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetFacilityByID ¶
GetFacilityByID returns a pointer to a Facility structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetInternetExchange ¶
func (api *API) GetInternetExchange(search map[string]interface{}) (*[]InternetExchange, error)
GetInternetExchange returns a pointer to a slice of InternetExchange structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetInternetExchangeByID ¶
func (api *API) GetInternetExchangeByID(id int) (*InternetExchange, error)
GetInternetExchangeByID returns a pointer to a InternetExchange structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetInternetExchangeFacility ¶
func (api *API) GetInternetExchangeFacility(search map[string]interface{}) (*[]InternetExchangeFacility, error)
GetInternetExchangeFacility returns a pointer to a slice of InternetExchangeFacility structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetInternetExchangeFacilityByID ¶
func (api *API) GetInternetExchangeFacilityByID(id int) (*InternetExchangeFacility, error)
GetInternetExchangeFacilityByID returns a pointer to a InternetExchangeFacility structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetInternetExchangeLAN ¶
func (api *API) GetInternetExchangeLAN(search map[string]interface{}) (*[]InternetExchangeLAN, error)
GetInternetExchangeLAN returns a pointer to a slice of InternetExchangeLAN structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetInternetExchangeLANByID ¶
func (api *API) GetInternetExchangeLANByID(id int) (*InternetExchangeLAN, error)
GetInternetExchangeLANByID returns a pointer to a InternetExchangeLAN structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetInternetExchangePrefix ¶
func (api *API) GetInternetExchangePrefix(search map[string]interface{}) (*[]InternetExchangePrefix, error)
GetInternetExchangePrefix returns a pointer to a slice of InternetExchangePrefix structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetInternetExchangePrefixByID ¶
func (api *API) GetInternetExchangePrefixByID(id int) (*InternetExchangePrefix, error)
GetInternetExchangePrefixByID returns a pointer to a InternetExchangePrefix structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetNetwork ¶
GetNetwork returns a pointer to a slice of Network structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetNetworkByID ¶
GetNetworkByID returns a pointer to a Network structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetNetworkContact ¶
func (api *API) GetNetworkContact(search map[string]interface{}) (*[]NetworkContact, error)
GetNetworkContact returns a pointer to a slice of NetworkContact structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetNetworkContactByID ¶
func (api *API) GetNetworkContactByID(id int) (*NetworkContact, error)
GetNetworkContactByID returns a pointer to a NetworkContact structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetNetworkFacility ¶
func (api *API) GetNetworkFacility(search map[string]interface{}) (*[]NetworkFacility, error)
GetNetworkFacility returns a pointer to a slice of NetworkFacility structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetNetworkFacilityByID ¶
func (api *API) GetNetworkFacilityByID(id int) (*NetworkFacility, error)
GetNetworkFacilityByID returns a pointer to a NetworkFacility structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetNetworkInternetExchangeLAN ¶
func (api *API) GetNetworkInternetExchangeLAN(search map[string]interface{}) (*[]NetworkInternetExchangeLAN, error)
GetNetworkInternetExchangeLAN returns a pointer to a slice of NetworkInternetExchangeLAN structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetNetworkInternetExchangeLANByID ¶
func (api *API) GetNetworkInternetExchangeLANByID(id int) (*NetworkInternetExchangeLAN, error)
GetNetworkInternetExchangeLANByID returns a pointer to a NetworkInternetExchangeLAN structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
func (*API) GetOrganization ¶
func (api *API) GetOrganization(search map[string]interface{}) (*[]Organization, error)
GetOrganization returns a pointer to a slice of Organization structures that the PeeringDB API can provide matching the given search parameters map. If an error occurs, the returned error will be non-nil. The returned value can be nil if no object could be found.
func (*API) GetOrganizationByID ¶
func (api *API) GetOrganizationByID(id int) (*Organization, error)
GetOrganizationByID returns a pointer to a Organization structure that matches the given ID. If the ID is lesser than 0, it will return nil. The returned error will be non-nil if an issue as occurred while trying to query the API. If for some reasons the API returns more than one object for the given ID (but it must not) only the first will be used for the returned value.
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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `json:"social_media"` }
Carrier is the representation of a network able to provider 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 is a structure used to link an Carrier structure with a Facility structure. It helps to know 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"` 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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `json:"social_media"` }
InternetExchange is a structure representing an Internet exchange point. It is directly linked to the Organization that manage 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 is a structure used to link an InternetExchange structure with a Facility structure. It helps to know where an Internet exchange points can be found, or what Internet exchange points can be found 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 is a structure representing the one of the network (LAN) of an Internet exchange points. It contains details about the LAN like the 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 is a structure representing the prefix used by an Internet exchange point. It is 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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `json:"social_media"` }
Network is a structure representing a network. Basically, a network is 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 is a structure used to link a Network with a Facility. It helps to know where a network is located (it can be in several facilities). For example, it can be used to search common facilities between several networks to know where they can interconnect themselves 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 is a structure allowing to know to which InternetExchangeLAN a network is connected. It can be used, for example, to know what are the common Internet exchange LANs between several networks.
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 []struct { Service string `json:"service"` Identifier string `json:"identifier"` } `json:"social_media"` }
Organization is a structure representing an Organization. An organization can be seen as an enterprise linked to networks, facilities and internet exchange points.