tc

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

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

func NewController

func NewController(interfaces ...string) *Controller

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

func (*Controller) AddLatency

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

func (c *Controller) CleanUp() error

CleanUp resets all interfaces back to their default tc policies.

func (*Controller) Init

func (c *Controller) Init() error

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

Jump to

Keyboard shortcuts

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