Module: Vagrant::Util::IPv4Interfaces

Extended by:
IPv4Interfaces
Included in:
Action::Builtin::HandleForwardedPortCollisions, IPv4Interfaces
Defined in:
lib/vagrant/util/ipv4_interfaces.rb

Instance Method Summary collapse

Instance Method Details

#ipv4_interfacesObject



7
8
9
10
11
12
13
# File 'lib/vagrant/util/ipv4_interfaces.rb', line 7

def ipv4_interfaces
  Socket.getifaddrs.select do |ifaddr|
    ifaddr.addr && ifaddr.addr.ipv4?
  end.map do |ifaddr|
    [ifaddr.name, ifaddr.addr.ip_address]
  end
end