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

19 lines
391 B
Ruby
Raw Normal View History

2017-12-16 00:31:44 +00:00
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