repositorypackage
0.0.0-20151126205411-75b14f6e6ee0
Repository: https://github.com/gmccue/go-ipset.git
Documentation: pkg.go.dev
# README
go-ipset
go-ipset provides basic bindings for the ipset kernel utility.
Installation
go get github.com/gmccue/go-ipset
Usage
The following are some basic usage examples for go-iptables. For more information, please checkout the godoc.
import "github.com/gmccue/ipset"
// Construct a new ipset instance
ipset, err := ipset.New()
if err != nil {
// Your custom error handling here.
}
// Create a new set
err := ipset.Create("my_set", "hash:ip")
if err != nil {
// Your custom error handling here.
}
Adding an entry to an ipset
err := ipset.Add("my_set", "127.0.0.1")
if err != nil {
// Your custom error handling here.
}
Removing an entry from an ipset
if err != nil {
// Your custom error handling here.
}
Save your ipset to a file
err := ipset.Save("my_set", "/tmp/my_set.txt")
if err != nil {
// Your custom error handling here.
}
Restore your ipset from a file
err := ipset.Restore("/tmp/my_set.txt")
if err != nil {
// Your custom error handling here.
}