Sha256: 0b99487bed06002ba093801443113ca66d1c5c08d9e37d914c82a4245985852c
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true require "ipaddr" require "uri" module Onyphe class Validator def self.valid_ip?(ip) IPAddr.new ip true rescue IPAddr::InvalidAddressError => _e false end def self.valid_domain?(domain) uri = URI("https://#{domain}") uri.hostname == domain && domain.include?(".") && !valid_ip?(domain) rescue ArgumentError => _e false end def self.valid_onion_domain?(domain) uri = URI("https://#{domain}") uri.hostname == domain && domain.end_with?(".onion") rescue ArgumentError => _e false end def self.valid_md5?(md5) md5.to_s.match?(/^[a-f0-9]{32}$/) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
onyphe-1.1.0 | lib/onyphe/validator.rb |
onyphe-1.0.0 | lib/onyphe/validator.rb |
onyphe-0.2.3 | lib/onyphe/validator.rb |