{"action":"created","comment":{"url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/comments/40870967","id":40870967,"diff_hunk":"@@ -79,6 +79,80 @@ describe('ratelimit', function() {\n             done(err);\n         });\n     });\n+\n+    it('should let ip addresses be used as override keys', function(done) {\n+        done = after(2, done);\n+\n+        var app = express();\n+        app.use(ratelimit({\n+            burst: 1,\n+            rate: 1,\n+            xff: true,\n+            overrides: {\n+                '1.1.1.1': {\n+                    burst: 2,\n+                    rate: 2\n+                }\n+            }\n+        }));\n+\n+        app.get('/', function(req, res, next) {\n+            res.send('hello');\n+        });\n+\n+        supertest(app)\n+        .get('/')\n+        .set('x-forwarded-for', '1.1.1.1')\n+        .expect(200)\n+        .end(function(err, res) {\n+            done(err);\n+        });\n+\n+        supertest(app)\n+        .get('/')\n+        .set('x-forwarded-for', '1.1.1.1')\n+        .expect(200)\n+        .end(function(err, res) {\n+            done(err);\n+        });\n+    });\n+\n+    it('should let ip blocks be used as override keys', function(done) {\n+        done = after(2, done);\n+\n+        var app = express();\n+        app.use(ratelimit({\n+            burst: 1,\n+            rate: 1,\n+            xff: true,\n+            overrides: {\n+                '1.1.1.192/27': {\n+                    burst: 2,\n+                    rate: 2\n+                }\n+            }\n+        }));\n+\n+        app.get('/', function(req, res, next) {\n+            res.send('hello');\n+        });\n+\n+        supertest(app)\n+        .get('/')\n+        .set('x-forwarded-for', '1.1.1.222')\n+        .expect(200)\n+        .end(function(err, res) {\n+            done(err);\n+        });\n+\n+        supertest(app)\n+        .get('/')\n+        .set('x-forwarded-for', '1.1.1.222')\n+        .expect(200)\n+        .end(function(err, res) {\n+            done(err);\n+        });\n+    });","path":"tests/index.js","position":77,"original_position":77,"commit_id":"62a04d90eaf0b1d75aa8e5fad907bb9c32031795","original_commit_id":"62a04d90eaf0b1d75aa8e5fad907bb9c32031795","user":{"login":"defunctzombie","id":84792,"avatar_url":"https://avatars.githubusercontent.com/u/84792?v=3","gravatar_id":"","url":"https://api.github.com/users/defunctzombie","html_url":"https://github.com/defunctzombie","followers_url":"https://api.github.com/users/defunctzombie/followers","following_url":"https://api.github.com/users/defunctzombie/following{/other_user}","gists_url":"https://api.github.com/users/defunctzombie/gists{/gist_id}","starred_url":"https://api.github.com/users/defunctzombie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defunctzombie/subscriptions","organizations_url":"https://api.github.com/users/defunctzombie/orgs","repos_url":"https://api.github.com/users/defunctzombie/repos","events_url":"https://api.github.com/users/defunctzombie/events{/privacy}","received_events_url":"https://api.github.com/users/defunctzombie/received_events","type":"User","site_admin":false},"body":"what about a test that shows rejecting from an ip outside the block trying to burst or whatnot?","created_at":"2015-10-01T01:05:11Z","updated_at":"2015-10-01T01:05:11Z","html_url":"https://github.com/defunctzombie/ratelimit-middleware/pull/1#discussion_r40870967","pull_request_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/comments/40870967"},"html":{"href":"https://github.com/defunctzombie/ratelimit-middleware/pull/1#discussion_r40870967"},"pull_request":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1","id":46465598,"html_url":"https://github.com/defunctzombie/ratelimit-middleware/pull/1","diff_url":"https://github.com/defunctzombie/ratelimit-middleware/pull/1.diff","patch_url":"https://github.com/defunctzombie/ratelimit-middleware/pull/1.patch","issue_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/1","number":1,"state":"open","locked":false,"title":"Let ip block style strings be used for override keys","user":{"login":"cilphex","id":611803,"avatar_url":"https://avatars.githubusercontent.com/u/611803?v=3","gravatar_id":"","url":"https://api.github.com/users/cilphex","html_url":"https://github.com/cilphex","followers_url":"https://api.github.com/users/cilphex/followers","following_url":"https://api.github.com/users/cilphex/following{/other_user}","gists_url":"https://api.github.com/users/cilphex/gists{/gist_id}","starred_url":"https://api.github.com/users/cilphex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilphex/subscriptions","organizations_url":"https://api.github.com/users/cilphex/orgs","repos_url":"https://api.github.com/users/cilphex/repos","events_url":"https://api.github.com/users/cilphex/events{/privacy}","received_events_url":"https://api.github.com/users/cilphex/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-30T22:32:02Z","updated_at":"2015-10-01T01:05:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"554aa3670146a346b162dd4841c7dc4022f29ec0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1/commits","review_comments_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1/comments","review_comment_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/1/comments","statuses_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/statuses/62a04d90eaf0b1d75aa8e5fad907bb9c32031795","head":{"label":"cilphex:ip_block_override_keys","ref":"ip_block_override_keys","sha":"62a04d90eaf0b1d75aa8e5fad907bb9c32031795","user":{"login":"cilphex","id":611803,"avatar_url":"https://avatars.githubusercontent.com/u/611803?v=3","gravatar_id":"","url":"https://api.github.com/users/cilphex","html_url":"https://github.com/cilphex","followers_url":"https://api.github.com/users/cilphex/followers","following_url":"https://api.github.com/users/cilphex/following{/other_user}","gists_url":"https://api.github.com/users/cilphex/gists{/gist_id}","starred_url":"https://api.github.com/users/cilphex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilphex/subscriptions","organizations_url":"https://api.github.com/users/cilphex/orgs","repos_url":"https://api.github.com/users/cilphex/repos","events_url":"https://api.github.com/users/cilphex/events{/privacy}","received_events_url":"https://api.github.com/users/cilphex/received_events","type":"User","site_admin":false},"repo":{"id":43462983,"name":"ratelimit-middleware","full_name":"cilphex/ratelimit-middleware","owner":{"login":"cilphex","id":611803,"avatar_url":"https://avatars.githubusercontent.com/u/611803?v=3","gravatar_id":"","url":"https://api.github.com/users/cilphex","html_url":"https://github.com/cilphex","followers_url":"https://api.github.com/users/cilphex/followers","following_url":"https://api.github.com/users/cilphex/following{/other_user}","gists_url":"https://api.github.com/users/cilphex/gists{/gist_id}","starred_url":"https://api.github.com/users/cilphex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cilphex/subscriptions","organizations_url":"https://api.github.com/users/cilphex/orgs","repos_url":"https://api.github.com/users/cilphex/repos","events_url":"https://api.github.com/users/cilphex/events{/privacy}","received_events_url":"https://api.github.com/users/cilphex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cilphex/ratelimit-middleware","description":"ratelimit middleware for express","fork":true,"url":"https://api.github.com/repos/cilphex/ratelimit-middleware","forks_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/forks","keys_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/teams","hooks_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/hooks","issue_events_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/issues/events{/number}","events_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/events","assignees_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/assignees{/user}","branches_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/branches{/branch}","tags_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/tags","blobs_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/git/refs{/sha}","trees_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/statuses/{sha}","languages_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/languages","stargazers_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/stargazers","contributors_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/contributors","subscribers_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/subscribers","subscription_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/subscription","commits_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/commits{/sha}","git_commits_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/git/commits{/sha}","comments_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/comments{/number}","issue_comment_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/issues/comments{/number}","contents_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/contents/{+path}","compare_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/merges","archive_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/downloads","issues_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/issues{/number}","pulls_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/pulls{/number}","milestones_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/milestones{/number}","notifications_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/labels{/name}","releases_url":"https://api.github.com/repos/cilphex/ratelimit-middleware/releases{/id}","created_at":"2015-09-30T22:26:15Z","updated_at":"2015-09-30T22:26:16Z","pushed_at":"2015-10-01T00:49:22Z","git_url":"git://github.com/cilphex/ratelimit-middleware.git","ssh_url":"git@github.com:cilphex/ratelimit-middleware.git","clone_url":"https://github.com/cilphex/ratelimit-middleware.git","svn_url":"https://github.com/cilphex/ratelimit-middleware","homepage":null,"size":85,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"defunctzombie:master","ref":"master","sha":"79b11ddcbd4645d510eb68f8046a1d98e8acfc6c","user":{"login":"defunctzombie","id":84792,"avatar_url":"https://avatars.githubusercontent.com/u/84792?v=3","gravatar_id":"","url":"https://api.github.com/users/defunctzombie","html_url":"https://github.com/defunctzombie","followers_url":"https://api.github.com/users/defunctzombie/followers","following_url":"https://api.github.com/users/defunctzombie/following{/other_user}","gists_url":"https://api.github.com/users/defunctzombie/gists{/gist_id}","starred_url":"https://api.github.com/users/defunctzombie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defunctzombie/subscriptions","organizations_url":"https://api.github.com/users/defunctzombie/orgs","repos_url":"https://api.github.com/users/defunctzombie/repos","events_url":"https://api.github.com/users/defunctzombie/events{/privacy}","received_events_url":"https://api.github.com/users/defunctzombie/received_events","type":"User","site_admin":false},"repo":{"id":33211018,"name":"ratelimit-middleware","full_name":"defunctzombie/ratelimit-middleware","owner":{"login":"defunctzombie","id":84792,"avatar_url":"https://avatars.githubusercontent.com/u/84792?v=3","gravatar_id":"","url":"https://api.github.com/users/defunctzombie","html_url":"https://github.com/defunctzombie","followers_url":"https://api.github.com/users/defunctzombie/followers","following_url":"https://api.github.com/users/defunctzombie/following{/other_user}","gists_url":"https://api.github.com/users/defunctzombie/gists{/gist_id}","starred_url":"https://api.github.com/users/defunctzombie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defunctzombie/subscriptions","organizations_url":"https://api.github.com/users/defunctzombie/orgs","repos_url":"https://api.github.com/users/defunctzombie/repos","events_url":"https://api.github.com/users/defunctzombie/events{/privacy}","received_events_url":"https://api.github.com/users/defunctzombie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/defunctzombie/ratelimit-middleware","description":"ratelimit middleware for express","fork":false,"url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware","forks_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/forks","keys_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/teams","hooks_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/hooks","issue_events_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/events{/number}","events_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/events","assignees_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/assignees{/user}","branches_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/branches{/branch}","tags_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/tags","blobs_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/git/refs{/sha}","trees_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/statuses/{sha}","languages_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/languages","stargazers_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/stargazers","contributors_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/contributors","subscribers_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/subscribers","subscription_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/subscription","commits_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/commits{/sha}","git_commits_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/git/commits{/sha}","comments_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/comments{/number}","issue_comment_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/comments{/number}","contents_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/contents/{+path}","compare_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/merges","archive_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/downloads","issues_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues{/number}","pulls_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls{/number}","milestones_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/milestones{/number}","notifications_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/labels{/name}","releases_url":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/releases{/id}","created_at":"2015-03-31T21:28:33Z","updated_at":"2015-04-01T04:43:28Z","pushed_at":"2015-10-01T00:49:23Z","git_url":"git://github.com/defunctzombie/ratelimit-middleware.git","ssh_url":"git@github.com:defunctzombie/ratelimit-middleware.git","clone_url":"https://github.com/defunctzombie/ratelimit-middleware.git","svn_url":"https://github.com/defunctzombie/ratelimit-middleware","homepage":null,"size":164,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1"},"html":{"href":"https://github.com/defunctzombie/ratelimit-middleware/pull/1"},"issue":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/1"},"comments":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/defunctzombie/ratelimit-middleware/statuses/62a04d90eaf0b1d75aa8e5fad907bb9c32031795"}}}}