A Ruby wrapper for BGPView API
Add this line to your application's Gemfile:
gem 'bgpview'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bgpview
require 'bgpview'
as7511 = BGPView.asn(7511) # BGPView::Asn instance
as7511.name # => "SYNAPSE"
as7511.website # => "https://www.synapse.jp"
as7511.traffic_estimation # => "5-10Gbps"
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"]
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"]
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"]
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) # => []
- Fork it ( https://github.com/ryonkn/bgpview-ruby-gem/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Bgpview project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.