iptableswrapper

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeIPTables added in v0.0.8

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

FakeIPTables is no-op implementation of iptables Interface. We create a wrapper for iptest.FakeIPTables because the original package does not contain enough builtinTargets we need.

func NewFake added in v0.0.8

func NewFake() *FakeIPTables

NewFake returns a no-op iptables.Interface

func NewIPv6Fake added in v0.0.8

func NewIPv6Fake() *FakeIPTables

NewIPv6Fake returns a no-op iptables.Interface with IsIPv6() == true

func (*FakeIPTables) AddBuiltinTargets added in v0.0.8

func (f *FakeIPTables) AddBuiltinTargets(targets ...string)

func (*FakeIPTables) ChainExists added in v0.0.8

func (f *FakeIPTables) ChainExists(table iptables.Table, chain iptables.Chain) (bool, error)

ChainExists is part of iptables.Interface

func (*FakeIPTables) DeleteChain added in v0.0.8

func (f *FakeIPTables) DeleteChain(table iptables.Table, chain iptables.Chain) error

DeleteChain is part of iptables.Interface

func (*FakeIPTables) DeleteRule added in v0.0.8

func (f *FakeIPTables) DeleteRule(table iptables.Table, chain iptables.Chain, args ...string) error

DeleteRule is part of iptables.Interface

func (*FakeIPTables) EnsureChain added in v0.0.8

func (f *FakeIPTables) EnsureChain(table iptables.Table, chain iptables.Chain) (bool, error)

EnsureChain is part of iptables.Interface

func (*FakeIPTables) EnsureRule added in v0.0.8

func (f *FakeIPTables) EnsureRule(position iptables.RulePosition, table iptables.Table, chain iptables.Chain, args ...string) (bool, error)

EnsureRule is part of iptables.Interface

func (*FakeIPTables) FlushChain added in v0.0.8

func (f *FakeIPTables) FlushChain(table iptables.Table, chain iptables.Chain) error

FlushChain is part of iptables.Interface

func (*FakeIPTables) HasRandomFully added in v0.0.8

func (f *FakeIPTables) HasRandomFully() bool

HasRandomFully is part of iptables.Interface

func (*FakeIPTables) IsIPv6 added in v0.0.8

func (f *FakeIPTables) IsIPv6() bool

IsIPv6 is part of iptables.Interface

func (*FakeIPTables) Monitor added in v0.0.8

func (f *FakeIPTables) Monitor(canary iptables.Chain, tables []iptables.Table, reloadFunc func(), interval time.Duration, stopCh <-chan struct{})

Monitor is part of iptables.Interface

func (*FakeIPTables) Present added in v0.0.8

func (f *FakeIPTables) Present() bool

func (*FakeIPTables) Protocol added in v0.0.8

func (f *FakeIPTables) Protocol() iptables.Protocol

Protocol is part of iptables.Interface

func (*FakeIPTables) Restore added in v0.0.8

func (f *FakeIPTables) Restore(table iptables.Table, data []byte, flush iptables.FlushFlag, counters iptables.RestoreCountersFlag) error

Restore is part of iptables.Interface copied from k8s.io/kubernetes/pkg/util/iptables/testing/fake.go

func (*FakeIPTables) RestoreAll added in v0.0.8

func (f *FakeIPTables) RestoreAll(data []byte, flush iptables.FlushFlag, counters iptables.RestoreCountersFlag) error

RestoreAll is part of iptables.Interface copied from k8s.io/kubernetes/pkg/util/iptables/testing/fake.go

func (*FakeIPTables) SaveInto added in v0.0.8

func (f *FakeIPTables) SaveInto(table iptables.Table, buffer *bytes.Buffer) error

SaveInto is part of iptables.Interface

func (*FakeIPTables) SetHasRandomFully added in v0.0.8

func (f *FakeIPTables) SetHasRandomFully(can bool) *FakeIPTables

SetHasRandomFully sets f's return value for HasRandomFully()

type Interface

type Interface interface {
	// New creates a new IpTables instance
	New() (IpTables, error)
}

func NewIPTables

func NewIPTables() Interface

type IpTables

type IpTables interface {
	// ApendUnique appends given rulespec if not exists
	AppendUnique(table, chain string, rulespec ...string) error
	// Exists checks if given rulespec in specified table/chain exists
	Exists(table, chain string, rulespec ...string) (bool, error)
	// Insert inserts given rulespec to specified table/chain at specified position
	Insert(table, chain string, pos int, rulespec ...string) error
	// Delete removes rulespec in specified table/chain
	Delete(table, chain string, rulespec ...string) error
	// List lists rules in specified table/chain
	List(table, chain string) ([]string, error)
}

Directories

Path Synopsis
Package mockiptableswrapper is a generated GoMock package.
Package mockiptableswrapper is a generated GoMock package.

Jump to

Keyboard shortcuts

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