{"id":18446640,"url":"https://github.com/cristalhq/ipfilterware","last_synced_at":"2025-04-08T00:31:55.654Z","repository":{"id":57632892,"uuid":"410263657","full_name":"cristalhq/ipfilterware","owner":"cristalhq","description":"Go HTTP middleware to filter clients by IP address","archived":false,"fork":false,"pushed_at":"2022-06-14T22:17:46.000Z","size":27,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T23:17:11.653Z","etag":null,"topics":["filtering","firewall","go","golang","http","ip","ipv4","ipv6","middleware","security"],"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/cristalhq.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-25T12:13:47.000Z","updated_at":"2024-06-23T22:35:57.000Z","dependencies_parsed_at":"2022-08-31T13:20:22.555Z","dependency_job_id":null,"html_url":"https://github.com/cristalhq/ipfilterware","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fipfilterware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fipfilterware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fipfilterware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fipfilterware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristalhq","download_url":"https://codeload.github.com/cristalhq/ipfilterware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755400,"owners_count":20990616,"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":["filtering","firewall","go","golang","http","ip","ipv4","ipv6","middleware","security"],"created_at":"2024-11-06T07:09:54.035Z","updated_at":"2025-04-08T00:31:55.323Z","avatar_url":"https://github.com/cristalhq.png","language":"Go","readme":"# ipfilterware\n\n[![build-img]][build-url]\n[![pkg-img]][pkg-url]\n[![reportcard-img]][reportcard-url]\n[![coverage-img]][coverage-url]\n\nGo HTTP middleware to filter clients by IP address.\n\n## Rationale\n\nTo protect your application open to the internet you might want to allow only verified or well-known IPs. This can be easily done via firewall but sometimes you do not have access to such tools (cloud providers, proxies, serverless, etc). To make this real you can check a connection IP and check it with your config. This library does this.\n\n## Features\n\n* Simple API.\n* Clean and tested code.\n* Thread-safe updates.\n* Dependency-free.\n* Fetches for popular providers.\n  * See [fetchers_test.go](https://github.com/cristalhq/ipfilterware/blob/main/fetchers_test.go).\n\n## Install\n\nGo version 1.17+\n\n```\ngo get github.com/cristalhq/ipfilterware\n```\n\n## Example\n\n```go\n// your handler or mux/router\nvar myHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t// do something good\n\tw.WriteHeader(http.StatusOK)\n})\n\n// some IPs to allow (see fetchers_test.go for DNS and proxy helpers)\nips := []string{\"10.20.30.40\", \"100.100.99.1\", \"42.42.42.42\"}\n\n// create ipfilterware handler to pass allowed IPs to myHandler \nhandler, err := ipfilterware.New(myHandler, \u0026ipfilterware.Config{\n\tAllowedIPs: ips,\n})\nif err != nil {\n\tpanic(err)\n}\n\n// use handler as a router or middleware\nhttp.ListenAndServe(\":8080\", handler)\n```\n\n## Documentation\n\nSee [these docs][pkg-url].\n\n## License\n\n[MIT License](LICENSE).\n\n[build-img]: https://github.com/cristalhq/ipfilterware/workflows/build/badge.svg\n[build-url]: https://github.com/cristalhq/ipfilterware/actions\n[pkg-img]: https://pkg.go.dev/badge/cristalhq/ipfilterware\n[pkg-url]: https://pkg.go.dev/github.com/cristalhq/ipfilterware\n[reportcard-img]: https://goreportcard.com/badge/cristalhq/ipfilterware\n[reportcard-url]: https://goreportcard.com/report/cristalhq/ipfilterware\n[coverage-img]: https://codecov.io/gh/cristalhq/ipfilterware/branch/master/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/cristalhq/ipfilterware\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fipfilterware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristalhq%2Fipfilterware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fipfilterware/lists"}