Documentation
¶
Overview ¶
Package server provides an implementation of a streaming xDS server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks interface {
// OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS).
// Returning an error will end processing and close the stream. OnStreamClosed will still be called.
OnStreamOpen(context.Context, int64, string) error
// OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID.
OnStreamClosed(int64)
// OnStreamRequest is called once a request is received on a stream.
// Returning an error will end processing and close the stream. OnStreamClosed will still be called.
OnStreamRequest(int64, *envoy_service_discovery_v3.DiscoveryRequest) error
// OnStreamResponse is called immediately prior to sending a response on a stream.
OnStreamResponse(int64, *envoy_service_discovery_v3.DiscoveryRequest, *envoy_service_discovery_v3.DiscoveryResponse)
// OnFetchRequest is called for each Fetch request. Returning an error will end processing of the
// request and respond with an error.
OnFetchRequest(context.Context, *envoy_service_discovery_v3.DiscoveryRequest) error
// OnFetchResponse is called immediately prior to sending a response.
OnFetchResponse(*envoy_service_discovery_v3.DiscoveryRequest, *envoy_service_discovery_v3.DiscoveryResponse)
}
Callbacks is a collection of callbacks inserted into the server operation. The callbacks are invoked synchronously.
type HTTPGateway ¶
type HTTPGateway struct {
// Log is an optional log for errors in response write
Log log.Logger
// Server is the underlying gRPC server
Server Server
UrlToType map[string]string
}
HTTPGateway is a custom implementation of [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) specialized to Envoy xDS API.
func NewHTTPGateway ¶
func (*HTTPGateway) ServeHTTP ¶
func (h *HTTPGateway) ServeHTTP(resp http.ResponseWriter, req *http.Request)
type Server ¶
type Server interface {
// StreamV3 is the V3 streaming method
StreamV3(
stream StreamV3,
defaultTypeURL string,
) error
// StreamV2 is the V2 streaming method
StreamV2(
stream StreamV2,
defaultTypeURL string,
) error
// Fetch is the universal fetch method.
FetchV3(
context.Context,
*envoy_service_discovery_v3.DiscoveryRequest,
) (*envoy_service_discovery_v3.DiscoveryResponse, error)
FetchV2(
context.Context,
*envoy_api_v2.DiscoveryRequest,
) (*envoy_api_v2.DiscoveryResponse, error)
}
Server is a collection of handlers for streaming discovery requests.
type StreamV2 ¶ added in v0.15.0
type StreamV2 interface {
Send(response *envoy_api_v2.DiscoveryResponse) error
Recv() (*envoy_api_v2.DiscoveryRequest, error)
grpc.ServerStream
}
type StreamV3 ¶ added in v0.15.0
type StreamV3 interface {
Send(response *envoy_service_discovery_v3.DiscoveryResponse) error
Recv() (*envoy_service_discovery_v3.DiscoveryRequest, error)
grpc.ServerStream
}
type TypedResponse ¶
Click to show internal directories.
Click to hide internal directories.