Browse Source

Fix filtering for IPv4/IPv6

master
aeris 2 years ago
parent
commit
08e01197d5
  1. 4
      bin/cryptcheck
  2. 2
      lib/cryptcheck/host.rb
  3. 1
      set-env

4
bin/cryptcheck

@ -12,6 +12,10 @@ require 'cryptcheck'
class CLI < Thor
LOG_LEVEL = ENV.fetch 'LOG', :info
def self.exit_on_failure?
true
end
class_option :'no-ipv4', type: :boolean, default: false, aliases: :'4'
class_option :'no-ipv6', type: :boolean, default: false, aliases: :'6'
class_option :json, type: :boolean, default: false, aliases: :j

2
lib/cryptcheck/host.rb

@ -75,7 +75,7 @@ module CryptCheck
end
::Addrinfo.getaddrinfo(@hostname, nil, nil, :STREAM)
.collect { |a| [@hostname, a.ip_address, a.afamily, @port] }
end.reject do |family, *_|
end.reject do |_1, _2, family, *_3|
(ENV['DISABLE_IPv6'] && family == Socket::AF_INET6) ||
(ENV['DISABLE_IPv4'] && family == Socket::AF_INET)
end

1
set-env

@ -11,7 +11,6 @@ case "$1" in
;;
*)
echo "You must provide OpenSSL version to use: 1.0 or 1.1"
exit -1
;;
esac

Loading…
Cancel
Save