firewall

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoTCP = Protocol("tcp")
	ProtoUDP = Protocol("udp")
	ProtoAll = Protocol("all")
)
View Source
const (
	AddressNone   = AddressType("")
	AddressSimple = AddressType("simple")
	AddressMask   = AddressType("mask")
	AddressRange  = AddressType("range")
)
View Source
const (
	RuleBlock = RuleType("block")
	RuleAllow = RuleType("allow")
)
View Source
const (
	AllPorts = "1:65535"
)

Variables

This section is empty.

Functions

func Apply

func Apply(rules []Rule, drops DropConfig) (err error)

func Reset

func Reset() error

func SetPath

func SetPath(bin string) (err error)

Types

type AddressType

type AddressType string

type DropConfig

type DropConfig struct {
	Log    bool   `yaml:"log"`
	Limit  string `yaml:"limit"`
	Prefix string `yaml:"prefix"`
	Level  int    `yaml:"level"`
}

type Protocol

type Protocol string

type Rule

type Rule struct {
	CreatedAt   time.Time   `json:"created_at"`
	TTL         int         `json:"ttl"`  // used from the api to delete expired rules
	Type        RuleType    `json:"type"` // always RuleBlock for now
	Address     string      `json:"address"`
	AddressType AddressType `json:"address_type"`
	Protocol    Protocol    `json:"protocol"`
	Ports       []string    `json:"ports"` // strings to also allow ranges
}

func (Rule) Expired

func (r Rule) Expired() bool

func (Rule) Expires

func (r Rule) Expires() bool

func (*Rule) Validate

func (r *Rule) Validate() error

type RuleType

type RuleType string

Jump to

Keyboard shortcuts

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