config

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExcludeDNSIPRuleConfigs = []Config{
	IPRuleConfig{
		Rule: netlink.Rule{
			Table:             unix.RT_TABLE_MAIN,
			Priority:          hairpinDNSRequestRulePriority,
			Dport:             netlink.NewRulePortRange(53, 53),
			SuppressIfgroup:   -1,
			SuppressPrefixlen: -1,
			Mark:              -1,
			Mask:              -1,
			Goto:              -1,
			Flow:              -1,
		},
		RuleAdd:  netlink.RuleAdd,
		RuleDel:  netlink.RuleDel,
		RuleList: netlink.RuleList,
	},
	IPRuleConfig{
		Rule: netlink.Rule{
			Table:             unix.RT_TABLE_MAIN,
			Priority:          hairpinDNSResponseRulePriority,
			Sport:             netlink.NewRulePortRange(53, 53),
			SuppressIfgroup:   -1,
			SuppressPrefixlen: -1,
			Mark:              -1,
			Mask:              -1,
			Goto:              -1,
			Flow:              -1,
		},
		RuleAdd:  netlink.RuleAdd,
		RuleDel:  netlink.RuleDel,
		RuleList: netlink.RuleList,
	},
}
View Source
var PolicyRoutingConfigSet = Set{
	false,
	"PolicyRouting",
	nil,
}

PolicyRoutingConfigSet defines the Policy Routing rules

View Source
var SourceValidMarkConfig = SysctlConfig{
	Key:          sysctlSrcValidMark,
	Value:        "1",
	DefaultValue: "0",
	SysctlFunc:   sysctl.Sysctl,
}

Functions

This section is empty.

Types

type Config

type Config interface {
	Ensure(enabled bool) error
}

Config interface

type IPRouteConfig

type IPRouteConfig struct {
	Route    netlink.Route
	RouteAdd routeAdder
	RouteDel routeDeler
}

IPRouteConfig defines route config

func (IPRouteConfig) Ensure

func (r IPRouteConfig) Ensure(enabled bool) error

Ensure IPRouteConfig

type IPRuleConfig

type IPRuleConfig struct {
	Rule     netlink.Rule
	RuleAdd  ruleAdder
	RuleDel  ruleDeler
	RuleList ruleLister
}

IPRuleConfig defines the config for ip rule

func (IPRuleConfig) Ensure

func (r IPRuleConfig) Ensure(enabled bool) error

Ensure IPRuleConfig

type IPTablesChainSpec added in v0.1.2

type IPTablesChainSpec struct {
	TableName, ChainName string
	IsDefaultChain       bool // Is a System default chain, if yes, we won't delete it.
	IPT                  iptabler
}

IPTablesChainSpec defines iptable chain

type IPTablesRuleConfig

type IPTablesRuleConfig struct {
	Spec      IPTablesChainSpec
	RuleSpecs []IPTablesRuleSpec
	IPT       iptabler
}

IPTablesRuleConfig defines iptable rule

func (IPTablesRuleConfig) Ensure

func (r IPTablesRuleConfig) Ensure(enabled bool) error

Ensure IPTablesRuleConfig

type IPTablesRuleSpec added in v0.1.2

type IPTablesRuleSpec []string

IPTablesRuleSpec defines the config for ip table rule

type Set added in v0.1.2

type Set struct {
	Enabled     bool
	FeatureName string
	Configs     []Config
}

Set defines the set of Config

type SysctlConfig

type SysctlConfig struct {
	Key, Value, DefaultValue string
	SysctlFunc               sysctler
}

SysctlConfig defines sysctl config

func (SysctlConfig) Ensure

func (s SysctlConfig) Ensure(enabled bool) error

Ensure SysctlConfig

Jump to

Keyboard shortcuts

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