repeat

package
v0.0.0-...-22661af Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTimeout = 10 * time.Second

DefaultTimeout is the default value for the timeout when creating a new Repeater

Functions

func RepeaterLoop

func RepeaterLoop()

RepeaterLoop is the main loop for the repeater. It listens on apis.CHN_REPEAT for calls and executes them

Types

type Item

type Item struct {
	Host     string
	TLS      bool
	Request  []byte
	Response []byte
}

Item contains the information for a single "Go" of a Repeater

type Repeater

type Repeater struct {

	// The Repeater History
	History []Item

	// The timeout to wait before assuming the server will not respond.
	// Default is DefaultTimeout
	Timeout time.Duration
	// contains filtered or unexported fields
}

Repeater represents a full history of requests and responses

func NewRepeater

func NewRepeater() *Repeater

NewRepeater creates a new Repeater with Timeout set to DefaultTimeout

type Repeaters

type Repeaters struct {
	sync.RWMutex
	Repeats []*Repeater
}

Repeaters is a list of repeater with its embedded RWMutex

func (*Repeaters) Add

func (h *Repeaters) Add(r *Repeater) int

Add appends in a thread-safe way a repeater to the current status and returns its id

func (*Repeaters) Save

func (h *Repeaters) Save(w io.Writer) error

Save writes the current status to the given writer in a thread-safe way

Jump to

Keyboard shortcuts

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