{"id":24578441,"url":"https://github.com/iiiceoo/iprange","last_synced_at":"2025-04-23T20:16:59.941Z","repository":{"id":161402540,"uuid":"627355510","full_name":"iiiceoo/iprange","owner":"iiiceoo","description":"IPv4/IPv6 addresses parser for IP range format.","archived":false,"fork":false,"pushed_at":"2024-06-28T13:21:54.000Z","size":76,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T20:16:40.666Z","etag":null,"topics":["go","iprange","ipv4","ipv6","networking"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iiiceoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-13T09:45:22.000Z","updated_at":"2024-06-28T13:21:00.000Z","dependencies_parsed_at":"2024-05-11T09:40:30.020Z","dependency_job_id":null,"html_url":"https://github.com/iiiceoo/iprange","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiiceoo%2Fiprange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiiceoo%2Fiprange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiiceoo%2Fiprange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iiiceoo%2Fiprange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iiiceoo","download_url":"https://codeload.github.com/iiiceoo/iprange/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250506146,"owners_count":21441723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","iprange","ipv4","ipv6","networking"],"created_at":"2025-01-23T23:59:31.620Z","updated_at":"2025-04-23T20:16:59.910Z","avatar_url":"https://github.com/iiiceoo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iprange\n\n[![GoDoc](https://godoc.org/github.com/iiiceoo/iprange?status.svg)](https://godoc.org/github.com/iiiceoo/iprange)\n[![codecov](https://codecov.io/gh/iiiceoo/iprange/branch/main/graph/badge.svg?token=7STDXD53G0)](https://codecov.io/gh/iiiceoo/iprange)\n\n*Package iprange parses IPv4/IPv6 addresses from strings in IP range format.*\n\n## Supported IP range formats\n\n- `172.18.0.1` / `fd00::1`\n- `172.18.0.0/24` / `fd00::/64`\n- `172.18.0.1-10` / `fd00::1-a`\n- `172.18.0.1-172.18.1.10` / `fd00::1-fd00::1:a`\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/iiiceoo/iprange\"\n)\n\nfunc main() {\n\t// Parse IP ranges.\n\tranges, err := iprange.Parse(\n\t\t\"172.18.0.1\",\n\t\t\"172.18.0.0/24\",\n\t\t\"172.18.0.1-10\",\n\t\t\"172.18.1.1-172.18.1.3\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to parse IP ranges: %v\\n\", err)\n\t}\n\tfmt.Printf(\"%s IP ranges: %s\\n\", ranges.Version(), ranges)\n\n\t// Merge IP ranges.\n\tmerged := ranges.Merge()\n\tfmt.Printf(\"Merged IP ranges: %s\\n\", merged)\n\n\t// Interval mathematics of IP ranges.\n\tanother, _ := iprange.Parse(\"172.18.0.0/24\")\n\tdiff := merged.Diff(another)\n\tfmt.Printf(\"The difference between two IP ranges: %s\\n\", diff)\n\n\t// Convert IP ranges to IP addresses.\n\tfmt.Printf(\"Iterate through all %d IP addresses:\\n\", diff.Size())\n\tipIter := diff.IPIterator()\n\tfor {\n\t\tip := ipIter.Next()\n\t\tif ip == nil {\n\t\t\tbreak\n\t\t}\n\t\tfmt.Println(ip)\n\t}\n}\n```\n\n## License\n\nPackage iprange is MIT-Licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiiiceoo%2Fiprange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiiiceoo%2Fiprange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiiiceoo%2Fiprange/lists"}