inverse-inc / go-ipset

Minimal Go bindings for libipset3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-ipset

These are bindings to libipset3. Currently there is only support for listing sets and adding/removing entries to/from existing sets. If you need a more feature-rich library then take a look at janeczku/go-ipset.

Installation

Install dependencies:

On Debian/Ubuntu execute:

apt install libipset-dev pkg-config

Install go-ipset using the go get command:

go get github.com/digineo/go-ipset

Usage

Create the ipset before:

ipset create myset hash:ip timeout 0

Add the import to your program:

import "github.com/digineo/go-ipset"

List all sets

ipset.ListAll()

List a single set

ipset.List("myset")

Add a single entry to the set

ipset.Add("myset", "192.0.2.23")                  // without timeout
ipset.Add("myset", "192.0.2.23", "timeout", "42") // with timeout

Remove a single entry from the set

ipset.Del("myset", "192.0.2.23")

About

Minimal Go bindings for libipset3

License:MIT License


Languages

Language:Go 82.6%Language:C 17.4%