firewall_constraint 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
data/lib/firewall_constraint.rb
CHANGED
@@ -6,13 +6,13 @@ module FirewallConstraint
|
|
6
6
|
@ips = ips
|
7
7
|
else
|
8
8
|
ips = [ips].flatten
|
9
|
-
|
9
|
+
@ips = !ips.empty? ? ips :
|
10
10
|
YAML.load_file(Rails.root.join('config','firewall_constraint.yml'))[Rails.env]
|
11
|
-
@ips = config
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
14
|
def matches?(request)
|
15
|
+
return true if parsed_ips.empty?
|
16
16
|
client_ip = IPAddress::parse(request.env["HTTP_X_FORWARDED_FOR"] ? request.env["HTTP_X_FORWARDED_FOR"] : request.remote_ip)
|
17
17
|
parsed_ips.each do |ip|
|
18
18
|
begin
|
@@ -10,7 +10,9 @@ RailsApp::Application.routes.draw do
|
|
10
10
|
get 'dummy/blocked_by_dynamic' => 'dummy#blocked_by_dynamic'
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
constraints FirewallConstraint.new([]) do
|
14
|
+
root :to => 'dummy#index'
|
15
|
+
end
|
14
16
|
|
15
17
|
constraints FirewallConstraint.new('fe80::d69a:20ff:fe0d:45fe') do
|
16
18
|
get 'dummy/blocked_by_ipv6'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firewall_constraint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Auclair
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|