-
-
Save ton31337/0544072f0106d6868951 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ipv6?(ip) | |
ipv6_global = IPAddr.new('2000::/3') | |
ipv6_global.include?(ip) | |
end | |
def to_ipv6(ip) | |
"[#{ip}]" if ipv6?(ip) | |
end | |
ips = ['192.168.1.1', '2001::dead::5', '10.0.0.1', '2001::beef'] | |
x = ips.to_ipv6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment