proxy

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Overview

Package proxy provide a standard grpc proxy for use with Ondatra.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	// DialGRPC creates a client connection to the specified service endpoint
	// on the target. The service will be represented as a gRPC service name.
	// Implementations must append transport security options necessary to reach
	// the server.
	DialGRPC(context.Context, string, ...grpc.DialOption) (*grpc.ClientConn, error)

	// Resolve will return the resolved devices/ates and related services for the
	// resolved topology.
	Resolve() (*rpb.Reservation, error)

	// HTTPClient provides an HTTP Client that can connect to the provided target.
	HTTPClient(string) (HTTPDoCloser, error)
}

Dialer adds lower level binding interface for proxied connections to the base ondatra.Binding interface. Binding implementors are only expected to implement a proxy Dialer if they want to use the proxy as an extension to ondatra.Binding interface.

type Endpoint

type Endpoint struct {
	TargetName string
	TargetAddr string
	Addr       string
}

Endpoint is the current location of a proxy.

type HTTPCloserClient

type HTTPCloserClient struct {
	*http.Client
}

HTTPCloserClient provides noop wrapped http.Client.

func (*HTTPCloserClient) Close

func (c *HTTPCloserClient) Close() error

Close is a noop close method.

type HTTPDoCloser

type HTTPDoCloser interface {
	Do(*http.Request) (*http.Response, error)
	Close() error
}

HTTPDoCloser provides the required interface for clients to the proxy.

func WrapHTTPDoCloser

func WrapHTTPDoCloser(c *http.Client) HTTPDoCloser

WrapHTTPDoCloser wraps a standard http.Client with a noop closer.

type Proxy

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

Proxy will create a set of proxy listeners based on the provided testbed. The proxy implementation relies on the underlying proxy interface for allowing custom dial functions.

func New

func New(d Dialer, sOpts ...grpc.ServerOption) (*Proxy, error)

New will create a new set of proxies for the provided Dialer.

func (*Proxy) Endpoints

func (p *Proxy) Endpoints() map[string]Endpoint

Endpoints returns a map of the currently configured proxy endpoints configured and their state.

func (*Proxy) Stop

func (p *Proxy) Stop() error

Stop will shutdown all current proxies.

Directories

Path Synopsis
Package grpcproxy provides a single proxy grpc server which can be used to tranparently forward both unary and bidirectional streams across different gRPC connections.
Package grpcproxy provides a single proxy grpc server which can be used to tranparently forward both unary and bidirectional streams across different gRPC connections.
Package httpovergrpc implements a http/https service over grpc transport.
Package httpovergrpc implements a http/https service over grpc transport.
proto

Jump to

Keyboard shortcuts

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