BGPView

Gem Version Build Status Coverage Status Maintainability Test Coverage

A Ruby wrapper for BGPView API

Installation

Add this line to your application's Gemfile:

gem 'bgpview'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bgpview

Usage

require 'bgpview'

ASN

as7511 = BGPView.asn(7511)        # BGPView::Asn instance
as7511.name                       # => "SYNAPSE"
as7511.website                    # => "https://www.synapse.jp"
as7511.traffic_estimation         # => "5-10Gbps"

ASN Prefixes

prefixes = as7511.prefixes        # BGPView::Prefixes instance
prefixes.ipv4                     # array of IPv4 prefixes
prefixes.ipv6                     # array of IPv6 prefixes
prefixes.ipv4.map(&:prefix)       # => ["103.53.120.0/22", "110.92.32.0/19", ...]
prefixes.ipv6.map(&:prefix)       # => ["2401:c800::/32"]

ASN Peers

peers = as7511.peers              # BGPView::Peers instance
peers.ipv4                        # array of IPv4 peers BGPView::Asn instances
peers.ipv6                        # array of IPv6 peers BGPView::Asn instances
peers.ipv4.map(&:number)          # => [7514, 8220, 17676, 45687, 24482, 7517, 4637, 6939, 23815, 64050]
peers.ipv6.map(&:name             # => ["HURRICANE", "MEX", "SGGS-AS-AP", "GIGAINFRA", "COLT", "FPT-AS-AP"]

ASN Upstreams

upstreams = as7511.upstreams      # BGPView::Upstreams instance
upstreams.ipv4                    # array of IPv4 upstream instances
upstreams.ipv6                    # array of IPv6 upstream instances
upstreams.ipv4.map(&:number)      # => [7514, 17676]
upstreams.ipv6.map(&:name)        # => ["MEX", "GIGAINFRA"]

ASN Downstreams

downstreams = as7511.downstreams  # BGPView::Downstreams instance
downstreams.ipv4                  # array of IPv4 downstream instances
downstreams.ipv6                  # array of IPv6 downstream instances
downstreams.ipv4.map(&:number)    # => [7517, 45687]
downstreams.ipv6.map(&:name)      # => []

Contributing

  1. Fork it ( https://github.com/ryonkn/bgpview-ruby-gem/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Bgpview project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.