application

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultGRPCDialFunc just calls grpc.Dial directly, with no alterations to the arguments.
	DefaultGRPCDialFunc = func(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
		return grpc.DialContext(ctx, address, opts...)
	}
	// DefaultWebsocketDialFunc just calls dialer.Dial, with no alterations to the arguments.
	DefaultWebsocketDialFunc = func(dialer *websocket.Dialer, urlStr string, requestHeader http.Header) (*websocket.Conn, *http.Response, error) {
		return dialer.Dial(urlStr, requestHeader)
	}
	// DefaultHTTPDoFunc just calls client.Do with no alterations to the arguments.
	DefaultHTTPDoFunc = func(client *http.Client, req *http.Request) (*http.Response, error) {
		return client.Do(req)
	}
	// DefaultDialer is provides defaults for all dial functions.
	DefaultDialer = Dialer{
		GRPC:      DefaultGRPCDialFunc,
		Websocket: DefaultWebsocketDialFunc,
		HTTP:      DefaultHTTPDoFunc,
	}
)

Functions

This section is empty.

Types

type Application

type Application interface {
	io.Closer
	// GetPorts provides a list of ports that are actively listening for the application.
	GetPorts() model.PortList
}

Application represents a locally running application with exposed ports.

type Dialer

type Dialer struct {
	GRPC      GRPCDialFunc
	Websocket WebsocketDialFunc
	HTTP      HTTPDoFunc
}

Dialer is a replaceable set of functions for creating client-side connections for various protocols, allowing a test application to intercept the connection creation.

func (Dialer) Fill

func (d Dialer) Fill() Dialer

Fill any missing dial functions with defaults

type Factory

type Factory func(dialer Dialer) (Application, error)

Factory is a function that manufactures a running application.

type GRPCDialFunc

type GRPCDialFunc func(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

GRPCDialFunc a function for establishing a GRPC connection.

type HTTPDoFunc

type HTTPDoFunc func(client *http.Client, req *http.Request) (*http.Response, error)

HTTPDoFunc a function for executing an HTTP request.

type WebsocketDialFunc

type WebsocketDialFunc func(dialer *websocket.Dialer, urlStr string, requestHeader http.Header) (*websocket.Conn, *http.Response, error)

WebsocketDialFunc a function for establishing a Websocket connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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