ipset

package
v0.0.0-...-7990f22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package ipset provides interaction with ipset (ipset.netfilter.org)

It runs ipset in interactive mode (ipset -) instead of running the binary on every call.

Example of usage:

		package main
		import (
			"github.com/42wim/ipsetd/ipset"
			"fmt"
		)

		func main() {
	 		ipset := NewIPset("/usr/sbin/ipset")
	 		fmt.Print(ipset.Cmd("version"))
	 		fmt.Print(ipset.Cmd("create abc hash:ip"))
	 		fmt.Print(ipset.Cmd("add abc 1.2.3.4"))
 	}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPset

type IPset struct {
	// contains filtered or unexported fields
}

IPset struct

func NewIPset

func NewIPset(path string) *IPset

NewIPset starts ipset specified with path in interactive mode (ipset - ) and returns a new IPset.

func NewIPsetExtra

func NewIPsetExtra(path string, args ...string) *IPset

func NewWithIgnore

func NewWithIgnore(path string) *IPset

NewWithIgnore starts ipset specified with path in interactive mode (ipset -! - ) with ignore errors and returns a new IPset.

func (*IPset) Cmd

func (ipset *IPset) Cmd(cmd string) (string, error)

Cmd executes the ipset command and returns the output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL