firewall

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPv4 = IPType(4)
	IPv6 = IPType(6)
)
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

View Source
var DryRun = false

Functions

func Apply

func Apply(rules []Rule, drops DropConfig) (err 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 IPType added in v1.2.0

type IPType int

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
	Comment     string      `json:"comment"`
}

func (Rule) Expired

func (r Rule) Expired() bool

func (Rule) Expires

func (r Rule) Expires() bool

func (Rule) IPType added in v1.2.0

func (r Rule) IPType() IPType

func (Rule) Protocols added in v1.2.0

func (r Rule) Protocols() []string

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