{"action":"created","comment":{"url":"https://api.github.com/repos/afeld/jsonp/pulls/comments/44550696","id":44550696,"diff_hunk":"@@ -0,0 +1,25 @@\n+/*jshint node:true */\n+var url = require('url');\n+var epsilonDelta = require('epsilon-delta');\n+\n+var getUserKey = function(req) {\n+  // attempt to limit by the application\n+  var keyUrl = req.headers.referer || req.query.url || req.query.src;\n+  if (keyUrl) {\n+    var keyUrlObj = url.parse(keyUrl);\n+    return keyUrlObj.host;\n+  } else {\n+    // otherwise, limit by the IP\n+    return req.connection.remoteAddress;\n+  }\n+};\n+\n+module.exports = epsilonDelta({\n+  userKey: getUserKey,\n+  capacity: 100,\n+  expire: 1000 * 10,","path":"server/limiter.js","position":20,"original_position":20,"commit_id":"81fcf0c2ee64d0bb89539d1d0698f1e6a4f6e854","original_commit_id":"81fcf0c2ee64d0bb89539d1d0698f1e6a4f6e854","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"body":"These choices are fairly arbitrary.","created_at":"2015-11-11T16:17:38Z","updated_at":"2015-11-11T16:17:38Z","html_url":"https://github.com/afeld/jsonp/pull/71#discussion_r44550696","pull_request_url":"https://api.github.com/repos/afeld/jsonp/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/comments/44550696"},"html":{"href":"https://github.com/afeld/jsonp/pull/71#discussion_r44550696"},"pull_request":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/afeld/jsonp/pulls/71","id":50402147,"html_url":"https://github.com/afeld/jsonp/pull/71","diff_url":"https://github.com/afeld/jsonp/pull/71.diff","patch_url":"https://github.com/afeld/jsonp/pull/71.patch","issue_url":"https://api.github.com/repos/afeld/jsonp/issues/71","number":71,"state":"open","locked":false,"title":"add in-memory rate limiting","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"body":"Closes #70.","created_at":"2015-11-11T16:17:19Z","updated_at":"2015-11-11T16:17:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6aa24bfe3c239f9eb1ade29a7424478a478fabd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/afeld/jsonp/pulls/71/commits","review_comments_url":"https://api.github.com/repos/afeld/jsonp/pulls/71/comments","review_comment_url":"https://api.github.com/repos/afeld/jsonp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/afeld/jsonp/issues/71/comments","statuses_url":"https://api.github.com/repos/afeld/jsonp/statuses/81fcf0c2ee64d0bb89539d1d0698f1e6a4f6e854","head":{"label":"afeld:rate-limit-B","ref":"rate-limit-B","sha":"81fcf0c2ee64d0bb89539d1d0698f1e6a4f6e854","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"repo":{"id":4282803,"name":"jsonp","full_name":"afeld/jsonp","owner":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/afeld/jsonp","description":"A simple JSON proxy","fork":false,"url":"https://api.github.com/repos/afeld/jsonp","forks_url":"https://api.github.com/repos/afeld/jsonp/forks","keys_url":"https://api.github.com/repos/afeld/jsonp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afeld/jsonp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afeld/jsonp/teams","hooks_url":"https://api.github.com/repos/afeld/jsonp/hooks","issue_events_url":"https://api.github.com/repos/afeld/jsonp/issues/events{/number}","events_url":"https://api.github.com/repos/afeld/jsonp/events","assignees_url":"https://api.github.com/repos/afeld/jsonp/assignees{/user}","branches_url":"https://api.github.com/repos/afeld/jsonp/branches{/branch}","tags_url":"https://api.github.com/repos/afeld/jsonp/tags","blobs_url":"https://api.github.com/repos/afeld/jsonp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afeld/jsonp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afeld/jsonp/git/refs{/sha}","trees_url":"https://api.github.com/repos/afeld/jsonp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afeld/jsonp/statuses/{sha}","languages_url":"https://api.github.com/repos/afeld/jsonp/languages","stargazers_url":"https://api.github.com/repos/afeld/jsonp/stargazers","contributors_url":"https://api.github.com/repos/afeld/jsonp/contributors","subscribers_url":"https://api.github.com/repos/afeld/jsonp/subscribers","subscription_url":"https://api.github.com/repos/afeld/jsonp/subscription","commits_url":"https://api.github.com/repos/afeld/jsonp/commits{/sha}","git_commits_url":"https://api.github.com/repos/afeld/jsonp/git/commits{/sha}","comments_url":"https://api.github.com/repos/afeld/jsonp/comments{/number}","issue_comment_url":"https://api.github.com/repos/afeld/jsonp/issues/comments{/number}","contents_url":"https://api.github.com/repos/afeld/jsonp/contents/{+path}","compare_url":"https://api.github.com/repos/afeld/jsonp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afeld/jsonp/merges","archive_url":"https://api.github.com/repos/afeld/jsonp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afeld/jsonp/downloads","issues_url":"https://api.github.com/repos/afeld/jsonp/issues{/number}","pulls_url":"https://api.github.com/repos/afeld/jsonp/pulls{/number}","milestones_url":"https://api.github.com/repos/afeld/jsonp/milestones{/number}","notifications_url":"https://api.github.com/repos/afeld/jsonp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afeld/jsonp/labels{/name}","releases_url":"https://api.github.com/repos/afeld/jsonp/releases{/id}","created_at":"2012-05-10T09:51:16Z","updated_at":"2015-11-05T14:06:47Z","pushed_at":"2015-11-11T16:17:19Z","git_url":"git://github.com/afeld/jsonp.git","ssh_url":"git@github.com:afeld/jsonp.git","clone_url":"https://github.com/afeld/jsonp.git","svn_url":"https://github.com/afeld/jsonp","homepage":"https://jsonp.afeld.me","size":1439,"stargazers_count":178,"watchers_count":178,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":178,"default_branch":"master"}},"base":{"label":"afeld:master","ref":"master","sha":"753eda9e8d2271cf9473bbdc7c999ef09e810bbd","user":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"repo":{"id":4282803,"name":"jsonp","full_name":"afeld/jsonp","owner":{"login":"afeld","id":86842,"avatar_url":"https://avatars.githubusercontent.com/u/86842?v=3","gravatar_id":"","url":"https://api.github.com/users/afeld","html_url":"https://github.com/afeld","followers_url":"https://api.github.com/users/afeld/followers","following_url":"https://api.github.com/users/afeld/following{/other_user}","gists_url":"https://api.github.com/users/afeld/gists{/gist_id}","starred_url":"https://api.github.com/users/afeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afeld/subscriptions","organizations_url":"https://api.github.com/users/afeld/orgs","repos_url":"https://api.github.com/users/afeld/repos","events_url":"https://api.github.com/users/afeld/events{/privacy}","received_events_url":"https://api.github.com/users/afeld/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/afeld/jsonp","description":"A simple JSON proxy","fork":false,"url":"https://api.github.com/repos/afeld/jsonp","forks_url":"https://api.github.com/repos/afeld/jsonp/forks","keys_url":"https://api.github.com/repos/afeld/jsonp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afeld/jsonp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afeld/jsonp/teams","hooks_url":"https://api.github.com/repos/afeld/jsonp/hooks","issue_events_url":"https://api.github.com/repos/afeld/jsonp/issues/events{/number}","events_url":"https://api.github.com/repos/afeld/jsonp/events","assignees_url":"https://api.github.com/repos/afeld/jsonp/assignees{/user}","branches_url":"https://api.github.com/repos/afeld/jsonp/branches{/branch}","tags_url":"https://api.github.com/repos/afeld/jsonp/tags","blobs_url":"https://api.github.com/repos/afeld/jsonp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afeld/jsonp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afeld/jsonp/git/refs{/sha}","trees_url":"https://api.github.com/repos/afeld/jsonp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afeld/jsonp/statuses/{sha}","languages_url":"https://api.github.com/repos/afeld/jsonp/languages","stargazers_url":"https://api.github.com/repos/afeld/jsonp/stargazers","contributors_url":"https://api.github.com/repos/afeld/jsonp/contributors","subscribers_url":"https://api.github.com/repos/afeld/jsonp/subscribers","subscription_url":"https://api.github.com/repos/afeld/jsonp/subscription","commits_url":"https://api.github.com/repos/afeld/jsonp/commits{/sha}","git_commits_url":"https://api.github.com/repos/afeld/jsonp/git/commits{/sha}","comments_url":"https://api.github.com/repos/afeld/jsonp/comments{/number}","issue_comment_url":"https://api.github.com/repos/afeld/jsonp/issues/comments{/number}","contents_url":"https://api.github.com/repos/afeld/jsonp/contents/{+path}","compare_url":"https://api.github.com/repos/afeld/jsonp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afeld/jsonp/merges","archive_url":"https://api.github.com/repos/afeld/jsonp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afeld/jsonp/downloads","issues_url":"https://api.github.com/repos/afeld/jsonp/issues{/number}","pulls_url":"https://api.github.com/repos/afeld/jsonp/pulls{/number}","milestones_url":"https://api.github.com/repos/afeld/jsonp/milestones{/number}","notifications_url":"https://api.github.com/repos/afeld/jsonp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afeld/jsonp/labels{/name}","releases_url":"https://api.github.com/repos/afeld/jsonp/releases{/id}","created_at":"2012-05-10T09:51:16Z","updated_at":"2015-11-05T14:06:47Z","pushed_at":"2015-11-11T16:17:19Z","git_url":"git://github.com/afeld/jsonp.git","ssh_url":"git@github.com:afeld/jsonp.git","clone_url":"https://github.com/afeld/jsonp.git","svn_url":"https://github.com/afeld/jsonp","homepage":"https://jsonp.afeld.me","size":1439,"stargazers_count":178,"watchers_count":178,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":178,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/71"},"html":{"href":"https://github.com/afeld/jsonp/pull/71"},"issue":{"href":"https://api.github.com/repos/afeld/jsonp/issues/71"},"comments":{"href":"https://api.github.com/repos/afeld/jsonp/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/afeld/jsonp/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/afeld/jsonp/statuses/81fcf0c2ee64d0bb89539d1d0698f1e6a4f6e854"}}}}