portmap

package
v1.1.0-jmanero Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMarkBit = 13

DefaultMarkBit is the default mark bit to signal that masquerading is required.

Variables

This section is empty.

Functions

func Add

func Add(args *skel.CmdArgs) error

Add initializes an instance of Plugin and adds necessary port mapping rules.

func Check

func Check(args *skel.CmdArgs) error

Check initializes an instance of Plugin and performs necessary checks.

func Delete

func Delete(args *skel.CmdArgs) error

Delete initializes an instance of Plugin and removes port mapping rules, if any.

func GetSupportedVersions

func GetSupportedVersions() version.PluginInfo

GetSupportedVersions returns supported CNI spec versions.

Types

type Config

type Config struct {
	types.NetConf
	SNAT                 *bool     `json:"snat,omitempty"`
	ConditionsV4         *[]string `json:"conditionsV4"`
	ConditionsV6         *[]string `json:"conditionsV6"`
	MarkMasqBit          *int      `json:"markMasqBit"`
	ExternalSetMarkChain *string   `json:"externalSetMarkChain"`
	RuntimeConfig        struct {
		PortMaps []utils.MappingEntry `json:"portMappings,omitempty"`
	} `json:"runtimeConfig,omitempty"`

	// These are fields parsed out of the config or the environment;
	// included here for convenience
	ContainerID string    `json:"-"`
	ContIPv4    net.IPNet `json:"-"`
	ContIPv6    net.IPNet `json:"-"`

	NatTableName            string `json:"nat_table_name"`
	PostRoutingNatChainName string `json:"postrouting_nat_chain_name"`
	PreRoutingNatChainName  string `json:"prerouting_nat_chain_name"`
	OutputNatChainName      string `json:"output_nat_chain_name"`
	InputNatChainName       string `json:"input_nat_chain_name"`
	RawTableName            string `json:"raw_table_name"`
	PreRoutingRawChainName  string `json:"prerouting_raw_chain_name"`
	FilterTableName         string `json:"filter_table_name"`
	ForwardFilterChainName  string `json:"forward_filter_chain_name"`
}

Config holds the configuration for the Plugin.

type Interface

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

Interface represents a collection of addresses associated with a network interface.

type Plugin

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

Plugin represents the nftables port-mapping CNI plugin.

func NewPlugin

func NewPlugin(conf *Config) *Plugin

NewPlugin returns an instance of Plugin.

func (*Plugin) Add

func (p *Plugin) Add(conf *Config, result *current.Result) error

Add adds portmap rules.

func (*Plugin) Check

func (p *Plugin) Check(conf *Config, result *current.Result) error

Check checks whether appropriate portmap rules exist.

func (*Plugin) Delete

func (p *Plugin) Delete(conf *Config, result *current.Result) error

Delete deletes appropriate portmap rules, if any.

Jump to

Keyboard shortcuts

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