echo

package
v0.0.0-...-4638b96 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

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

Batch processes a Batch of requests.

func NewBatch

func NewBatch(ops BatchOptions) (*Batch, error)

NewBatch creates a new batch processor with the given options.

func (*Batch) Close

func (b *Batch) Close() error

Close the batch processor.

func (*Batch) Run

func (b *Batch) Run() ([]string, error)

Run the batch and collect the results.

type BatchOptions

type BatchOptions struct {
	Dialer  application.Dialer
	Count   int
	QPS     int
	Timeout time.Duration
	URL     string
	UDS     string
	Header  http.Header
	Message string
	CAFile  string
}

BatchOptions provides options to the batch processor.

type Client

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

Client is a simple client for forwarding echo requests between echo applications.

func NewClient

func NewClient(address string) (*Client, error)

NewClient creates a new EchoClient instance that is connected to the given address.

func (*Client) Close

func (c *Client) Close() error

Close the EchoClient and free any resources.

func (*Client) ForwardEcho

func (c *Client) ForwardEcho(request *proto.ForwardEchoRequest) (ParsedResponses, error)

ForwardEcho sends the given forward request and parses the response for easier processing. Only fails if the request fails.

type Factory

type Factory struct {
	Ports     model.PortList
	TLSCert   string
	TLSCKey   string
	Version   string
	UDSServer string
}

Factory is a factory for echo applications.

func (*Factory) NewApplication

func (f *Factory) NewApplication(dialer application.Dialer) (application.Application, error)

NewApplication implements the application.Factory interface.

type ParsedResponse

type ParsedResponse struct {
	// Body is the body of the response
	Body string
	// ID is a unique identifier of the resource in the response
	ID string
	// Version is the version of the resource in the response
	Version string
	// Port is the port of the resource in the response
	Port string
	// Code is the response code
	Code string
	// Host is the host returned by the response
	Host string
}

ParsedResponse represents a response to a single echo request.

func (*ParsedResponse) Count

func (r *ParsedResponse) Count(text string) int

Count occurrences of the given text within the body of this response.

func (*ParsedResponse) IsOK

func (r *ParsedResponse) IsOK() bool

IsOK indicates whether or not the code indicates a successful request.

type ParsedResponses

type ParsedResponses []*ParsedResponse

ParsedResponses is an ordered list of parsed response objects.

func (ParsedResponses) Body

func (r ParsedResponses) Body() string

Body concatenates the bodies of all responses.

func (ParsedResponses) Count

func (r ParsedResponses) Count(text string) int

Count occurrences of the given text within the bodies of all responses.

func (ParsedResponses) IsOK

func (r ParsedResponses) IsOK() bool

IsOK indicates whether or not the first response was successful.

func (ParsedResponses) Len

func (r ParsedResponses) Len() int

Len returns the length of the parsed responses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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