{"id":23390506,"url":"https://github.com/tty47/go-cidr","last_synced_at":"2025-04-08T14:20:32.436Z","repository":{"id":57627681,"uuid":"403688564","full_name":"tty47/go-cidr","owner":"tty47","description":"Network CIDR checker, it will check from a network CIDR if contains an IP which you send.","archived":false,"fork":false,"pushed_at":"2022-04-06T15:13:13.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T10:43:42.895Z","etag":null,"topics":["cidr","go","golang","ip","ip-add","ip-ranges","network"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jrmanes/go-cidr","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tty47.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}},"created_at":"2021-09-06T16:21:46.000Z","updated_at":"2022-04-06T15:13:17.000Z","dependencies_parsed_at":"2022-09-26T20:11:47.166Z","dependency_job_id":null,"html_url":"https://github.com/tty47/go-cidr","commit_stats":null,"previous_names":["tty47/go-cidr"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tty47%2Fgo-cidr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tty47%2Fgo-cidr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tty47%2Fgo-cidr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tty47%2Fgo-cidr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tty47","download_url":"https://codeload.github.com/tty47/go-cidr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856550,"owners_count":21007621,"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","ip","ip-add","ip-ranges","network"],"created_at":"2024-12-22T03:31:41.492Z","updated_at":"2025-04-08T14:20:32.418Z","avatar_url":"https://github.com/tty47.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-CIDR\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/jrmanes/go-cidr.svg)](https://pkg.go.dev/github.com/jrmanes/go-cidr)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jrmanes/go-cidr)](https://goreportcard.com/report/github.com/jrmanes/go-cidr)\n\n---\n\n## Description\n\nThe purpose of that library is checked an IP inside from a CIDR.\n\n---\n\n## Project structure\n\nThe project structure explained what contains what.\n\n```shell\n├── cmd\n│   ├── bootstrap\n│   │   └── bootstrap.go // point where init the service\n│   └── main.go // entrypoint of the service\n├── pkg\n│   ├── config\n│   │   └── config.go // config structs, methods and functions\n│   ├── ip\n│   │   ├── ip.go // logic to create the hosts from cirds\n│   │   └── ip_test.go // test file for ip pkg\n│   └── store\n│       └── memory\n│           └── memory.go // storage in memory\n└── README.md // Readme\n```\n\n----\n\n## Example\n\nUsing storage in memory:\n```go\npackage main\n\nimport (\n\t\"time\"\n\t\"log\"\n\n\tb \"github.com/jrmanes/go-cidr/cmd/bootstrap\"\n\tm \"github.com/jrmanes/go-cidr/pkg/store/memory\"\n)\n\nfunc main() {\n\t// load configuration\n\tcidr := []string{\"10.251.0.0/16\", \"172.18.0.0/16\", \"192.168.0.0/16\"}\n\n\t// Run the process in order to load the hosts inside the cidr\n\tb.Run(cidr)\n\n\tnow := time.Now()\n\tlog.Println(\"---------FROM MEMORY------------\")\n\tip2CheckInMemory := \"12.251.0.162\"\n\texistsInMemory := m.CheckIfIpExistsInMemory(ip2CheckInMemory)\n\tif existsInMemory {\n\t\tlog.Println(\"IP found ip2CheckInMemory (\", ip2CheckInMemory, \")\", existsInMemory)\n\t} else {\n\t\tlog.Println(\"IP NOT found ip2CheckInMemory (\", ip2CheckInMemory, \")\", existsInMemory)\n\t}\n\tlog.Println(\"elapse using storage memory:\", time.Since(now))\n\tlog.Println(\"-----------------------------\")\n}\n```\n\n----\n\n## TODO\n\n- [ ] Change project structure\n  - [ ] Release 2.0.0\n- [ ] Add more test\n\n----\n\nJose Ramón Mañes\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftty47%2Fgo-cidr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftty47%2Fgo-cidr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftty47%2Fgo-cidr/lists"}