util

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAllowedNetworkChainRule

func CreateAllowedNetworkChainRule(chain string, net string) string

func CreateDefaultNetworkChainRule

func CreateDefaultNetworkChainRule(chain string) string

func CreateEmptyChainRule

func CreateEmptyChainRule(chainName string) string

func CreateRestrictedPortsAddRule

func CreateRestrictedPortsAddRule(chain string, ports []string) string

func CreateRestrictedPortsDeleteRule

func CreateRestrictedPortsDeleteRule(chain string, ports []string) string

func CreateRestrictedPortsMatchRule

func CreateRestrictedPortsMatchRule(chain string, ports []string) string

func DiffSets

func DiffSets(old map[string]bool, new map[string]bool) (added map[string]bool, deleted map[string]bool)

Compare two sets, old and new, and get added and deleted elements

func GetRestrictedPortsFromTablesData

func GetRestrictedPortsFromTablesData(data []byte, chain string) []string

func JoinWords

func JoinWords(words ...string) string

Join all words to line with space as delimiter

func Matched

func Matched(a1, a2 []string) bool

Checks two slices/arrays are matched (have equal sets of unique elements)

func ToSet

func ToSet(a []string) map[string]bool

Convert string slice/array to set-like map

func ValidateNetworks

func ValidateNetworks(nets []string) error

Validate slice of IP networks (addresses or CIDRs)

func ValidatePorts

func ValidatePorts(ports []string) error

Validate slice of IP port numbers in string form

func WriteLine

func WriteLine(lines *bytes.Buffer, line string)

Write newline terminated line to the buffer

Types

This section is empty.

Jump to

Keyboard shortcuts

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