Module: ActionHook::Security::IPBlocking

Included in:
Core::NetHTTPSender
Defined in:
lib/actionhook/security/ip_blocking.rb

Defined Under Namespace

Classes: BlockedRequestError, PrivateIPError

Instance Method Summary collapse

Instance Method Details

#verify_allowed!(configuration, hostname_or_ip) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/actionhook/security/ip_blocking.rb', line 21

def verify_allowed!(configuration, hostname_or_ip)
  return if configuration.allow_all?

  begin
    verify_ip_allowed!(configuration, IPAddr.new(hostname_or_ip))
  rescue IPAddr::InvalidAddressError
    verify_hostname_allowed!(configuration, hostname_or_ip)
  end

end