Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( URLFieldRegex = regexp.MustCompile(string(URLField) + "=(.*)") ClusterFieldRegex = regexp.MustCompile(string(ClusterField) + "=(.*)") IstioVersionFieldRegex = regexp.MustCompile(string(IstioVersionField) + "=(.*)") IPFieldRegex = regexp.MustCompile(string(IPField) + "=(.*)") )
var GlobalEchoRequests = atomic.NewUint64(0)
GlobalEchoRequests records how many echo calls we have made total, from all sources. Note: go tests are distinct binaries per test suite, so this is the suite level number of calls
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client of an Echo server that simplifies request/response processing for Forward commands.
func New ¶
func New(address string, tlsSettings *common.TLSSettings, extraDialOpts ...grpc.DialOption) (*Client, error)
New creates a new echo client.Instance that is connected to the given server address.
func (*Client) ForwardEcho ¶
func (c *Client) ForwardEcho(ctx context.Context, request *proto.ForwardEchoRequest) (Responses, error)
ForwardEcho sends the given forward request and parses the response for easier processing. Only fails if the request fails.
type Field ¶
type Field string
Field is a list of fields returned in responses from the Echo server.
const ( RequestIDField Field = "X-Request-Id" ServiceVersionField Field = "ServiceVersion" ServicePortField Field = "ServicePort" StatusCodeField Field = "StatusCode" URLField Field = "URL" HostField Field = "Host" HostnameField Field = "Hostname" MethodField Field = "Method" ProtocolField Field = "Proto" AlpnField Field = "Alpn" RequestHeaderField Field = "RequestHeader" ResponseHeaderField Field = "ResponseHeader" ClusterField Field = "Cluster" IstioVersionField Field = "IstioVersion" IPField Field = "IP" // The Requester’s IP Address. )
type HeaderType ¶
type HeaderType string
HeaderType is a helper enum for retrieving Headers from a Response.
const ( RequestHeader HeaderType = "request" ResponseHeader HeaderType = "response" )
type Response ¶
type Response struct { // RequestURL is the requested URL. This differs from URL, which is the just the path. // For example, RequestURL=http://foo/bar, URL=/bar RequestURL string // Method used (for HTTP). Method string // Protocol used for the request. Protocol string // Alpn value (for HTTP). Alpn string // RawContent is the original unparsed content for this response RawContent string // ID is a unique identifier of the resource in the response ID string // URL is the url the request is sent to URL 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 called by the request Host string // Hostname is the host that responded to the request Hostname string // The cluster where the server is deployed. Cluster string // IstioVersion for the Istio sidecar. IstioVersion string // IP is the requester's ip address IP string RequestHeaders http.Header ResponseHeaders http.Header // contains filtered or unexported fields }
Response represents a response to a single echo request.
func (Response) GetHeaders ¶
func (r Response) GetHeaders(hType HeaderType) http.Header
GetHeaders returns the appropriate headers for the given type.
type Responses ¶
type Responses []Response
Responses is an ordered list of parsed response objects.
func ParseResponses ¶
func ParseResponses(req *proto.ForwardEchoRequest, resp *proto.ForwardEchoResponse) Responses