{"id":24196780,"url":"https://github.com/pchchv/goip","last_synced_at":"2025-06-18T14:33:21.291Z","repository":{"id":173289306,"uuid":"650507518","full_name":"pchchv/goip","owner":"pchchv","description":"Go library for handling IP addresses and subnets","archived":false,"fork":false,"pushed_at":"2023-12-24T10:04:44.000Z","size":1978,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T08:23:57.442Z","etag":null,"topics":["go","go-library","go-module","go-package","golang","golang-library","golang-module","golang-package","ip","ipv4","ipv4-network","ipv6","ipv6-network","subnetting"],"latest_commit_sha":null,"homepage":"","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/pchchv.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-06-07T08:07:42.000Z","updated_at":"2023-10-02T07:41:57.000Z","dependencies_parsed_at":"2023-11-16T16:46:17.117Z","dependency_job_id":"c972fa4f-cd96-4598-9c0c-98cc9b1c9495","html_url":"https://github.com/pchchv/goip","commit_stats":null,"previous_names":["pchchv/goip"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pchchv/goip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchchv%2Fgoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchchv%2Fgoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchchv%2Fgoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchchv%2Fgoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pchchv","download_url":"https://codeload.github.com/pchchv/goip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pchchv%2Fgoip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260570350,"owners_count":23029678,"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","go-library","go-module","go-package","golang","golang-library","golang-module","golang-package","ip","ipv4","ipv4-network","ipv6","ipv6-network","subnetting"],"created_at":"2025-01-13T19:38:04.585Z","updated_at":"2025-06-18T14:33:16.272Z","avatar_url":"https://github.com/pchchv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goip [![Go Reference](https://pkg.go.dev/badge/github.com/pchchv/goip.svg)](https://pkg.go.dev/github.com/pchchv/goip)\n\nGo package for handling IP addresses and subnets. IPv4 and IPv6.\n\nWorking with IP addresses and networks, CIDR, address and subnet operations, iterations, content checks, IP to CIDR block lookup, longest prefix match, creating subnets, spanning, merging, ranges and address tries, with polymorphic code\n\n## Usage\n\nstarting with address or subnet strings\n```go\nimport \"github.com/pchchv/goip\"\n\nipv6AddrStr := goip.NewIPAddressString(\"a:b:c:d::a:b/64\")\nif ipAddr, err := ipv6AddrStr.ToAddress(); err != nil {\n\t// error validation\n} else {\n\t// use the address\n}\n```\n...or checking for nil:\n```go\nstr := goip.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:\n```go\nhostStr := \"[::1]\"\nhost := goip.NewHostName(hostStr)\nif err := host.Validate(); err != nil {\n    panic(err)\n}\n\n// use host\nif host.IsAddress() {\n    fmt.Println(\"address: \" + host.AsAddress().String())\n} else {\n    fmt.Println(\"host name: \" + host.String())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpchchv%2Fgoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpchchv%2Fgoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpchchv%2Fgoip/lists"}