vagrant/plugins/hosts/darwin/cap/configured_ip_addresses.rb

19 lines
391 B
Ruby

require "socket"
module VagrantPlugins
module HostDarwin
module Cap
class ConfiguredIPAddresses
def self.configured_ip_addresses(env)
Socket.getifaddrs.map do |interface|
if interface.addr.ipv4? && !interface.addr.ipv4_loopback?
interface.addr.ip_address
end
end.compact
end
end
end
end
end