Documentation ¶
Index ¶
- Constants
- Variables
- type Error
- type NetShaper
- func (bt *NetShaper) AllServicesStatus() ([]sdk.ServiceStatus, error)
- func (bt *NetShaper) CloneWithSuffix(suffix string) instance.SidecarManager
- func (bt *NetShaper) Initialize(ctx context.Context, sysDeps system.SystemDependencies) error
- func (bt *NetShaper) Instance() *instance.Instance
- func (bt *NetShaper) PreStart(ctx context.Context) error
- func (bt *NetShaper) SetBandwidthLimit(limit int64) error
- func (bt *NetShaper) SetImage(image string)
- func (bt *NetShaper) SetLatencyAndJitter(latency, jitter int64) error
- func (bt *NetShaper) SetNetworkInterface(netIf string)
- func (bt *NetShaper) SetPacketLoss(packetLoss int32) error
- func (bt *NetShaper) SetPort(port int)
- func (bt *NetShaper) WaitForStart(ctx context.Context) error
Constants ¶
const ( DefaultPort = 9009 DefaultImage = "ghcr.io/celestiaorg/bittwister:4187779" DefaultNetworkInterface = "eth0" )
Variables ¶
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 NetShaper ¶
type NetShaper struct {
// contains filtered or unexported fields
}
func (*NetShaper) AllServicesStatus ¶
func (bt *NetShaper) AllServicesStatus() ([]sdk.ServiceStatus, error)
func (*NetShaper) CloneWithSuffix ¶
func (bt *NetShaper) CloneWithSuffix(suffix string) instance.SidecarManager
func (*NetShaper) Initialize ¶
Initialize initializes the BitTwister sidecar and it is called once the instance.AddSidecar is called
func (*NetShaper) PreStart ¶
PreStart is called before the instance is started It is used to prepare the sidecar for the instance to start
func (*NetShaper) SetBandwidthLimit ¶
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) SetLatencyAndJitter ¶
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 (*NetShaper) SetPacketLoss ¶
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