Documentation ¶
Overview ¶
Package grpc implements a proxy that applies disruptions to gRPC requests This package is inspired by and extensively copies code from https://github.com/mwitkow/grpc-proxy
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(disruption Disruption, forwardConn *grpc.ClientConn) grpc.StreamHandler
NewHandler returns a StreamHandler that attempts to proxy all requests that are not registered in the server.
func NewProxy ¶
func NewProxy(c ProxyConfig, d Disruption) (protocol.Proxy, error)
NewProxy return a new Proxy
Types ¶
type Disruption ¶
type Disruption struct { // Average delay introduced to requests AverageDelay time.Duration // Variation in the delay (with respect of the average delay) DelayVariation time.Duration // Fraction (in the range 0.0 to 1.0) of requests that will return an error ErrorRate float32 // Status code to be returned by requests selected to return an error StatusCode int32 // Status message to be returned in requests selected to return an error StatusMessage string // List of grpc services to be excluded from disruptions Excluded []string }
Disruption specifies disruptions in grpc requests
type ProxyConfig ¶
type ProxyConfig struct { // network used for communication (valid values are "unix" and "tcp") Network string // Address to listen for incoming requests ListenAddress string // Address where to redirect requests UpstreamAddress string }
ProxyConfig configures the Proxy options
Click to show internal directories.
Click to hide internal directories.