package networking
import "github.com/dotcloud/docker/internal/testutils/networking"
Index ¶
- Constants
- func FirewalldReload(t *testing.T, d *daemon.Daemon)
- func FirewalldRunning() bool
- func SetFilterForwardPolicies(t *testing.T, policy string)
- type Host
- func (h Host) Destroy(t *testing.T)
- func (h Host) Do(t *testing.T, fn func())
- func (h Host) MustRun(t *testing.T, cmd string, args ...string) string
- func (h Host) Run(t *testing.T, cmd string, args ...string) (string, error)
- type L3Segment
Constants ¶
const CurrentNetns = ""
CurrentNetns can be passed to L3Segment.AddHost to indicate that the host lives in the current network namespace (eg. where dockerd runs).
Functions ¶
func FirewalldReload ¶
FirewalldReload reloads firewalld and waits for the daemon to re-create its rules. It's a no-op if firewalld is not running, and the test fails if the reload does not complete.
func FirewalldRunning ¶
func FirewalldRunning() bool
func SetFilterForwardPolicies ¶
SetFilterForwardPolicies sets the default policy for the FORWARD chain in the filter tables for both IPv4 and IPv6. The original policy is restored using t.Cleanup().
There's only one filter-FORWARD policy, so this won't behave well if used by tests running in parallel in a single network namespace that expect different behaviour.
Types ¶
type Host ¶
type Host struct { Name string Iface string // Iface is the interface name in the host network namespace. // contains filtered or unexported fields }
func (Host) Destroy ¶
func (Host) Do ¶
Do run the provided function in the host's network namespace.
func (Host) MustRun ¶
MustRun executes the provided command in the host's network namespace and returns its combined stdout/stderr, failing the test if the command returns an error.
func (Host) Run ¶
Run executes the provided command in the host's network namespace, returns its combined stdout/stderr, and error.
type L3Segment ¶
L3Segment simulates a switched, dual-stack capable network that interconnects multiple hosts running in their own network namespace.
func NewL3Segment ¶
NewL3Segment creates a new L3Segment. The bridge interface interconnecting all the hosts is created in a new network namespace named nsName and it's assigned one or more IP addresses. Those need to be unmasked netip.Prefix.
func (*L3Segment) AddHost ¶
func (*L3Segment) Destroy ¶
Source Files ¶
iptables.go l3_segment_linux.go
- Version
- v28.1.1+incompatible (latest)
- Published
- Apr 18, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 59 minutes ago –
Tools for package owners.