Documentation ¶
Overview ¶
Package iptables contains a set of iptables tests implemented as TestCases
Index ¶
Constants ¶
const IPExchangePort = 2349
IPExchangePort is the port the container listens on to receive the IP address of the local process.
Variables ¶
var Tests = map[string]TestCase{}
Tests maps test names to TestCase.
New TestCases are added by calling RegisterTestCase in an init function.
Functions ¶
func RegisterTestCase ¶
func RegisterTestCase(tc TestCase)
RegisterTestCase registers tc so it can be run.
Types ¶
type FilterInputDropDifferentUDPPort ¶
type FilterInputDropDifferentUDPPort struct{}
FilterInputDropDifferentUDPPort tests that dropping traffic for a single UDP port doesn't drop packets on other ports.
func (FilterInputDropDifferentUDPPort) ContainerAction ¶
func (FilterInputDropDifferentUDPPort) ContainerAction(ip net.IP) error
ContainerAction implements TestCase.ContainerAction.
func (FilterInputDropDifferentUDPPort) LocalAction ¶
func (FilterInputDropDifferentUDPPort) LocalAction(ip net.IP) error
LocalAction implements TestCase.LocalAction.
func (FilterInputDropDifferentUDPPort) Name ¶
func (FilterInputDropDifferentUDPPort) Name() string
Name implements TestCase.Name.
type FilterInputDropUDP ¶
type FilterInputDropUDP struct{}
FilterInputDropUDP tests that we can drop UDP traffic.
func (FilterInputDropUDP) ContainerAction ¶
func (FilterInputDropUDP) ContainerAction(ip net.IP) error
ContainerAction implements TestCase.ContainerAction.
func (FilterInputDropUDP) LocalAction ¶
func (FilterInputDropUDP) LocalAction(ip net.IP) error
LocalAction implements TestCase.LocalAction.
func (FilterInputDropUDP) Name ¶
func (FilterInputDropUDP) Name() string
Name implements TestCase.Name.
type FilterInputDropUDPPort ¶
type FilterInputDropUDPPort struct{}
FilterInputDropUDPPort tests that we can drop UDP traffic by port.
func (FilterInputDropUDPPort) ContainerAction ¶
func (FilterInputDropUDPPort) ContainerAction(ip net.IP) error
ContainerAction implements TestCase.ContainerAction.
func (FilterInputDropUDPPort) LocalAction ¶
func (FilterInputDropUDPPort) LocalAction(ip net.IP) error
LocalAction implements TestCase.LocalAction.
func (FilterInputDropUDPPort) Name ¶
func (FilterInputDropUDPPort) Name() string
Name implements TestCase.Name.
type TestCase ¶
type TestCase interface { // Name returns the name of the test. Name() string // ContainerAction runs inside the container. It receives the IP of the // local process. ContainerAction(ip net.IP) error // LocalAction runs locally. It receives the IP of the container. LocalAction(ip net.IP) error }
A TestCase contains one action to run in the container and one to run locally. The actions run concurrently and each must succeed for the test pass.