toxiproxy

package
v1.42.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 7 Imported by: 0

README

toxiproxy

A minimal client implementation to setup proxies and toxics in toxiproxy as used in the FV suite. We have our own minimal client implementation to avoid having to pull in the toxiproxy repo which carries a number of transitive dependencies.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes map[string]int

type Client

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

func NewClient

func NewClient(endpoint string) *Client

func (*Client) CreateProxy

func (c *Client) CreateProxy(
	name string,
	listenAddr string,
	targetAddr string,
) (*Proxy, error)

func (*Client) Proxy

func (c *Client) Proxy(name string) (*Proxy, error)

func (*Client) ResetState

func (c *Client) ResetState() error

type Proxy

type Proxy struct {
	Name       string `json:"name"`
	ListenAddr string `json:"listen"`
	TargetAddr string `json:"upstream"`
	Enabled    bool   `json:"enabled"`
	// contains filtered or unexported fields
}

func (*Proxy) AddToxic

func (p *Proxy) AddToxic(
	name string,
	toxicType string,
	stream string,
	toxicity float32,
	attributes Attributes,
) (*Toxic, error)

func (*Proxy) Disable

func (p *Proxy) Disable() error

func (*Proxy) Enable

func (p *Proxy) Enable() error

func (*Proxy) Save

func (p *Proxy) Save() (*Proxy, error)

type Toxic

type Toxic struct {
	Name       string     `json:"name"`
	Type       string     `json:"type"`
	Stream     string     `json:"stream,omitempty"`
	Toxicity   float32    `json:"toxicity"`
	Attributes Attributes `json:"attributes"`
}

Jump to

Keyboard shortcuts

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