cockroach: github.com/cockroachdb/cockroach/pkg/acceptance/localcluster/tc Index | Files

package tc

import "github.com/cockroachdb/cockroach/pkg/acceptance/localcluster/tc"

Package tc contains utility methods for using the Linux tc (traffic control) command to mess with the network links between cockroach nodes running on the local machine.

Requires passwordless sudo in order to run tc.

Does not work on OS X due to the lack of the tc command (and even an alternative wouldn't work for the current use case of this code, which also requires being able to bind to multiple localhost addresses).

Index

Package Files

tc.go

type Controller Uses

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

Controller provides a way to add artificial latency to local traffic.

func NewController Uses

func NewController(interfaces ...string) *Controller

NewController creates and returns a controller that will modify the traffic routing for the provided interfaces.

func (*Controller) AddLatency Uses

func (c *Controller) AddLatency(srcIP, dstIP string, latency time.Duration) error

AddLatency adds artificial latency between the specified source and dest addresses.

func (*Controller) CleanUp Uses

func (c *Controller) CleanUp() error

CleanUp resets all interfaces back to their default tc policies.

func (*Controller) Init Uses

func (c *Controller) Init() error

Init prepares the local network interfaces so that we can later add per-node traffic shaping rules.

Package tc imports 5 packages (graph) and is imported by 1 packages. Updated 2019-07-27. Refresh now. Tools for package owners.