istio: istio.io/istio/pkg/test/echo/common Index | Files | Directories

package common

import "istio.io/istio/pkg/test/echo/common"

Index

Package Files

dialer.go util.go websocket.go

Constants

const (
    ConnectionTimeout     = 1 * time.Minute
    DefaultRequestTimeout = 15 * time.Second
    DefaultCount          = 1
)

Variables

var (
    // DefaultGRPCDialFunc just calls grpc.Dial directly, with no alterations to the arguments.
    DefaultGRPCDialFunc = grpc.DialContext
    // 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,
    }
)

func DurationToMicros Uses

func DurationToMicros(d time.Duration) int64

DurationToMicros converts the given duration to microseconds.

func FillInDefaults Uses

func FillInDefaults(request *proto.ForwardEchoRequest)

FillInDefaults fills in the timeout and count if not specified in the given message.

func GetCount Uses

func GetCount(request *proto.ForwardEchoRequest) int

GetCount returns the count value or DefaultCount if not set.

func GetHeaders Uses

func GetHeaders(request *proto.ForwardEchoRequest) http.Header

GetHeaders returns the headers for the message.

func GetTimeout Uses

func GetTimeout(request *proto.ForwardEchoRequest) time.Duration

GetTimeout returns the timeout value as a time.Duration or DefaultRequestTimeout if not set.

func IsWebSocketRequest Uses

func IsWebSocketRequest(r *http.Request) bool

IsWebSocketRequest indicates whether the request contains the header that triggers an upgrade to the WebSocket protocol.

func MicrosToDuration Uses

func MicrosToDuration(micros int64) time.Duration

MicrosToDuration converts the given microseconds to a time.Duration.

func SetWebSocketHeader Uses

func SetWebSocketHeader(headers http.Header)

SetWebSocketHeader sets the header on the request which will trigger an upgrade to the WebSocket protocol.

type Dialer Uses

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) FillInDefaults Uses

func (d Dialer) FillInDefaults() Dialer

FillInDefaults fills in any missing dial functions with defaults

type GRPCDialFunc Uses

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

GRPCDialFunc a function for establishing a GRPC connection.

type HTTPDoFunc Uses

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

HTTPDoFunc a function for executing an HTTP request.

type WebsocketDialFunc Uses

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

PathSynopsis
response
scheme

Package common imports 6 packages (graph) and is imported by 5 packages. Updated 2019-08-22. Refresh now. Tools for package owners.