Method: IPAddr#ipv4_mapped

Defined in:
lib/ipaddr.rb

#ipv4_mappedObject

Returns a new ipaddr built by converting the native IPv4 address into an IPv4-mapped IPv6 address.



274
275
276
277
278
279
# File 'lib/ipaddr.rb', line 274

def ipv4_mapped
  if !ipv4?
    raise InvalidAddressError, "not an IPv4 address"
  end
  return self.clone.set(@addr | 0xffff00000000, Socket::AF_INET6)
end