vaguerent/lib/vagrant/util/network_ip.rb
Mikhail Zholobov 74de13cae5
util/network_ip: Simplify #network_address helper
Allow to use IPv6 net masks in string notation.
2018-10-28 21:17:43 +01:00

15 lines
272 B
Ruby

require "ipaddr"
module Vagrant
module Util
module NetworkIP
# Returns the network address of the given IP and subnet.
#
# @return [String]
def network_address(ip, subnet)
IPAddr.new(ip).mask(subnet).to_s
end
end
end
end