Sha256: be6a97471e00ddf2463353d302c3a101fd015482d994fa36f75b4fe83b1d875b

Contents?: true

Size: 769 Bytes

Versions: 46

Compression:

Stored size: 769 Bytes

Contents

#!/usr/bin/ruby -w

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

require 'ifconfig'
require 'pp'

sample = IO.readlines('../ifconfig_examples/openbsd.txt').join
ifconfig = IfconfigWrapper.new('BSD',sample).parse

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

puts "\nxl0 mac address: (ifconfig['xl0'].mac)"
pp ifconfig['xl0'].mac

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

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

puts "\nList of address types for xl0: (ifconfig['xl0'].addr_types)"
pp ifconfig['xl0'].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
trema-0.3.12 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.11 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.10 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.9 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.8 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.7 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.6 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.5 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.4 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.3 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.2 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.1 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.3.0 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.8 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.7 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.6 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.5 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.4 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.3 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb
trema-0.2.2.1 vendor/ruby-ifconfig-1.2/test/test_openbsd.rb