Class: NetAddr::CIDRv4
- Inherits:
-
Object
- Object
- NetAddr::CIDRv4
- Defined in:
- lib/ipaccess/patches/netaddr.rb
Overview
This class contains methods extending original CIDRv4 class.
Instance Method Summary collapse
-
#ipv4_compat ⇒ Object
Returns a new NetAddr::CIDRv6 object built by converting the native IPv4 address to an IPv4-compatible IPv6 address.
-
#ipv4_mapped ⇒ Object
(also: #ipv6, #to_ipv6)
Returns a new NetAddr::CIDRv6 object built by converting the native IPv4 address to an IPv4-mapped IPv6 address.
Instance Method Details
#ipv4_compat ⇒ Object
Returns a new NetAddr::CIDRv6 object built by converting the native IPv4 address to an IPv4-compatible IPv6 address. Mask is also converted.
102 103 104 105 106 |
# File 'lib/ipaccess/patches/netaddr.rb', line 102 def ipv4_compat return NetAddr::CIDR.create(@ip, :Mask => @netmask << 96, :Version => 6) end |
#ipv4_mapped ⇒ Object Also known as: ipv6, to_ipv6
Returns a new NetAddr::CIDRv6 object built by converting the native IPv4 address to an IPv4-mapped IPv6 address. Mask is also converted.
89 90 91 92 93 |
# File 'lib/ipaccess/patches/netaddr.rb', line 89 def ipv4_mapped return NetAddr::CIDR.create(@ip | 0xffff00000000, :Mask => @netmask << 96, :Version => 6) end |