vaguerent/lib/vagrant/util/ipv4_interfaces.rb
Brian Cain 5aff6660fb
Move port checker method to class rather than instance
This commit also moves out the ipv4_interfaces method to be a util
method, so that the port checker can also access it as a class mehtod
2020-05-12 10:54:23 -07:00

14 lines
290 B
Ruby

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