Documentation
¶
Index ¶
- Constants
- type ComposeUpCommand
- type ContainerCommandExecutor
- type ContainerKiller
- type ContainerPauser
- type ContainerStarter
- type ContainerStopper
- type ContainerThrottler
- type ContainerUnpauser
- type CustomQdiscContainerCommand
- type DelayContainerCommand
- type DockerContainerThrottler
- type DockerHandler
- func (e *DockerHandler) Build(targetContainerId string, netInterface string, cmd string) (string, error)
- func (e *DockerHandler) Execute(containerId string, cmd string) error
- func (e *DockerHandler) Kill(containerId string) error
- func (e *DockerHandler) Pause(containerId string) error
- func (e *DockerHandler) Start(containerId string) error
- func (e *DockerHandler) Stop(containerId string) error
- func (e *DockerHandler) Unpause(containerId string) error
- type DockerSetupCommand
- type ExecContainerCleanupCommand
- type ExecContainerCommand
- type HelperContainerBuilder
- type KillContainerCommand
- type PacketLossContainerCommand
- type PauseContainerCommand
- type StartContainerCommand
- type StopContainerCommand
- type UnpauseContainerCommand
Constants ¶
View Source
const ( DEFAULT_NET_INTERFACE = "eth0" CLEANUP_CONTAINER_CMD = "tc qdisc del dev %s root" IMAGE_NAME = "alpine:3.24.1" START_CONTAINER_CMD = "apk add --no-cache iproute2 && tc qdisc add dev %s root %s && sleep infinity" )
View Source
const (
DELAY_CONTAINER_CMD = "netem delay %dms"
)
View Source
const (
PACKET_LOSS_CONTAINER_CMD = "netem loss %f%%"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComposeUpCommand ¶
type ComposeUpCommand struct {
// contains filtered or unexported fields
}
func NewComposeUpCommand ¶
func NewComposeUpCommand(cmd *parser.SetupCommandDTO, baseDir string, ctx context.Context) (*ComposeUpCommand, error)
func (*ComposeUpCommand) Cleanup ¶
func (s *ComposeUpCommand) Cleanup() error
func (*ComposeUpCommand) Execute ¶
func (s *ComposeUpCommand) Execute() error
type ContainerKiller ¶
type ContainerPauser ¶
type ContainerStarter ¶
type ContainerStopper ¶
type ContainerThrottler ¶
type ContainerUnpauser ¶
type CustomQdiscContainerCommand ¶
type CustomQdiscContainerCommand struct {
// contains filtered or unexported fields
}
func NewCustomQdiscContainerCommand ¶
func NewCustomQdiscContainerCommand(cmd *parser.SetupCommandDTO, throttler ContainerThrottler) (*CustomQdiscContainerCommand, error)
func (*CustomQdiscContainerCommand) Cleanup ¶
func (s *CustomQdiscContainerCommand) Cleanup() error
func (*CustomQdiscContainerCommand) Execute ¶
func (s *CustomQdiscContainerCommand) Execute() error
type DelayContainerCommand ¶
type DelayContainerCommand struct {
// contains filtered or unexported fields
}
func NewDelayContainerCommand ¶
func NewDelayContainerCommand(cmd *parser.SetupCommandDTO, throttler ContainerThrottler) (*DelayContainerCommand, error)
func (*DelayContainerCommand) Cleanup ¶
func (s *DelayContainerCommand) Cleanup() error
func (*DelayContainerCommand) Execute ¶
func (s *DelayContainerCommand) Execute() error
type DockerContainerThrottler ¶
type DockerContainerThrottler struct {
// contains filtered or unexported fields
}
func NewDockerContainerThrottler ¶
func NewDockerContainerThrottler(builder HelperContainerBuilder, starter ContainerStarter, stopper ContainerStopper, executor ContainerCommandExecutor) *DockerContainerThrottler
func (*DockerContainerThrottler) Throttle ¶
func (t *DockerContainerThrottler) Throttle(cmd string, netInterface string, targetContainerId string) error
func (*DockerContainerThrottler) Unthrottle ¶
func (t *DockerContainerThrottler) Unthrottle(netInterface string, targetContainerId string) error
type DockerHandler ¶
type DockerHandler struct {
// contains filtered or unexported fields
}
func NewDockerHandler ¶
func (*DockerHandler) Build ¶
func (e *DockerHandler) Build(targetContainerId string, netInterface string, cmd string) (string, error)
Highly optimizable implementation
func (*DockerHandler) Execute ¶
func (e *DockerHandler) Execute(containerId string, cmd string) error
ALERT: this Execute method is used to exec a command in a container, meanwhile the Execute method of the ExecContainerCommand is used to execute the command defined in the setup command
func (*DockerHandler) Kill ¶
func (e *DockerHandler) Kill(containerId string) error
func (*DockerHandler) Pause ¶
func (e *DockerHandler) Pause(containerId string) error
func (*DockerHandler) Start ¶
func (e *DockerHandler) Start(containerId string) error
func (*DockerHandler) Stop ¶
func (e *DockerHandler) Stop(containerId string) error
func (*DockerHandler) Unpause ¶
func (e *DockerHandler) Unpause(containerId string) error
type DockerSetupCommand ¶
func NewDockerSetupCommand ¶
func NewDockerSetupCommand(cmd *parser.SetupCommandDTO, handler *DockerHandler) (DockerSetupCommand, error)
type ExecContainerCleanupCommand ¶
type ExecContainerCleanupCommand struct {
// contains filtered or unexported fields
}
func NewExecContainerCleanupCommand ¶
func NewExecContainerCleanupCommand(cleanupCmd *parser.CleanupCommandDTO, containerId string, executor ContainerCommandExecutor) (*ExecContainerCleanupCommand, error)
func (*ExecContainerCleanupCommand) Cleanup ¶
func (c *ExecContainerCleanupCommand) Cleanup() error
type ExecContainerCommand ¶
type ExecContainerCommand struct {
// contains filtered or unexported fields
}
func NewExecContainerCommand ¶
func NewExecContainerCommand(cmd *parser.SetupCommandDTO, executor ContainerCommandExecutor) (*ExecContainerCommand, error)
func (*ExecContainerCommand) Cleanup ¶
func (s *ExecContainerCommand) Cleanup() error
func (*ExecContainerCommand) Execute ¶
func (s *ExecContainerCommand) Execute() error
type HelperContainerBuilder ¶
type KillContainerCommand ¶
type KillContainerCommand struct {
// contains filtered or unexported fields
}
func NewKillContainerCommand ¶
func NewKillContainerCommand(cmd *parser.SetupCommandDTO, killer ContainerKiller, starter ContainerStarter) (*KillContainerCommand, error)
func (*KillContainerCommand) Cleanup ¶
func (s *KillContainerCommand) Cleanup() error
func (*KillContainerCommand) Execute ¶
func (s *KillContainerCommand) Execute() error
type PacketLossContainerCommand ¶
type PacketLossContainerCommand struct {
// contains filtered or unexported fields
}
func NewPacketLossContainerCommand ¶
func NewPacketLossContainerCommand(cmd *parser.SetupCommandDTO, throttler ContainerThrottler) (*PacketLossContainerCommand, error)
func (*PacketLossContainerCommand) Cleanup ¶
func (s *PacketLossContainerCommand) Cleanup() error
func (*PacketLossContainerCommand) Execute ¶
func (s *PacketLossContainerCommand) Execute() error
type PauseContainerCommand ¶
type PauseContainerCommand struct {
// contains filtered or unexported fields
}
func NewPauseContainerCommand ¶
func NewPauseContainerCommand(cmd *parser.SetupCommandDTO, pauser ContainerPauser, unpauser ContainerUnpauser) (*PauseContainerCommand, error)
func (*PauseContainerCommand) Cleanup ¶
func (s *PauseContainerCommand) Cleanup() error
func (*PauseContainerCommand) Execute ¶
func (s *PauseContainerCommand) Execute() error
type StartContainerCommand ¶
type StartContainerCommand struct {
// contains filtered or unexported fields
}
func NewStartContainerCommand ¶
func NewStartContainerCommand(cmd *parser.SetupCommandDTO, starter ContainerStarter, stopper ContainerStopper) (*StartContainerCommand, error)
func (*StartContainerCommand) Cleanup ¶
func (s *StartContainerCommand) Cleanup() error
func (*StartContainerCommand) Execute ¶
func (s *StartContainerCommand) Execute() error
type StopContainerCommand ¶
type StopContainerCommand struct {
// contains filtered or unexported fields
}
func NewStopContainerCommand ¶
func NewStopContainerCommand(cmd *parser.SetupCommandDTO, stopper ContainerStopper, starter ContainerStarter) (*StopContainerCommand, error)
func (*StopContainerCommand) Cleanup ¶
func (s *StopContainerCommand) Cleanup() error
func (*StopContainerCommand) Execute ¶
func (s *StopContainerCommand) Execute() error
type UnpauseContainerCommand ¶
type UnpauseContainerCommand struct {
// contains filtered or unexported fields
}
func NewUnpauseContainerCommand ¶
func NewUnpauseContainerCommand(cmd *parser.SetupCommandDTO, unpauser ContainerUnpauser, pauser ContainerPauser) (*UnpauseContainerCommand, error)
func (*UnpauseContainerCommand) Cleanup ¶
func (s *UnpauseContainerCommand) Cleanup() error
func (*UnpauseContainerCommand) Execute ¶
func (s *UnpauseContainerCommand) Execute() error
Click to show internal directories.
Click to hide internal directories.