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


4
5
6
7
8
9
10
# File 'lib/vagrant/util/ipv4_interfaces.rb', line 4

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