{"action":"created","comment":{"url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/comments/26450147","id":26450147,"diff_hunk":"@@ -27,17 +27,42 @@ const (\n )\n \n var (\n-\tlog = golog.LoggerFor(\"flashlight.server\")\n-\n-\tregisterPeriod = 5 * time.Minute\n+\tlog               = golog.LoggerFor(\"flashlight.server\")\n+\tregisterPeriod    = 5 * time.Minute\n+\tfrontingProviders = map[string]func(*http.Request) bool{\n+\t\t// WARNING: If you add a provider here, keep in mind that Go's http\n+\t\t// library normalizes all header names so the first letter of every\n+\t\t// dash-separated \"word\" is uppercase while all others are lowercase.\n+\t\t// Also, try and check more than one header to lean on the safe side.\n+\t\t\"cloudflare\": func(req *http.Request) bool {\n+\t\t\treturn hasHeader(req, \"Cf-Connecting-Ip\") || hasHeader(req, \"Cf-Ipcountry\") || hasHeader(req, \"Cf-Ray\") || hasHeader(req, \"Cf-Visitor\")\n+\t\t},\n+\t\t\"cloudfront\": func(req *http.Request) bool {\n+\t\t\treturn hasHeader(req, \"X-Amz-Cf-Id\") || headerMatches(req, \"User-Agent\", \"Amazon Cloudfront\")\n+\t\t},\n+\t}\n )\n \n+func headerMatches(req *http.Request, name string, value string) bool {\n+\tfor _, entry := range req.Header[name] {\n+\t\tif entry == value {","path":"src/github.com/getlantern/flashlight/server/server.go","position":43,"original_position":43,"commit_id":"135a09f1e165d15fa330be3df7c99769e3eca4f6","original_commit_id":"135a09f1e165d15fa330be3df7c99769e3eca4f6","user":{"login":"myleshorton","id":1143966,"avatar_url":"https://avatars.githubusercontent.com/u/1143966?v=3","gravatar_id":"","url":"https://api.github.com/users/myleshorton","html_url":"https://github.com/myleshorton","followers_url":"https://api.github.com/users/myleshorton/followers","following_url":"https://api.github.com/users/myleshorton/following{/other_user}","gists_url":"https://api.github.com/users/myleshorton/gists{/gist_id}","starred_url":"https://api.github.com/users/myleshorton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myleshorton/subscriptions","organizations_url":"https://api.github.com/users/myleshorton/orgs","repos_url":"https://api.github.com/users/myleshorton/repos","events_url":"https://api.github.com/users/myleshorton/events{/privacy}","received_events_url":"https://api.github.com/users/myleshorton/received_events","type":"User","site_admin":false},"body":"Might also make sense to just always test lowercased versions since HTTP headers are case-insensitive.","created_at":"2015-03-15T17:58:41Z","updated_at":"2015-03-15T17:58:41Z","html_url":"https://github.com/getlantern/flashlight-build/pull/129#discussion_r26450147","pull_request_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/comments/26450147"},"html":{"href":"https://github.com/getlantern/flashlight-build/pull/129#discussion_r26450147"},"pull_request":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129","id":31202404,"html_url":"https://github.com/getlantern/flashlight-build/pull/129","diff_url":"https://github.com/getlantern/flashlight-build/pull/129.diff","patch_url":"https://github.com/getlantern/flashlight-build/pull/129.patch","issue_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/129","number":129,"state":"open","locked":false,"title":"Multifront valencia nodeps","user":{"login":"aranhoide","id":2204867,"avatar_url":"https://avatars.githubusercontent.com/u/2204867?v=3","gravatar_id":"","url":"https://api.github.com/users/aranhoide","html_url":"https://github.com/aranhoide","followers_url":"https://api.github.com/users/aranhoide/followers","following_url":"https://api.github.com/users/aranhoide/following{/other_user}","gists_url":"https://api.github.com/users/aranhoide/gists{/gist_id}","starred_url":"https://api.github.com/users/aranhoide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranhoide/subscriptions","organizations_url":"https://api.github.com/users/aranhoide/orgs","repos_url":"https://api.github.com/users/aranhoide/repos","events_url":"https://api.github.com/users/aranhoide/events{/privacy}","received_events_url":"https://api.github.com/users/aranhoide/received_events","type":"User","site_admin":false},"body":"**DON'T MERGE THIS**: this is just the same as https://github.com/getlantern/flashlight-build/pull/128 except the AWS and DNSimple bindings have been removed to make the diff more workable.  Feel free to comment here, but please merge https://github.com/getlantern/flashlight-build/pull/128, not this, when you're done.\r\n\r\nRemoving these libraries broke travis; don't worry about that, the original PR passes CI tests.","created_at":"2015-03-15T16:06:07Z","updated_at":"2015-03-15T17:58:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76d3555d92ac8bc723d0d795042ef5bf684e38ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129/commits","review_comments_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129/comments","review_comment_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/129/comments","statuses_url":"https://api.github.com/repos/getlantern/flashlight-build/statuses/135a09f1e165d15fa330be3df7c99769e3eca4f6","head":{"label":"getlantern:multifront-valencia-nodeps","ref":"multifront-valencia-nodeps","sha":"135a09f1e165d15fa330be3df7c99769e3eca4f6","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":27652771,"name":"flashlight-build","full_name":"getlantern/flashlight-build","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/flashlight-build","description":"Repeatable builds for flashlight, using gox","fork":false,"url":"https://api.github.com/repos/getlantern/flashlight-build","forks_url":"https://api.github.com/repos/getlantern/flashlight-build/forks","keys_url":"https://api.github.com/repos/getlantern/flashlight-build/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/flashlight-build/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/flashlight-build/teams","hooks_url":"https://api.github.com/repos/getlantern/flashlight-build/hooks","issue_events_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/flashlight-build/events","assignees_url":"https://api.github.com/repos/getlantern/flashlight-build/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/flashlight-build/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/flashlight-build/tags","blobs_url":"https://api.github.com/repos/getlantern/flashlight-build/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/flashlight-build/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/flashlight-build/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/flashlight-build/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/flashlight-build/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/flashlight-build/languages","stargazers_url":"https://api.github.com/repos/getlantern/flashlight-build/stargazers","contributors_url":"https://api.github.com/repos/getlantern/flashlight-build/contributors","subscribers_url":"https://api.github.com/repos/getlantern/flashlight-build/subscribers","subscription_url":"https://api.github.com/repos/getlantern/flashlight-build/subscription","commits_url":"https://api.github.com/repos/getlantern/flashlight-build/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/flashlight-build/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/flashlight-build/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/flashlight-build/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/flashlight-build/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/flashlight-build/merges","archive_url":"https://api.github.com/repos/getlantern/flashlight-build/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/flashlight-build/downloads","issues_url":"https://api.github.com/repos/getlantern/flashlight-build/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/flashlight-build/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/flashlight-build/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/flashlight-build/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/flashlight-build/releases{/id}","created_at":"2014-12-06T23:27:18Z","updated_at":"2015-03-14T22:00:02Z","pushed_at":"2015-03-15T17:32:50Z","git_url":"git://github.com/getlantern/flashlight-build.git","ssh_url":"git@github.com:getlantern/flashlight-build.git","clone_url":"https://github.com/getlantern/flashlight-build.git","svn_url":"https://github.com/getlantern/flashlight-build","homepage":"","size":181822,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"valencia"}},"base":{"label":"getlantern:valencia","ref":"valencia","sha":"fd8ff241c57fcc73a407da82b9bca1d2c33baa2e","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":27652771,"name":"flashlight-build","full_name":"getlantern/flashlight-build","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/flashlight-build","description":"Repeatable builds for flashlight, using gox","fork":false,"url":"https://api.github.com/repos/getlantern/flashlight-build","forks_url":"https://api.github.com/repos/getlantern/flashlight-build/forks","keys_url":"https://api.github.com/repos/getlantern/flashlight-build/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/flashlight-build/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/flashlight-build/teams","hooks_url":"https://api.github.com/repos/getlantern/flashlight-build/hooks","issue_events_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/flashlight-build/events","assignees_url":"https://api.github.com/repos/getlantern/flashlight-build/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/flashlight-build/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/flashlight-build/tags","blobs_url":"https://api.github.com/repos/getlantern/flashlight-build/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/flashlight-build/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/flashlight-build/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/flashlight-build/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/flashlight-build/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/flashlight-build/languages","stargazers_url":"https://api.github.com/repos/getlantern/flashlight-build/stargazers","contributors_url":"https://api.github.com/repos/getlantern/flashlight-build/contributors","subscribers_url":"https://api.github.com/repos/getlantern/flashlight-build/subscribers","subscription_url":"https://api.github.com/repos/getlantern/flashlight-build/subscription","commits_url":"https://api.github.com/repos/getlantern/flashlight-build/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/flashlight-build/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/flashlight-build/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/flashlight-build/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/flashlight-build/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/flashlight-build/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/flashlight-build/merges","archive_url":"https://api.github.com/repos/getlantern/flashlight-build/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/flashlight-build/downloads","issues_url":"https://api.github.com/repos/getlantern/flashlight-build/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/flashlight-build/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/flashlight-build/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/flashlight-build/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/flashlight-build/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/flashlight-build/releases{/id}","created_at":"2014-12-06T23:27:18Z","updated_at":"2015-03-14T22:00:02Z","pushed_at":"2015-03-15T17:32:50Z","git_url":"git://github.com/getlantern/flashlight-build.git","ssh_url":"git@github.com:getlantern/flashlight-build.git","clone_url":"https://github.com/getlantern/flashlight-build.git","svn_url":"https://github.com/getlantern/flashlight-build","homepage":"","size":181822,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"valencia"}},"_links":{"self":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129"},"html":{"href":"https://github.com/getlantern/flashlight-build/pull/129"},"issue":{"href":"https://api.github.com/repos/getlantern/flashlight-build/issues/129"},"comments":{"href":"https://api.github.com/repos/getlantern/flashlight-build/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getlantern/flashlight-build/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/getlantern/flashlight-build/statuses/135a09f1e165d15fa330be3df7c99769e3eca4f6"}}}}