-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip test case for ipv6 when disable ipv6
- Loading branch information
1 parent
c472504
commit 9bb2aa5
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Ddig | ||
module Ipv6Helper | ||
def enable_ipv6? | ||
Socket.ip_address_list.each do |addrinfo| | ||
if RUBY_VERSION <= '3.0' | ||
# for ipaddr gem <= v1.2.2, Not support zone identifiers in IPv6 addresses | ||
addr = IPAddr.new(addrinfo.ip_address.split('%').first) | ||
else | ||
addr = IPAddr.new(addrinfo.ip_address) | ||
end | ||
|
||
if addr.ipv6? && !addr.loopback? && !addr.link_local? | ||
return true | ||
end | ||
end | ||
|
||
return false | ||
end | ||
end | ||
end |