Sha256: 1d792f7afef1b118b4b5772a0f8981eba6d418994c7ab6c9635d021ba081174c
Contents?: true
Size: 858 Bytes
Versions: 46
Compression:
Stored size: 858 Bytes
Contents
#!/usr/bin/ruby -w $: << File.dirname(__FILE__) + "/../lib" require 'ifconfig' require 'pp' ifcfg = IO.readlines('../ifconfig_examples/dragonflybsd.txt').join netstat = IO.readlines('../ifconfig_examples/dragonflybsd_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