proxy

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package proxy TCP-based fault injection

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned iff SelectRule can't find a Rule that applies
	ErrNotFound = errors.New("no matching rule found")
)

Functions

This section is empty.

Types

type MockType

type MockType string
const (
	Redis MockType = "redis"
	Mysql MockType = "mysql"
	Etcd  MockType = "etcd"
)

agent type

type Plan

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

func (*Plan) AddRule

func (p *Plan) AddRule(r Rule) error

func (*Plan) DeleteAllRule

func (p *Plan) DeleteAllRule()

func (*Plan) DeleteRule

func (p *Plan) DeleteRule(name string) error

func (*Plan) SelectRule

func (p *Plan) SelectRule(clientAddr string, buf []byte) *Rule

type Proxy

type Proxy struct {
	Server string
	Addr   string
	// contains filtered or unexported fields
}

Proxy real service agent

func NewProxy

func NewProxy(server, addr string, mock MockType) *Proxy

func (*Proxy) AddDelay

func (p *Proxy) AddDelay(name string, delay, percentage int, clientAddr, command string) error

func (*Proxy) AddDrop

func (p *Proxy) AddDrop(name string, percentage int, clientAddr, command string) error

func (*Proxy) AddJitter

func (p *Proxy) AddJitter(name string, jitter, percentage int, clientAddr, command string) error

func (*Proxy) AddReturnEmpty

func (p *Proxy) AddReturnEmpty(name string, percentage int, clientAddr, command string) error

func (*Proxy) AddReturnErr

func (p *Proxy) AddReturnErr(name string, returnErr error, percentage int, clientAddr, command string) error

func (*Proxy) DeleteAllRule

func (p *Proxy) DeleteAllRule()

func (*Proxy) StartProxy

func (p *Proxy) StartProxy() error

func (*Proxy) StopProxy

func (p *Proxy) StopProxy()

func (*Proxy) Write

func (p *Proxy) Write(src net.Conn, rule *Rule) bool

Write proxy service results write

type RedisError

type RedisError string

RedisError rediserror

func (RedisError) Error

func (e RedisError) Error() string

func (RedisError) RedisError

func (RedisError) RedisError()

type Rule

type Rule struct {
	Name        string `json:"name,omiempty"`
	Delay       int    `json:"delay,omitempty"`
	Jitter      int    `json:"jitter,omitempty"`
	Drop        bool   `json:"drop,omitempty"`
	ReturnEmpty bool   `json:"return_empty,omitempty"`
	ReturnErr   error  `json:"return_err,omitempty"`
	Percentage  int    `json:"percentage,omitempty"`
	// SelectRule does prefix matching on this value
	ClientAddr string `json:"client_addr,omitempty"`
	Command    string `json:"command,omitempty"`
	// contains filtered or unexported fields
}

func (*Rule) String

func (r *Rule) String() string

Directories

Path Synopsis
Package proxymysql Mysql TCP-based fault injection
Package proxymysql Mysql TCP-based fault injection
Package proxyredis Redis TCP-based fault injection
Package proxyredis Redis TCP-based fault injection
Package utils Test tool
Package utils Test tool

Jump to

Keyboard shortcuts

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