iptables

package
v0.0.0-...-c7476d4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainPreRouting  Chain = "PREROUTING"
	ChainInput             = "INPUT"
	ChainForward           = "FORWARD"
	ChainOutput            = "OUTPUT"
	ChainPostRouting       = "POSTROUTING"
)
View Source
const (
	TargetMarkOptionSetMark               TargetOption = "--set-xmark"
	TargetMarkOptionXorMark                            = "--xor-mark"
	TargetMarkOptionOrMark                             = "--or-mark"
	TargetMasqueradeOptionFullyRandomized              = "--random-fully"
)
View Source
const (
	TargetAccept     Target = "ACCEPT"
	TargetDrop              = "DROP"
	TargetReturn            = "RETURN"
	TargetMasquerade        = "MASQUERADE"
	TargetMark              = "MARK"
)
View Source
const (
	MatchModuleComment   MatchModule = "comment"
	MatchModuleAddrType              = "addrtype"
	MatchModuleSet                   = "set"
	MatchModuleMark                  = "mark"
	MatchModuleConnTrack             = "conntrack"
	MatchModulePhysDev               = "physdev"
)
View Source
const (
	MatchModuleCommentOptionComment     MatchModuleOption = "--comment"
	MatchModuleMarkOptionMark                             = "--mark"
	MatchModuleSetOptionSet                               = "--match-set"
	MatchModuleConnTrackOptionConnState                   = "--ctstate"
	MatchModulePhysDevOptionPhysDevIsIn                   = "--physdev-is-in"
	MatchModuleAddrTypeOptionSrcType                      = "--src-type"
	MatchModuleAddrTypeOptionDstType                      = "--dst-type"
)
View Source
const (
	ProtocolTCP  Protocol = "tcp"
	ProtocolUDP           = "udp"
	ProtocolSCTP          = "sctp"
)
View Source
const ChainTemplate = `` /* 363-byte string literal not displayed */
View Source
const MatchTemplate = `` /* 618-byte string literal not displayed */
View Source
const ProtocolTemplate = `` /* 209-byte string literal not displayed */
View Source
const RuleTemplate = `` /* 1004-byte string literal not displayed */
View Source
const TableTemplate = `` /* 390-byte string literal not displayed */
View Source
const Template = `` /* 160-byte string literal not displayed */

Variables

Functions

func IsDefaultChain

func IsDefaultChain(chain Chain) bool

func NeedQuotes

func NeedQuotes(option MatchModuleOption) bool

Types

type Chain

type Chain string

type IPTableRules

type IPTableRules struct {
	NatRules []Rule
}

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) AddChain

func (m *Manager) AddChain(chain Chain, table Table, protocolFamily ProtocolFamily)

func (*Manager) AddRule

func (m *Manager) AddRule(rule Rule, table Table, protocolFamily ProtocolFamily)

func (*Manager) Apply

func (m *Manager) Apply()

type MatchModule

type MatchModule string

type MatchModuleOption

type MatchModuleOption string

type MatchOption

type MatchOption struct {
	Module       MatchModule
	ModuleOption MatchModuleOption
	Value        string
	Inverted     bool
}

type Protocol

type Protocol string

type ProtocolFamily

type ProtocolFamily string
const (
	ProtocolFamilyIPv4 ProtocolFamily = "inet"
	ProtocolFamilyIPv6                = "inet6"
)

type Rule

type Rule struct {
	From              Chain
	To                Chain
	Target            Target
	TargetOption      TargetOption
	TargetOptionValue string
	Protocol          Protocol
	MatchOptions      []MatchOption
}

type Table

type Table string
const (
	TableNat    Table = "nat"
	TableFilter Table = "filter"
)

type TableData

type TableData struct {
	Table          Table
	Chains         []Chain
	Rules          []Rule
	ProtocolFamily ProtocolFamily
}

type Target

type Target string

type TargetOption

type TargetOption string

Jump to

Keyboard shortcuts

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