deflectable 0.3.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -11
  3. data/lib/deflectable/blacklist.rb +10 -0
  4. data/lib/deflectable/filtering.rb +19 -0
  5. data/lib/deflectable/version.rb +1 -1
  6. data/lib/deflectable/watcher.rb +6 -22
  7. data/lib/deflectable/whitelist.rb +10 -0
  8. data/lib/deflectable.rb +3 -0
  9. data/lib/generators/deflectable/templates/deflectable.yml +5 -7
  10. data/test/dummy/db/development.sqlite3 +0 -0
  11. data/test/dummy/db/test.sqlite3 +0 -0
  12. data/test/dummy/log/development.log +44 -250
  13. data/test/dummy/log/test.log +46 -13
  14. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  15. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  16. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  17. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  18. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  19. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  25. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  26. metadata +5 -4
  27. data/test/dummy/config/deflectable.yml +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31fc88c369571805b7f60abcf04e748a3ae02d55
4
- data.tar.gz: 460b80af74858b9b19d7c6e286231b7df1de9e85
3
+ metadata.gz: 360ccb8d8e116753a9a29d6b042137467d9e4fb8
4
+ data.tar.gz: 369179b44205e1cbdbfeb93d6f35eadaa856d423
5
5
  SHA512:
6
- metadata.gz: 174d85bef6a21be23f48aab6361a01e39507ab913ccb2685ce6fadc99553e4712dc886e747569069fefb102170ed9e9eee58c4c46fc73deb435ab2a1aac163de
7
- data.tar.gz: 44c2a299a3ad2613f05f3234b60e0b83c46fe515038e2313b62e4dd2d8e6cf77f8c4b51d239e539dda43cbe85da9f266f89515758ece99f34476558dd9407f1f
6
+ metadata.gz: 7c96c23991ae7875dd6c33bb556dfdfdff524db693f0ec0d5384be4045756c6c9a0170b562f55a46ef9e8f25a559951464d4b56257f15b801a8b784d94dce5d4
7
+ data.tar.gz: 074dea192fd5ef24eceb6d20017248c62534965be62b9616f8e3ecaa897e5e93ef8de7b7f38c0e760aef68bfab282eec3814a7a66d47f27114dc6b2e4f6a762d
data/README.md CHANGED
@@ -24,9 +24,22 @@ Or install it yourself as:
24
24
  ```bash
25
25
  $ rails generate deflectable:install
26
26
  ```
27
+ Generated files
27
28
 
28
- * generated 'config/deflectable.yml'
29
- * generated 'public/403.html'
29
+ * config/deflectable.yml
30
+ * public/403.html
31
+
32
+ #### deflectable.yml
33
+
34
+ ```yaml
35
+ # config/deflectable.yml
36
+
37
+ :log: true # default false
38
+ :whitelist: # or :blacklist
39
+ - 192.168.1.1
40
+ - 10.20.30.0/24 # ip range
41
+ - 3ffe:505:2::1 # IPv6 supported
42
+ ```
30
43
 
31
44
  ### Modified config.ru
32
45
 
@@ -35,12 +48,3 @@ $ rails generate deflectable:install
35
48
 
36
49
  use Deflectable::Watcher
37
50
  ```
38
-
39
-
40
- ## Contributing
41
-
42
- 1. Fork it
43
- 2. Create your feature branch (`git checkout -b my-new-feature`)
44
- 3. Commit your changes (`git commit -am 'Add some feature'`)
45
- 4. Push to the branch (`git push origin my-new-feature`)
46
- 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ class Deflectable::Blacklist < Deflectable::Filtering
2
+
3
+ def initialize(options)
4
+ super(options[:blacklist])
5
+ end
6
+
7
+ def permit?(request_ip)
8
+ not include?(request_ip)
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ require 'ipaddr'
2
+ class Deflectable::Filtering
3
+
4
+ def initialize(filter_list)
5
+ @list = parse_ipaddress(filter_list)
6
+ end
7
+
8
+ def include?(request_ip)
9
+ @list.any?{|ip| ip.include?(request_ip)}
10
+ end
11
+
12
+ private
13
+
14
+ def parse_ipaddress(list)
15
+ list.map do |ip|
16
+ IPAddr.new(ip).to_range rescue nil
17
+ end.compact
18
+ end
19
+ end
@@ -1,6 +1,6 @@
1
1
  module Deflectable
2
2
  major = 0
3
- minore = 3
3
+ minore = 5
4
4
  patch = 1
5
5
 
6
6
  VERSION = [major, minore, patch].join('.')
@@ -18,7 +18,7 @@ module Deflectable
18
18
  end
19
19
 
20
20
  def call(env)
21
- return reject!(env) if detect?(env)
21
+ return reject!(env) unless permit?(env)
22
22
  status, headers, body = @app.call(env)
23
23
  [status, headers, body]
24
24
  end
@@ -34,8 +34,8 @@ There was both a :blanklist and :whitelist.
34
34
  `Please select the :blacklist or :whitelist.'
35
35
  EOS
36
36
  end
37
- @filtering = :whitelist unless options[:whitelist].empty?
38
- @filtering = :blacklist unless options[:blacklist].empty?
37
+ @filtering = Whitelist.new(options) unless options[:whitelist].empty?
38
+ @filtering = Blacklist.new(options) unless options[:blacklist].empty?
39
39
  unless options[:logger]
40
40
  self.options[:logger] = Logger.new('deflecter.log')
41
41
  end
@@ -65,25 +65,9 @@ There was both a :blanklist and :whitelist.
65
65
  '<p>failed</p>'
66
66
  end
67
67
 
68
- def detect?(env)
69
- case @filtering
70
- when :whitelist
71
- allowed?(env) ? false : true
72
- when :blacklist
73
- denied?(env)
74
- else
75
- false
76
- end
77
- end
78
-
79
- def allowed?(env)
80
- return true if options[:whitelist].empty?
81
- options[:whitelist].include?(env['REMOTE_ADDR']) ? true : false
82
- end
83
-
84
- def denied?(env)
85
- return false if options[:blacklist].empty?
86
- options[:blacklist].include?(env['REMOTE_ADDR']) ? true : false
68
+ def permit?(env)
69
+ return true unless @filtering
70
+ @filtering.permit?(env['REMOTE_ADDR'])
87
71
  end
88
72
 
89
73
  def log(message, level = :info)
@@ -0,0 +1,10 @@
1
+ class Deflectable::Whitelist < Deflectable::Filtering
2
+
3
+ def initialize(options)
4
+ super(options[:whitelist])
5
+ end
6
+
7
+ def permit?(request_ip)
8
+ include?(request_ip)
9
+ end
10
+ end
data/lib/deflectable.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'deflectable/watcher'
2
+ require 'deflectable/filtering'
3
+ require 'deflectable/whitelist'
4
+ require 'deflectable/blacklist'
2
5
 
3
6
  module Deflectable
4
7
  end
@@ -1,7 +1,5 @@
1
- # :log: true # default: false
2
- # :whitelist:
3
- # - '127.0.0.1'
4
- # - '10.20.30.40'
5
- # :blacklist:
6
- # - '12.12.12.12'
7
- # - '90.80.70.60'
1
+ # :log: true # default: false
2
+ # :whitelist: # or :blacklist
3
+ # - 192.168.1.1
4
+ # - 10.20.30.0/24 # ip range
5
+ # - 3ffe:505:2::1 # IPv6 supported
Binary file
Binary file
@@ -1,314 +1,108 @@
1
1
 
2
2
 
3
- Started GET "/" for 127.0.0.1 at 2013-09-25 18:30:06 +0900
4
-
5
- SQLite3::CantOpenException (unable to open database file):
6
- activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `initialize'
7
- activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `new'
8
- activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection'
9
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
10
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
11
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
12
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
13
- /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
14
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
15
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
16
- /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
17
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
18
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
19
- activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
20
- activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection'
21
- activerecord (4.0.0) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings'
22
- activerecord (4.0.0) lib/active_record/query_cache.rb:43:in `rescue in call'
23
- activerecord (4.0.0) lib/active_record/query_cache.rb:32:in `call'
24
- activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
25
- activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
26
- actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
27
- activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1688254131637688522__call__callbacks'
28
- activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
29
- actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
30
- actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
31
- actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
32
- actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
33
- actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
34
- railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
35
- railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
36
- activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
37
- activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
38
- activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
39
- railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
40
- actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
41
- rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
42
- rack (1.5.2) lib/rack/runtime.rb:17:in `call'
43
- activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
44
- rack (1.5.2) lib/rack/lock.rb:17:in `call'
45
- actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
46
- railties (4.0.0) lib/rails/engine.rb:511:in `call'
47
- railties (4.0.0) lib/rails/application.rb:97:in `call'
48
- /Users/sakuma/apps/libs/deflectable/lib/deflectable/watcher.rb:25:in `call'
49
- rack (1.5.2) lib/rack/lock.rb:17:in `call'
50
- rack (1.5.2) lib/rack/content_length.rb:14:in `call'
51
- rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
52
- /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
53
- /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
54
- /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
55
-
56
-
57
- Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.4ms)
58
- Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
59
- Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
60
- Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.6ms)
61
-  (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
62
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
63
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
64
-
65
-
66
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:04 +0900
3
+ Started GET "/" for 127.0.0.1 at 2013-09-24 23:00:33 +0900
67
4
  Processing by WelcomeController#index as HTML
68
5
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
69
- Completed 200 OK in 54ms (Views: 54.0ms | ActiveRecord: 0.0ms)
6
+ Completed 200 OK in 27ms (Views: 26.3ms | ActiveRecord: 0.0ms)
70
7
 
71
8
 
72
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:05 +0900
9
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-24 23:00:34 +0900
73
10
 
74
11
 
75
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:05 +0900
12
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-24 23:00:34 +0900
76
13
 
77
14
 
78
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
15
+ Started GET "/" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
79
16
  Processing by WelcomeController#index as HTML
80
- Rendered welcome/index.html.erb within layouts/application (0.0ms)
81
- Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms)
17
+ Rendered welcome/index.html.erb within layouts/application (17.0ms)
18
+ Completed 200 OK in 41ms (Views: 40.6ms | ActiveRecord: 0.0ms)
82
19
 
83
20
 
84
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
21
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
85
22
 
86
23
 
87
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
24
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
88
25
 
89
26
 
90
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
27
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:26:37 +0900
91
28
  Processing by WelcomeController#index as HTML
92
- Rendered welcome/index.html.erb within layouts/application (0.0ms)
93
- Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
94
-
95
-
96
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
97
-
98
-
99
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
29
+ Rendered welcome/index.html.erb within layouts/application (1.1ms)
30
+ Completed 200 OK in 45ms (Views: 44.5ms | ActiveRecord: 0.0ms)
100
31
 
101
32
 
102
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
33
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:30:07 +0900
103
34
  Processing by WelcomeController#index as HTML
104
- Rendered welcome/index.html.erb within layouts/application (0.0ms)
105
- Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
106
-
107
-
108
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
109
-
110
-
111
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
112
-
113
-
114
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
115
- Processing by WelcomeController#index as HTML
116
- Rendered welcome/index.html.erb within layouts/application (0.1ms)
117
- Completed 200 OK in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
118
-
119
-
120
- Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
121
- Processing by WelcomeController#index as HTML
122
- Rendered welcome/index.html.erb within layouts/application (0.0ms)
123
- Completed 200 OK in 2ms (Views: 1.9ms | ActiveRecord: 0.0ms)
124
-
125
-
126
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
127
-
128
-
129
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
35
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
36
+ Completed 200 OK in 24ms (Views: 23.4ms | ActiveRecord: 0.0ms)
130
37
 
131
38
 
132
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
39
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:32:49 +0900
133
40
  Processing by WelcomeController#index as HTML
134
41
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
135
- Completed 200 OK in 25ms (Views: 24.6ms | ActiveRecord: 0.0ms)
136
-
137
-
138
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
42
+ Completed 200 OK in 24ms (Views: 23.7ms | ActiveRecord: 0.0ms)
139
43
 
140
44
 
141
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
142
-
143
-
144
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
45
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:39:33 +0900
145
46
  Processing by WelcomeController#index as HTML
146
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
147
- Completed 200 OK in 25ms (Views: 24.3ms | ActiveRecord: 0.0ms)
148
-
149
-
150
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
151
-
152
-
153
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
47
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
48
+ Completed 200 OK in 23ms (Views: 23.0ms | ActiveRecord: 0.0ms)
154
49
 
155
50
 
156
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:36:43 +0900
51
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:46:32 +0900
157
52
  Processing by WelcomeController#index as HTML
158
- Rendered welcome/index.html.erb within layouts/application (0.0ms)
159
- Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
160
-
161
-
162
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:36:44 +0900
163
-
164
-
165
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:36:44 +0900
53
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
54
+ Completed 200 OK in 24ms (Views: 23.5ms | ActiveRecord: 0.0ms)
166
55
 
167
56
 
168
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
57
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:47:37 +0900
169
58
  Processing by WelcomeController#index as HTML
170
59
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
171
- Completed 200 OK in 25ms (Views: 24.2ms | ActiveRecord: 0.0ms)
172
-
173
-
174
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
60
+ Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
175
61
 
176
62
 
177
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
178
-
179
-
180
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
63
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:48:19 +0900
181
64
  Processing by WelcomeController#index as HTML
182
65
  Rendered welcome/index.html.erb within layouts/application (0.7ms)
183
- Completed 200 OK in 25ms (Views: 24.3ms | ActiveRecord: 0.0ms)
184
-
185
-
186
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
187
-
188
-
189
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
190
-
191
-
192
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
193
- Processing by WelcomeController#index as HTML
194
- Rendered welcome/index.html.erb within layouts/application (0.9ms)
195
- Completed 200 OK in 29ms (Views: 28.9ms | ActiveRecord: 0.0ms)
66
+ Completed 200 OK in 24ms (Views: 23.8ms | ActiveRecord: 0.0ms)
196
67
 
197
68
 
198
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
199
-
200
-
201
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
202
-
203
-
204
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
69
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:49:49 +0900
205
70
  Processing by WelcomeController#index as HTML
206
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
207
- Completed 200 OK in 24ms (Views: 24.0ms | ActiveRecord: 0.0ms)
208
-
209
-
210
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
211
-
212
-
213
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
71
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
72
+ Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
214
73
 
215
74
 
216
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
75
+ Started GET "/" for 127.0.0.1 at 2013-09-25 09:50:53 +0900
217
76
  Processing by WelcomeController#index as HTML
218
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
219
- Completed 200 OK in 25ms (Views: 24.7ms | ActiveRecord: 0.0ms)
220
-
221
-
222
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
223
-
224
-
225
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
77
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
78
+ Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
226
79
 
227
80
 
228
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:49:35 +0900
81
+ Started GET "/" for 127.0.0.1 at 2013-09-25 10:26:22 +0900
229
82
  Processing by WelcomeController#index as HTML
230
83
  Rendered welcome/index.html.erb within layouts/application (0.0ms)
231
- Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
232
-
233
-
234
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:49:36 +0900
235
-
236
-
237
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:49:36 +0900
238
-
239
-
240
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:55:23 +0900
241
- Processing by WelcomeController#index as HTML
242
- Rendered welcome/index.html.erb within layouts/application (1.5ms)
243
- Completed 200 OK in 29ms (Views: 28.6ms | ActiveRecord: 0.0ms)
244
-
245
-
246
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:55:30 +0900
247
-
248
-
249
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:55:33 +0900
250
-
251
-
252
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:55:52 +0900
253
- Processing by WelcomeController#index as HTML
254
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
255
- Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
256
-
257
-
258
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:55:53 +0900
259
-
260
-
261
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:55:53 +0900
262
-
263
-
264
- Started GET "/" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
265
- Processing by WelcomeController#index as HTML
266
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
267
- Completed 200 OK in 25ms (Views: 24.4ms | ActiveRecord: 0.0ms)
268
-
269
-
270
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
271
-
272
-
273
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
84
+ Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
274
85
 
275
86
 
276
- Started GET "/" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
87
+ Started GET "/" for 127.0.0.1 at 2013-09-25 10:32:29 +0900
277
88
  Processing by WelcomeController#index as HTML
278
- Rendered welcome/index.html.erb within layouts/application (0.8ms)
279
- Completed 200 OK in 24ms (Views: 24.0ms | ActiveRecord: 0.0ms)
89
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
90
+ Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
280
91
 
281
92
 
282
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
93
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 10:32:30 +0900
283
94
 
284
95
 
285
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
286
- Rejected(blacklist): 127.0.0.1
287
- Rejected(blacklist): 127.0.0.1
288
- Rejected(blacklist): 127.0.0.1
289
- Rejected(blacklist): 127.0.0.1
96
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 10:32:30 +0900
290
97
 
291
98
 
292
- Started GET "/" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
99
+ Started GET "/" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
293
100
  Processing by WelcomeController#index as HTML
294
101
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
295
- Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
296
-
297
-
298
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
299
-
300
-
301
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
302
- Rejected(whitelist): 127.0.0.1
303
-
304
-
305
- Started GET "/" for 127.0.0.1 at 2013-09-26 01:20:16 +0900
306
- Processing by WelcomeController#index as HTML
307
- Rendered welcome/index.html.erb within layouts/application (1.0ms)
308
- Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
102
+ Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
309
103
 
310
104
 
311
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:20:17 +0900
105
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
312
106
 
313
107
 
314
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:20:17 +0900
108
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
@@ -1,16 +1,49 @@
1
-  (2.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
-  (0.1ms) SELECT version FROM "schema_migrations"
4
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
5
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
6
1
   (0.2ms) begin transaction
7
- ----------------------------------------------------------
8
- AcceptableTest: test_should_get_index_when_not_ip_controll
9
- ----------------------------------------------------------
10
- Started GET "/" for 127.0.0.1 at 2013-09-25 18:31:54 +0900
2
+ -------------------------------------
3
+ AcceptableTest: test_should_get_index
4
+ -------------------------------------
5
+  (0.0ms) rollback transaction
6
+  (0.0ms) begin transaction
7
+ ---------------------------
8
+ DeflectableTest: test_truth
9
+ ---------------------------
10
+  (0.0ms) rollback transaction
11
+  (0.0ms) begin transaction
12
+ --------------------------------------------
13
+ WelcomeControllerTest: test_should_get_index
14
+ --------------------------------------------
11
15
  Processing by WelcomeController#index as HTML
12
16
  Rendered welcome/index.html.erb within layouts/application (0.7ms)
13
- Completed 200 OK in 14ms (Views: 13.8ms | ActiveRecord: 0.0ms)
17
+ Completed 200 OK in 12ms (Views: 12.1ms | ActiveRecord: 0.0ms)
18
+  (0.1ms) rollback transaction
19
+  (0.2ms) begin transaction
20
+ -------------------------------------
21
+ AcceptableTest: test_should_get_index
22
+ -------------------------------------
23
+  (0.0ms) rollback transaction
24
+  (0.0ms) begin transaction
25
+ ---------------------------
26
+ DeflectableTest: test_truth
27
+ ---------------------------
28
+  (0.0ms) rollback transaction
29
+  (0.2ms) begin transaction
30
+ -------------------------------------
31
+ AcceptableTest: test_should_get_index
32
+ -------------------------------------
33
+  (0.0ms) rollback transaction
34
+  (0.0ms) begin transaction
35
+ ---------------------------
36
+ DeflectableTest: test_truth
37
+ ---------------------------
38
+  (0.0ms) rollback transaction
39
+  (0.2ms) begin transaction
40
+ -------------------------------------
41
+ AcceptableTest: test_should_get_index
42
+ -------------------------------------
43
+ Started GET "/" for 127.0.0.1 at 2013-09-24 23:17:55 +0900
44
+ Processing by WelcomeController#index as HTML
45
+ Rendered welcome/index.html.erb within layouts/application (0.9ms)
46
+ Completed 200 OK in 26ms (Views: 25.5ms | ActiveRecord: 0.0ms)
14
47
   (0.1ms) rollback transaction
15
48
   (0.0ms) begin transaction
16
49
  ---------------------------
@@ -21,10 +54,10 @@ DeflectableTest: test_truth
21
54
  ----------------------------------------------------------
22
55
  AcceptableTest: test_should_get_index_when_not_ip_controll
23
56
  ----------------------------------------------------------
24
- Started GET "/" for 127.0.0.1 at 2013-09-25 19:13:16 +0900
57
+ Started GET "/" for 127.0.0.1 at 2013-09-25 18:10:23 +0900
25
58
  Processing by WelcomeController#index as HTML
26
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
27
- Completed 200 OK in 12ms (Views: 12.0ms | ActiveRecord: 0.0ms)
59
+ Rendered welcome/index.html.erb within layouts/application (1.1ms)
60
+ Completed 200 OK in 13ms (Views: 13.1ms | ActiveRecord: 0.0ms)
28
61
   (0.1ms) rollback transaction
29
62
   (0.0ms) begin transaction
30
63
  ---------------------------
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deflectable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naohiro Sakuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-25 00:00:00.000000000 Z
11
+ date: 2013-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -87,8 +87,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - lib/deflectable/blacklist.rb
91
+ - lib/deflectable/filtering.rb
90
92
  - lib/deflectable/version.rb
91
93
  - lib/deflectable/watcher.rb
94
+ - lib/deflectable/whitelist.rb
92
95
  - lib/deflectable.rb
93
96
  - lib/generators/deflectable/install_generator.rb
94
97
  - lib/generators/deflectable/templates/403.html
@@ -113,7 +116,6 @@ files:
113
116
  - test/dummy/config/boot.rb
114
117
  - test/dummy/config/database.yml
115
118
  - test/dummy/config/deflect.yml
116
- - test/dummy/config/deflectable.yml
117
119
  - test/dummy/config/environment.rb
118
120
  - test/dummy/config/environments/development.rb
119
121
  - test/dummy/config/environments/production.rb
@@ -193,7 +195,6 @@ test_files:
193
195
  - test/dummy/config/boot.rb
194
196
  - test/dummy/config/database.yml
195
197
  - test/dummy/config/deflect.yml
196
- - test/dummy/config/deflectable.yml
197
198
  - test/dummy/config/environment.rb
198
199
  - test/dummy/config/environments/development.rb
199
200
  - test/dummy/config/environments/production.rb
@@ -1,7 +0,0 @@
1
- # :log: true # default: false
2
- # :whitelist:
3
- # - '127.0.0.1'
4
- # - '10.20.30.40'
5
- # :blacklist:
6
- # - '12.12.12.12'
7
- # - '90.80.70.60'