{"id":19967032,"url":"https://github.com/seancfoley/ipaddress-go","last_synced_at":"2025-04-10T02:27:52.550Z","repository":{"id":37377634,"uuid":"444110204","full_name":"seancfoley/ipaddress-go","owner":"seancfoley","description":"Go library for handling IP addresses and subnets, both IPv4 and IPv6","archived":false,"fork":false,"pushed_at":"2024-05-19T23:09:07.000Z","size":1911,"stargazers_count":78,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-21T00:47:39.036Z","etag":null,"topics":["cidr","go","golang","golang-library","golang-module","golang-package","ip-address","ipaddress","ipv4","ipv4-address","ipv4-network","ipv4-subnetting","ipv6","ipv6-address","ipv6-network","ipv6-subnetting","mac-address","subnet","subnets","subnetting"],"latest_commit_sha":null,"homepage":"https://seancfoley.github.io/IPAddress/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seancfoley.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":"2022-01-03T15:31:08.000Z","updated_at":"2024-05-30T00:18:23.401Z","dependencies_parsed_at":"2023-02-17T21:31:18.865Z","dependency_job_id":"6ebc6d2a-078b-491f-9898-d330c9e05ff6","html_url":"https://github.com/seancfoley/ipaddress-go","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seancfoley%2Fipaddress-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seancfoley%2Fipaddress-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seancfoley%2Fipaddress-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seancfoley%2Fipaddress-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seancfoley","download_url":"https://codeload.github.com/seancfoley/ipaddress-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143892,"owners_count":21054840,"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":["cidr","go","golang","golang-library","golang-module","golang-package","ip-address","ipaddress","ipv4","ipv4-address","ipv4-network","ipv4-subnetting","ipv6","ipv6-address","ipv6-network","ipv6-subnetting","mac-address","subnet","subnets","subnetting"],"created_at":"2024-11-13T02:39:43.283Z","updated_at":"2025-04-10T02:27:52.521Z","avatar_url":"https://github.com/seancfoley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ipaddress-go\n\n[Go](https://golang.org/) library for handling IP addresses and subnets, both IPv4 and IPv6\n\nIP address and network manipulation, CIDR, address and subnet operations, iterations, containment checks, IP to CIDR block lookup, longest prefix match, subnetting, spanning, merging, ranges, and address tries, with polymorphic code\n\n[View Project Page](https://seancfoley.github.io/IPAddress/)\n\n[View Godoc](https://pkg.go.dev/github.com/seancfoley/ipaddress-go/ipaddr) [![Go Reference](https://pkg.go.dev/badge/github.com/seancfoley/ipaddress-go/ipaddr.svg)](https://pkg.go.dev/github.com/seancfoley/ipaddress-go/ipaddr)\n\n[View Code Examples](https://github.com/seancfoley/ipaddress-go/wiki/Code-Examples)\n\n[View Benchmark Results](https://github.com/seancfoley/ipaddress-go/wiki/Benchmarks)\n\n[View List of Users](https://github.com/seancfoley/ipaddress-go/wiki)\n\n| Version | Notes         |\n| ------- | ------------- |\n| [1.2.1](https://github.com/seancfoley/ipaddress-go/releases/tag/v1.2.1) | Requires Go 1.12 or higher |\n| [1.4.1](https://github.com/seancfoley/ipaddress-go/releases/tag/v1.4.1) | Requires Go 1.13 or higher |\n| [1.7.1](https://github.com/seancfoley/ipaddress-go/releases/tag/v1.7.1) | Requires Go 1.18 or higher |\n\nIn your go.mod file:\\\nrequire github.com/seancfoley/ipaddress-go v1.7.1\n\nIn your source file:\\\nimport \"github.com/seancfoley/ipaddress-go/ipaddr\"\n\nPackaged as a [Linux Fedora rpm](https://src.fedoraproject.org/rpms/golang-github-seancfoley-ipaddress) and as a [Linux Debian](https://tracker.debian.org/pkg/golang-github-seancfoley-ipaddress-go), available from [Ubuntu](https://launchpad.net/ubuntu/+source/golang-github-seancfoley-ipaddress-go)\n\nAlso available as a [Java](https://www.oracle.com/java/) library from the [IPAddress repository](https://github.com/seancfoley/IPAddress)\n\n## Getting Started\n\nstarting with address or subnet strings\n```go\nimport \"github.com/seancfoley/ipaddress-go/ipaddr\"\n\nipv6AddrStr := ipaddr.NewIPAddressString(\"a:b:c:d::a:b/64\")\nif ipAddr, err := ipv6AddrStr.ToAddress(); err != nil {\n\t// err.Error() has validation error\n} else {\n\t// use the address\n}\n```\n...or avoid errors, checking for nil:\n```go\nstr := ipaddr.NewIPAddressString(\"a:b:c:d:e-f:f:1.2-3.3.4/64\")\naddr := str.GetAddress()\nif addr != nil {\n\t// use address\n}\n```\nstarting with host name strings\n```go\nhostStr := \"[::1]\"\n\nhost := ipaddr.NewHostName(hostStr)\nerr := host.Validate()\nif err == nil {\n\tif host.IsAddress() {\n\t\tfmt.Println(\"address: \" + host.AsAddress().String())\n\t} else {\n\t\tfmt.Println(\"host name: \" + host.String())\n\t}\n\t// use host\n} else {\n\tfmt.Println(err.Error())\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseancfoley%2Fipaddress-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseancfoley%2Fipaddress-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseancfoley%2Fipaddress-go/lists"}