netshaper

package
v0.15.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultPort             = 9009
	DefaultImage            = "ghcr.io/celestiaorg/bittwister:4187779"
	DefaultNetworkInterface = "eth0"
)

Variables

View Source
var (
	ErrBitTwisterFailedToStart                   = errors.New("BitTwisterFailedToStart", "BitTwister failed to start")
	ErrSettingBitTwisterImage                    = errors.New("SettingBitTwisterImage", "error setting image for bit-twister instance")
	ErrAddingBitTwisterPort                      = errors.New("AddingBitTwisterPort", "error adding BitTwister port")
	ErrCommittingBitTwisterInstance              = errors.New("CommittingBitTwisterInstance", "error committing bit-twister instance")
	ErrSettingBitTwisterEnv                      = errors.New("SettingBitTwisterEnv", "error setting environment variable for bit-twister instance")
	ErrCreatingBitTwisterInstance                = errors.New("CreatingBitTwisterInstance", "error creating bit-twister instance '%s'")
	ErrSettingBitTwisterPrivileged               = errors.New("SettingBitTwisterPrivileged", "error setting privileged for bit-twister instance '%s'")
	ErrAddingBitTwisterCapability                = errors.New("AddingBitTwisterCapability", "error adding capability for bit-twister instance '%s'")
	ErrAddingBitTwisterSidecar                   = errors.New("AddingBitTwisterSidecar", "error adding bit-twister sidecar to instance '%s'")
	ErrEnablingBitTwister                        = errors.New("EnablingBitTwister", "enabling BitTwister is not allowed in state 'Started'")
	ErrSettingBandwidthLimitNotAllowedBitTwister = errors.New("SettingBandwidthLimitNotAllowedBitTwister", "setting bandwidth limit is only allowed if BitTwister is enabled")
	ErrSettingLatencyJitterNotAllowedBitTwister  = errors.New("SettingLatencyJitterNotAllowedBitTwister", "setting latency/jitter is only allowed if BitTwister is enabled")
	ErrSettingPacketLossNotAllowedBitTwister     = errors.New("SettingPacketLossNotAllowedBitTwister", "setting packetloss is only allowed if BitTwister is enabled")
	ErrAddingToProxy                             = errors.New("AddingToProxy", "error adding '%s' to proxy '%s'")
	ErrStoppingBandwidthLimit                    = errors.New("StoppingBandwidthLimit", "error stopping bandwidth limit for bit-twister instance '%s'")
	ErrBitTwisterNotInitialized                  = errors.New("BitTwisterNotInitialized", "bit-twister instance '%s' not initialized")
	ErrStoppingLatencyJitter                     = errors.New("StoppingLatencyJitter", "error stopping latency/jitter for bit-twister instance '%s'")
	ErrStoppingPacketLoss                        = errors.New("StoppingPacketLoss", "error stopping packet loss for bit-twister instance '%s'")
	ErrGettingServiceStatus                      = errors.New("GettingServiceStatus", "error getting service status for net-shaper (bit-twister) instance '%s'")
	ErrStoppingService                           = errors.New("StoppingService", "error stopping service for net-shaper (bit-twister) instance '%s'")
)

Functions

This section is empty.

Types

type Error

type Error = errors.Error

type NetShaper

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

func New

func New() *NetShaper

func (*NetShaper) AllServicesStatus

func (bt *NetShaper) AllServicesStatus() ([]sdk.ServiceStatus, error)

func (*NetShaper) CloneWithSuffix

func (bt *NetShaper) CloneWithSuffix(suffix string) instance.SidecarManager

func (*NetShaper) Initialize

func (bt *NetShaper) Initialize(ctx context.Context, sysDeps system.SystemDependencies) error

Initialize initializes the BitTwister sidecar and it is called once the instance.AddSidecar is called

func (*NetShaper) Instance

func (bt *NetShaper) Instance() *instance.Instance

func (*NetShaper) PreStart

func (bt *NetShaper) PreStart(ctx context.Context) error

PreStart is called before the instance is started It is used to prepare the sidecar for the instance to start

func (*NetShaper) SetBandwidthLimit

func (bt *NetShaper) SetBandwidthLimit(limit int64) error

SetBandwidthLimit sets the bandwidth limit of the instance bandwidth limit in bps (e.g. 1000 for 1Kbps) Currently, only one of bandwidth, jitter, latency or packet loss can be set This function can only be called in the state 'Commited'

func (*NetShaper) SetImage

func (bt *NetShaper) SetImage(image string)

func (*NetShaper) SetLatencyAndJitter

func (bt *NetShaper) SetLatencyAndJitter(latency, jitter int64) error

SetLatency sets the latency of the instance latency in ms (e.g. 1000 for 1s) jitter in ms (e.g. 1000 for 1s)

func (*NetShaper) SetNetworkInterface

func (bt *NetShaper) SetNetworkInterface(netIf string)

func (*NetShaper) SetPacketLoss

func (bt *NetShaper) SetPacketLoss(packetLoss int32) error

SetPacketLoss sets the packet loss of the instance packet loss in percent (e.g. 10 for 10%) Currently, only one of bandwidth, jitter, latency or packet loss can be set

func (*NetShaper) SetPort

func (bt *NetShaper) SetPort(port int)

func (*NetShaper) WaitForStart

func (bt *NetShaper) WaitForStart(ctx context.Context) error

Jump to

Keyboard shortcuts

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