Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

gmccue/go-ipset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-ipset

Build Status GoDoc

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.
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages