{"id":20229569,"url":"https://github.com/janeczku/go-ipset","last_synced_at":"2025-08-19T22:32:44.555Z","repository":{"id":57495866,"uuid":"41363272","full_name":"janeczku/go-ipset","owner":"janeczku","description":":fire: Go bindings for the IPtables ipset http://ipset.netfilter.org userspace utility","archived":false,"fork":false,"pushed_at":"2023-03-01T08:18:00.000Z","size":10,"stargazers_count":122,"open_issues_count":8,"forks_count":53,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-08T04:41:47.931Z","etag":null,"topics":["go","ipset","iptables"],"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/janeczku.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":"2015-08-25T12:55:09.000Z","updated_at":"2024-05-26T15:10:45.000Z","dependencies_parsed_at":"2024-06-18T15:59:31.754Z","dependency_job_id":"fa25f669-6194-4d34-b5bd-638a738e010d","html_url":"https://github.com/janeczku/go-ipset","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janeczku%2Fgo-ipset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janeczku%2Fgo-ipset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janeczku%2Fgo-ipset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janeczku%2Fgo-ipset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janeczku","download_url":"https://codeload.github.com/janeczku/go-ipset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230374126,"owners_count":18216042,"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","ipset","iptables"],"created_at":"2024-11-14T07:36:10.209Z","updated_at":"2024-12-19T04:07:44.269Z","avatar_url":"https://github.com/janeczku.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ipset #\n\nThis library is a simple GoLang wrapper to the IPtables ipset userspace utility.\nIt provides an interface to allow Go programs to easily manipulate ipsets.\nIt is currently limited to sets of `type hash`.\n\nFor ipset command documentation: http://ipset.netfilter.org/ipset.man.html\n\ngo-ipset requires ipset kernel module and userspace utility version 6.0 or greater.\n\n## Installation ##\n\nInstall go-ipset using the \"go get\" command:\n\n    go get github.com/janeczku/go-ipset/ipset\n\nInstall dependencies:\n\n    go get github.com/Sirupsen/logrus\n    go get github.com/coreos/go-semver/semver\n\n## API Reference ##\n\n[![GoDoc](https://godoc.org/github.com/google/go-github/github?status.svg)](https://godoc.org/github.com/janeczku/go-ipset/ipset)\n\n## Usage ##\n\n```go\nimport \"github.com/janeczku/go-ipset/ipset\n```\n\n#### Create a new set\n\nConstruct a new IPset instance (creating the set on the fly), then use the various methods to manipulate the IPset.\nFor example, to create a new ipset \"customers\" of type `hash:ip` for storing plain IPv4 addresses:\n\n```go\ncustomers := ipset.New(\"customers\", \"hash:ip\", \u0026ipset.Params{})\n```\n\nTo create a new ipset to store different sized IPv4 network addresses (with /mask).\n\n```go\ntrustedNetworks := ipset.New(\"trusted-networks\", \"hash:net\", \u0026ipset.Params{})\n```\n\n#### Add a single entry to the set\n\n```go\ncustomers.Add(\"8.8.2.2\")\n```\n\n#### Populate the set with IPv4 addresses (overwriting the previous content)\n\n```go\nips := []string{\"8.8.8.8\", \"8.8.4.4\"}\ncustomers.Refresh(ips)\n```\n\n#### Remove a single entry from that set:\n\n```go\ncustomers.Del(\"8.8.8.8\")\n```\n\n#### Configure advanced set options\n\nYou can configure advanced options when creating a new set by supplying the parameters in the `ipset.Params` struct.\n\n```go\ntype Params struct {\n  HashFamily string\n  HashSize   int\n  MaxElem    int\n  Timeout    int\n}\n```\nSee http://ipset.netfilter.org/ipset.man.html for their meaning.\n\nFor example, to create a set whose entries will expire after 60 seconds, lets say for temporarily limiting abusive clients:\n\n```go\nabusers := ipset.New(\"ratelimited\", \"hash:ip\", \u0026ipset.Params{Timeout: 60})\n```\n\n#### List entries of a set\n```go\n// list is []string\nlist ipset.List(\"customers\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaneczku%2Fgo-ipset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaneczku%2Fgo-ipset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaneczku%2Fgo-ipset/lists"}