Sha256: fe66277ab7cadd371ea7c76a5393ff5eaba53e594198332cfc7484abb5897721

Contents?: true

Size: 848 Bytes

Versions: 46

Compression:

Stored size: 848 Bytes

Contents

#!/usr/bin/ruby -w

$: << File.dirname(__FILE__) + "/../lib"

require 'ifconfig'
require 'pp'

ifcfg = IO.readlines('../ifconfig_examples/freebsd.txt').join
netstat = IO.readlines('../ifconfig_examples/freebsd_netstat.txt').join

ifconfig = IfconfigWrapper.new('BSD',ifcfg,netstat).parse

puts "Interfaces: (ifconfig.interfaces)"
pp ifconfig.interfaces

puts "\nrl0 mac address: (ifconfig['rl0'].mac)"
pp ifconfig['rl0'].mac

puts "\nIpV4 addresses on rl0: (ifconfig['rl0'].addresses('inet'))"
pp ifconfig['rl0'].addresses('inet')

puts "\nAll addresses reported by ifconfig: (ifconfig.addresses)"
pp ifconfig.addrs_with_type

puts "\nList of address types for rl0: (ifconfig['rl0'].addr_types)"
pp ifconfig['rl0'].addr_types

puts "\niconfig.each { block }"
ifconfig.each do |iface|
  pp iface.name if iface.up?
end

puts
s = ifconfig.to_s
puts s

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
aaalex-ruby-ifconfig-1.2.1 test/test_bsd.rb
aaalex-ruby-ifconfig-1.2.2 test/test_bsd.rb
aaalex-ruby-ifconfig-1.2.3 test/test_bsd.rb
trema-0.4.7 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.6 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.5 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.4 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.3 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.2 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.1 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.4.0 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.21 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.20 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.19 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.18 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.17 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.16 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.15 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.14 vendor/ruby-ifconfig-1.2/test/test_bsd.rb
trema-0.3.13 vendor/ruby-ifconfig-1.2/test/test_bsd.rb