{"action":"closed","number":21,"pull_request":{"url":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21","id":70347757,"html_url":"https://github.com/jsakamoto/ipaddressrange/pull/21","diff_url":"https://github.com/jsakamoto/ipaddressrange/pull/21.diff","patch_url":"https://github.com/jsakamoto/ipaddressrange/pull/21.patch","issue_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/21","number":21,"state":"closed","locked":false,"title":"Add ToCidrString()","user":{"login":"richardlawley","id":1608083,"avatar_url":"https://avatars.githubusercontent.com/u/1608083?v=3","gravatar_id":"","url":"https://api.github.com/users/richardlawley","html_url":"https://github.com/richardlawley","followers_url":"https://api.github.com/users/richardlawley/followers","following_url":"https://api.github.com/users/richardlawley/following{/other_user}","gists_url":"https://api.github.com/users/richardlawley/gists{/gist_id}","starred_url":"https://api.github.com/users/richardlawley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardlawley/subscriptions","organizations_url":"https://api.github.com/users/richardlawley/orgs","repos_url":"https://api.github.com/users/richardlawley/repos","events_url":"https://api.github.com/users/richardlawley/events{/privacy}","received_events_url":"https://api.github.com/users/richardlawley/received_events","type":"User","site_admin":false},"body":"This PR adds a `.ToCidrString()` and .`PrefixLength()` which returns a Cidr notation form of a subnet, if the subnet exactly matches a range.\r\n\r\nExamples:\r\n```\r\nIPAddressRange.Parse(\"192.168.0.0-192.168.0.255\").PrefixLength(); // 24\r\nIPAddressRange.Parse(\"192.168.0.0-192.168.0.255\").ToCidrString(); // 192.168.0.0/24\r\nIPAddressRange.Parse(\"fe80::-fe80:ffff:ffff:ffff:ffff:ffff:ffff:ffff\").PrefixLength(); // 16\r\nIPAddressRange.Parse(\"fe80::-fe80:ffff:ffff:ffff:ffff:ffff:ffff:ffff\").ToCidrString(); // fe80::/16\r\n```\r\nIf Begin and End do not align with any valid subnets, then FormatException is thrown.","created_at":"2016-05-17T12:26:55Z","updated_at":"2016-05-23T08:52:10Z","closed_at":"2016-05-23T08:52:10Z","merged_at":"2016-05-23T08:52:10Z","merge_commit_sha":"df73c67ad902b691f14ad82e3b3a35a1760352e9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21/commits","review_comments_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21/comments","review_comment_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/21/comments","statuses_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/statuses/df73c67ad902b691f14ad82e3b3a35a1760352e9","head":{"label":"richardlawley:cidrstring","ref":"cidrstring","sha":"df73c67ad902b691f14ad82e3b3a35a1760352e9","user":{"login":"richardlawley","id":1608083,"avatar_url":"https://avatars.githubusercontent.com/u/1608083?v=3","gravatar_id":"","url":"https://api.github.com/users/richardlawley","html_url":"https://github.com/richardlawley","followers_url":"https://api.github.com/users/richardlawley/followers","following_url":"https://api.github.com/users/richardlawley/following{/other_user}","gists_url":"https://api.github.com/users/richardlawley/gists{/gist_id}","starred_url":"https://api.github.com/users/richardlawley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardlawley/subscriptions","organizations_url":"https://api.github.com/users/richardlawley/orgs","repos_url":"https://api.github.com/users/richardlawley/repos","events_url":"https://api.github.com/users/richardlawley/events{/privacy}","received_events_url":"https://api.github.com/users/richardlawley/received_events","type":"User","site_admin":false},"repo":{"id":59018726,"name":"ipaddressrange","full_name":"richardlawley/ipaddressrange","owner":{"login":"richardlawley","id":1608083,"avatar_url":"https://avatars.githubusercontent.com/u/1608083?v=3","gravatar_id":"","url":"https://api.github.com/users/richardlawley","html_url":"https://github.com/richardlawley","followers_url":"https://api.github.com/users/richardlawley/followers","following_url":"https://api.github.com/users/richardlawley/following{/other_user}","gists_url":"https://api.github.com/users/richardlawley/gists{/gist_id}","starred_url":"https://api.github.com/users/richardlawley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardlawley/subscriptions","organizations_url":"https://api.github.com/users/richardlawley/orgs","repos_url":"https://api.github.com/users/richardlawley/repos","events_url":"https://api.github.com/users/richardlawley/events{/privacy}","received_events_url":"https://api.github.com/users/richardlawley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/richardlawley/ipaddressrange","description":".NET Class Library for range of IP address, both IPv4 and IPv6.","fork":true,"url":"https://api.github.com/repos/richardlawley/ipaddressrange","forks_url":"https://api.github.com/repos/richardlawley/ipaddressrange/forks","keys_url":"https://api.github.com/repos/richardlawley/ipaddressrange/keys{/key_id}","collaborators_url":"https://api.github.com/repos/richardlawley/ipaddressrange/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/richardlawley/ipaddressrange/teams","hooks_url":"https://api.github.com/repos/richardlawley/ipaddressrange/hooks","issue_events_url":"https://api.github.com/repos/richardlawley/ipaddressrange/issues/events{/number}","events_url":"https://api.github.com/repos/richardlawley/ipaddressrange/events","assignees_url":"https://api.github.com/repos/richardlawley/ipaddressrange/assignees{/user}","branches_url":"https://api.github.com/repos/richardlawley/ipaddressrange/branches{/branch}","tags_url":"https://api.github.com/repos/richardlawley/ipaddressrange/tags","blobs_url":"https://api.github.com/repos/richardlawley/ipaddressrange/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/richardlawley/ipaddressrange/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/richardlawley/ipaddressrange/git/refs{/sha}","trees_url":"https://api.github.com/repos/richardlawley/ipaddressrange/git/trees{/sha}","statuses_url":"https://api.github.com/repos/richardlawley/ipaddressrange/statuses/{sha}","languages_url":"https://api.github.com/repos/richardlawley/ipaddressrange/languages","stargazers_url":"https://api.github.com/repos/richardlawley/ipaddressrange/stargazers","contributors_url":"https://api.github.com/repos/richardlawley/ipaddressrange/contributors","subscribers_url":"https://api.github.com/repos/richardlawley/ipaddressrange/subscribers","subscription_url":"https://api.github.com/repos/richardlawley/ipaddressrange/subscription","commits_url":"https://api.github.com/repos/richardlawley/ipaddressrange/commits{/sha}","git_commits_url":"https://api.github.com/repos/richardlawley/ipaddressrange/git/commits{/sha}","comments_url":"https://api.github.com/repos/richardlawley/ipaddressrange/comments{/number}","issue_comment_url":"https://api.github.com/repos/richardlawley/ipaddressrange/issues/comments{/number}","contents_url":"https://api.github.com/repos/richardlawley/ipaddressrange/contents/{+path}","compare_url":"https://api.github.com/repos/richardlawley/ipaddressrange/compare/{base}...{head}","merges_url":"https://api.github.com/repos/richardlawley/ipaddressrange/merges","archive_url":"https://api.github.com/repos/richardlawley/ipaddressrange/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/richardlawley/ipaddressrange/downloads","issues_url":"https://api.github.com/repos/richardlawley/ipaddressrange/issues{/number}","pulls_url":"https://api.github.com/repos/richardlawley/ipaddressrange/pulls{/number}","milestones_url":"https://api.github.com/repos/richardlawley/ipaddressrange/milestones{/number}","notifications_url":"https://api.github.com/repos/richardlawley/ipaddressrange/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/richardlawley/ipaddressrange/labels{/name}","releases_url":"https://api.github.com/repos/richardlawley/ipaddressrange/releases{/id}","deployments_url":"https://api.github.com/repos/richardlawley/ipaddressrange/deployments","created_at":"2016-05-17T12:03:36Z","updated_at":"2016-05-17T12:03:37Z","pushed_at":"2016-05-23T08:43:05Z","git_url":"git://github.com/richardlawley/ipaddressrange.git","ssh_url":"git@github.com:richardlawley/ipaddressrange.git","clone_url":"https://github.com/richardlawley/ipaddressrange.git","svn_url":"https://github.com/richardlawley/ipaddressrange","homepage":null,"size":281,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"jsakamoto:master","ref":"master","sha":"2d47eb83aae05c47b996def2f4a305757eab4b91","user":{"login":"jsakamoto","id":95908,"avatar_url":"https://avatars.githubusercontent.com/u/95908?v=3","gravatar_id":"","url":"https://api.github.com/users/jsakamoto","html_url":"https://github.com/jsakamoto","followers_url":"https://api.github.com/users/jsakamoto/followers","following_url":"https://api.github.com/users/jsakamoto/following{/other_user}","gists_url":"https://api.github.com/users/jsakamoto/gists{/gist_id}","starred_url":"https://api.github.com/users/jsakamoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsakamoto/subscriptions","organizations_url":"https://api.github.com/users/jsakamoto/orgs","repos_url":"https://api.github.com/users/jsakamoto/repos","events_url":"https://api.github.com/users/jsakamoto/events{/privacy}","received_events_url":"https://api.github.com/users/jsakamoto/received_events","type":"User","site_admin":false},"repo":{"id":4353198,"name":"ipaddressrange","full_name":"jsakamoto/ipaddressrange","owner":{"login":"jsakamoto","id":95908,"avatar_url":"https://avatars.githubusercontent.com/u/95908?v=3","gravatar_id":"","url":"https://api.github.com/users/jsakamoto","html_url":"https://github.com/jsakamoto","followers_url":"https://api.github.com/users/jsakamoto/followers","following_url":"https://api.github.com/users/jsakamoto/following{/other_user}","gists_url":"https://api.github.com/users/jsakamoto/gists{/gist_id}","starred_url":"https://api.github.com/users/jsakamoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsakamoto/subscriptions","organizations_url":"https://api.github.com/users/jsakamoto/orgs","repos_url":"https://api.github.com/users/jsakamoto/repos","events_url":"https://api.github.com/users/jsakamoto/events{/privacy}","received_events_url":"https://api.github.com/users/jsakamoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsakamoto/ipaddressrange","description":".NET Class Library for range of IP address, both IPv4 and IPv6.","fork":false,"url":"https://api.github.com/repos/jsakamoto/ipaddressrange","forks_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/forks","keys_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/teams","hooks_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/hooks","issue_events_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/events{/number}","events_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/events","assignees_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/assignees{/user}","branches_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/branches{/branch}","tags_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/tags","blobs_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/statuses/{sha}","languages_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/languages","stargazers_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/stargazers","contributors_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/contributors","subscribers_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/subscribers","subscription_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/subscription","commits_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/contents/{+path}","compare_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/merges","archive_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/downloads","issues_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues{/number}","pulls_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls{/number}","milestones_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/milestones{/number}","notifications_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/labels{/name}","releases_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/releases{/id}","deployments_url":"https://api.github.com/repos/jsakamoto/ipaddressrange/deployments","created_at":"2012-05-17T00:09:23Z","updated_at":"2016-05-02T20:46:32Z","pushed_at":"2016-05-23T08:52:10Z","git_url":"git://github.com/jsakamoto/ipaddressrange.git","ssh_url":"git@github.com:jsakamoto/ipaddressrange.git","clone_url":"https://github.com/jsakamoto/ipaddressrange.git","svn_url":"https://github.com/jsakamoto/ipaddressrange","homepage":null,"size":530,"stargazers_count":40,"watchers_count":40,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":3,"forks":12,"open_issues":3,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21"},"html":{"href":"https://github.com/jsakamoto/ipaddressrange/pull/21"},"issue":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/21"},"comments":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/jsakamoto/ipaddressrange/statuses/df73c67ad902b691f14ad82e3b3a35a1760352e9"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"jsakamoto","id":95908,"avatar_url":"https://avatars.githubusercontent.com/u/95908?v=3","gravatar_id":"","url":"https://api.github.com/users/jsakamoto","html_url":"https://github.com/jsakamoto","followers_url":"https://api.github.com/users/jsakamoto/followers","following_url":"https://api.github.com/users/jsakamoto/following{/other_user}","gists_url":"https://api.github.com/users/jsakamoto/gists{/gist_id}","starred_url":"https://api.github.com/users/jsakamoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsakamoto/subscriptions","organizations_url":"https://api.github.com/users/jsakamoto/orgs","repos_url":"https://api.github.com/users/jsakamoto/repos","events_url":"https://api.github.com/users/jsakamoto/events{/privacy}","received_events_url":"https://api.github.com/users/jsakamoto/received_events","type":"User","site_admin":false},"comments":9,"review_comments":0,"commits":2,"additions":125,"deletions":1,"changed_files":3}}
{"actor":{"display_login":"jsakamoto"}}