app

package
v0.0.0-...-52f31cf Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface for making http calls that can be mocked in tests.

type Request

type Request struct {
	Chains []SubrequestChain `json:"request"`
}

Request contains a collection of destination chains. It is the format of incoming requests.

type RequestHandler

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

RequestHandler handles processing of incoming requests.

func (RequestHandler) ServeHTTP

func (h RequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SimpleService

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

SimpleService can be used to mimic read services in test environments. It will listen for request on defined port, and send requests to envoyPort.

func NewSimpleService

func NewSimpleService(hostname string, port, envoyPort int,
	concurrency int,
	latency time.Duration,
	rejectRatio float64,
) *SimpleService

NewSimpleService creates a SimpleService instance.

func (SimpleService) Run

func (simpleService SimpleService) Run() error

Run starts listening for requests on given port.

type Subrequest

type Subrequest struct {
	Destination string `json:"destination"`
}

Subrequest contains information on a single destination to which it should be routed.

type SubrequestChain

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

SubrequestChain is a single chain of destinations.

func (SubrequestChain) MarshalJSON

func (sc SubrequestChain) MarshalJSON() ([]byte, error)

MarshalJSON writes the subrequest chain as a JSON list and not a JSON object.

func (*SubrequestChain) UnmarshalJSON

func (sc *SubrequestChain) UnmarshalJSON(data []byte) error

UnmarshalJSON creates the subrequest chain, reading a JSON list and not a JSON object.

Jump to

Keyboard shortcuts

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