Skip to content

Minimal Go bindings for libipset3

License

Notifications You must be signed in to change notification settings

inverse-inc/go-ipset

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 82.6%
  • C 17.4%