mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:19:53 +01:00
64adbb5707
this commit is not approved by the IPv6 crowd. patches welcome
22 lines
372 B
Ruby
22 lines
372 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Constraints
|
|
module LocalNetwork
|
|
module_function
|
|
|
|
SUBNETS = %w[
|
|
10.0.0.0/8
|
|
127.0.0.0/8
|
|
172.16.0.0/12
|
|
192.168.0.0/16
|
|
].map { IPAddr.new(_1) }.freeze
|
|
|
|
def matches?(request)
|
|
SUBNETS.find do |net|
|
|
net.include? request.remote_ip
|
|
rescue
|
|
false
|
|
end
|
|
end
|
|
end
|
|
end
|