dummy

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: BSD-2-Clause, BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the sending of dummy messages.

func NewManager

func NewManager(maxNumMessages int,
	avgSendDelta, randomRange time.Duration,
	net *xxdk.Cmix) *Manager

NewManager creates a Manager object and initialises the dummy traffic sending thread. Note that the Manager does not start sending dummy traffic until `True` is passed into Manager.SetStatus. The time duration between each sending operation and the amount of messages sent each interval are randomly generated values with bounds defined by the given parameters below.

Params:

  • maxNumMessages - the upper bound of the random number of messages sent each sending cycle.
  • avgSendDeltaMS - the average duration, in milliseconds, to wait between sends.
  • randomRangeMS - the upper bound of the interval between sending cycles, in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration with an upper bound of randomRangeMS.

func (*Manager) GetStatus

func (m *Manager) GetStatus() bool

GetStatus returns the current state of the Manager's sending thread. Note that this function does not return the status set by the most recent call to SetStatus. Instead, this call returns the current status of the sending thread. This is due to the small delay that may occur between calling SetStatus and the sending thread taking into effect that status change.

Returns:

  • boolean - Returns true if sending thread is sending dummy messages. Returns false if sending thread is paused/stopped and is not sending dummy messages.

func (*Manager) SetStatus

func (m *Manager) SetStatus(status bool) error

SetStatus sets the state of the dummy traffic send thread by passing in a boolean parameter. There may be a small delay in between this call and the status of the sending thread to change accordingly. For example, passing False into this call while the sending thread is currently sending messages will not cancel nor halt the sending operation, but will pause the thread once that operation has completed.

Params:

  • boolean - Input should be true if you want to send dummy messages. Input should be false if you want to pause dummy messages.

Returns:

  • error - if the Manager.SetStatus is called too frequently, causing the internal status channel to fill.

func (*Manager) StartDummyTraffic

func (m *Manager) StartDummyTraffic() (stoppable.Stoppable, error)

StartDummyTraffic starts the process of sending dummy traffic. This function adheres to xxdk.Service.

Jump to

Keyboard shortcuts

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