Documentation
¶
Index ¶
- Constants
- Variables
- func AugmentErrorMessage(defaultCode codes.Code, msg string, err error) error
- func HostWithPort(u *url.URL) string
- func InvertedUnaryClientRPC[Req, Res any](stream grpc.BidiStreamingClient[Res, Req], req *Req) (*Res, error)
- func IsHealthCheckMethod(fullMethod string) bool
- func IsStatusError(err error) bool
- func MaybeMTLSCreds(certFile, keyFile, mtlsClientCAFile string, mtlsEnabled bool) ([]grpc.ServerOption, error)
- func MaybeTLSCreds(certFile, keyFile string) ([]grpc.ServerOption, error)
- func NewFixedAddressResolver(addresses []netip.Addr, port uint16) *manual.Resolver
- func NewHeaderMetadata(header http.Header, insecure bool) credentials.PerRPCCredentials
- func NewTokenCredentials(token api.AgentToken, agentType api.AgentType, insecure bool) credentials.PerRPCCredentials
- func RequestCanceled(err error) bool
- func RequestCanceledOrTimedOut(err error) bool
- func RequestTimedOut(err error) bool
- func StartServer(stage stager.Stage, server *grpc.Server, ...)
- func StatusErrorFromContext(ctx context.Context, msg string) error
- func StreamClientLimitingInterceptor(limiter ClientLimiter) grpc.StreamClientInterceptor
- func StreamClientValidatingInterceptor(v protovalidate.Validator) grpc.StreamClientInterceptor
- func StreamServerErrorReporterInterceptor(log *slog.Logger, errRep errz.ErrReporter) grpc.StreamServerInterceptor
- func StreamServerLimitingInterceptor(limiter ServerLimiter) grpc.StreamServerInterceptor
- func StreamServerSkippingInterceptor(interceptor grpc.StreamServerInterceptor, skip func(fullMethod string) bool) grpc.StreamServerInterceptor
- func StreamServerValidatingInterceptor(v protovalidate.Validator) grpc.StreamServerInterceptor
- func UnaryClientLimitingInterceptor(limiter ClientLimiter) grpc.UnaryClientInterceptor
- func UnaryClientValidatingInterceptor(v protovalidate.Validator) grpc.UnaryClientInterceptor
- func UnaryServerErrorReporterInterceptor(log *slog.Logger, errRep errz.ErrReporter) grpc.UnaryServerInterceptor
- func UnaryServerLimitingInterceptor(limiter ServerLimiter) grpc.UnaryServerInterceptor
- func UnaryServerSkippingInterceptor(interceptor grpc.UnaryServerInterceptor, skip func(fullMethod string) bool) grpc.UnaryServerInterceptor
- func UnaryServerValidatingInterceptor(v protovalidate.Validator) grpc.UnaryServerInterceptor
- type AggregateServer
- type CheckHeader
- type ClientLimiter
- type DoResponse
- type ErrResp
- type GRPCServer
- type HTTPDo
- type HTTPRequestClient
- type HTTPRoundTripperToOutboundGRPC
- type HTTPToOutboundGRPC
- func (x *HTTPToOutboundGRPC) HandleIOError(msg string, err error) *ErrResp
- func (x *HTTPToOutboundGRPC) HandleInternalError(ctx context.Context, msg string, err error) *ErrResp
- func (x *HTTPToOutboundGRPC) HandleProcessingError(ctx context.Context, statusCode int32, msg string, err error) *ErrResp
- func (x *HTTPToOutboundGRPC) PipeInboundToOutbound(ctx context.Context, outboundClient HTTPRequestClient, r *http.Request, ...) *ErrResp
- func (x *HTTPToOutboundGRPC) PipeInboundToOutboundUpgraded(outboundClient HTTPRequestClient, inboundStream io.Reader) error
- func (x *HTTPToOutboundGRPC) PipeOutboundToInbound(ctx context.Context, outboundClient HTTPRequestClient, w ResponseWriter) *ErrResp
- func (x *HTTPToOutboundGRPC) PipeOutboundToInboundUpgraded(outboundClient HTTPRequestClient, inboundStream io.Writer) error
- func (x *HTTPToOutboundGRPC) SendCloseSend(outboundClient HTTPRequestClient)
- type HandleIOErrorFunc
- type HttpRequest
- func (*HttpRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HttpRequest) GetData() *HttpRequest_Data
- func (x *HttpRequest) GetHeader() *HttpRequest_Header
- func (x *HttpRequest) GetMessage() isHttpRequest_Message
- func (x *HttpRequest) GetTrailer() *HttpRequest_Trailer
- func (x *HttpRequest) GetUpgradeData() *HttpRequest_UpgradeData
- func (*HttpRequest) ProtoMessage()
- func (x *HttpRequest) ProtoReflect() protoreflect.Message
- func (x *HttpRequest) Reset()
- func (x *HttpRequest) String() string
- type HttpRequest_Data
- type HttpRequest_Data_
- type HttpRequest_Header
- func (*HttpRequest_Header) Descriptor() ([]byte, []int)deprecated
- func (x *HttpRequest_Header) GetContentLength() int64
- func (x *HttpRequest_Header) GetExtra() *anypb.Any
- func (x *HttpRequest_Header) GetRequest() *prototool.HttpRequest
- func (x *HttpRequest_Header) IsRequestWithoutBody() bool
- func (*HttpRequest_Header) ProtoMessage()
- func (x *HttpRequest_Header) ProtoReflect() protoreflect.Message
- func (x *HttpRequest_Header) Reset()
- func (x *HttpRequest_Header) String() string
- type HttpRequest_Header_
- type HttpRequest_Trailer
- type HttpRequest_Trailer_
- type HttpRequest_UpgradeData
- func (*HttpRequest_UpgradeData) Descriptor() ([]byte, []int)deprecated
- func (x *HttpRequest_UpgradeData) GetData() []byte
- func (*HttpRequest_UpgradeData) ProtoMessage()
- func (x *HttpRequest_UpgradeData) ProtoReflect() protoreflect.Message
- func (x *HttpRequest_UpgradeData) Reset()
- func (x *HttpRequest_UpgradeData) String() string
- type HttpRequest_UpgradeData_
- type HttpResponse
- func (*HttpResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HttpResponse) GetData() *HttpResponse_Data
- func (x *HttpResponse) GetHeader() *HttpResponse_Header
- func (x *HttpResponse) GetMessage() isHttpResponse_Message
- func (x *HttpResponse) GetTrailer() *HttpResponse_Trailer
- func (x *HttpResponse) GetUpgradeData() *HttpResponse_UpgradeData
- func (*HttpResponse) ProtoMessage()
- func (x *HttpResponse) ProtoReflect() protoreflect.Message
- func (x *HttpResponse) Reset()
- func (x *HttpResponse) String() string
- type HttpResponse_Data
- type HttpResponse_Data_
- type HttpResponse_Header
- func (*HttpResponse_Header) Descriptor() ([]byte, []int)deprecated
- func (x *HttpResponse_Header) GetResponse() *prototool.HttpResponse
- func (*HttpResponse_Header) ProtoMessage()
- func (x *HttpResponse_Header) ProtoReflect() protoreflect.Message
- func (x *HttpResponse_Header) Reset()
- func (x *HttpResponse_Header) String() string
- type HttpResponse_Header_
- type HttpResponse_Trailer
- type HttpResponse_Trailer_
- type HttpResponse_UpgradeData
- func (*HttpResponse_UpgradeData) Descriptor() ([]byte, []int)deprecated
- func (x *HttpResponse_UpgradeData) GetData() []byte
- func (*HttpResponse_UpgradeData) ProtoMessage()
- func (x *HttpResponse_UpgradeData) ProtoReflect() protoreflect.Message
- func (x *HttpResponse_UpgradeData) Reset()
- func (x *HttpResponse_UpgradeData) String() string
- type HttpResponse_UpgradeData_
- type InboundGRPCToOutboundHTTP
- type InboundGRPCToOutboundHTTPStream
- type InboundHTTPToOutboundGRPC
- type InboundStreamToOutboundStream
- type JWTAuther
- type JWTCredentials
- type Logger
- func (l *Logger) Error(args ...any)
- func (l *Logger) ErrorDepth(depth int, args ...any)
- func (l *Logger) Errorf(format string, args ...any)
- func (l *Logger) Errorln(args ...any)
- func (l *Logger) Fatal(args ...any)
- func (l *Logger) FatalDepth(depth int, args ...any)
- func (l *Logger) Fatalf(format string, args ...any)
- func (l *Logger) Fatalln(args ...any)
- func (l *Logger) Info(args ...any)
- func (l *Logger) InfoDepth(depth int, args ...any)
- func (l *Logger) Infof(format string, args ...any)
- func (l *Logger) Infoln(args ...any)
- func (l *Logger) V(lvl int) bool
- func (l *Logger) Warning(args ...any)
- func (l *Logger) WarningDepth(depth int, args ...any)
- func (l *Logger) Warningf(format string, args ...any)
- func (l *Logger) Warningln(args ...any)
- type MergeHeadersFunc
- type RequestsInFlightStatsHandler
- func NewClientRequestsInFlightStatsHandler(m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
- func NewRequestsInFlightStatsHandler(sub string, m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
- func NewServerRequestsInFlightStatsHandler(m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
- func (h *RequestsInFlightStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (h *RequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
- func (h *RequestsInFlightStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (h *RequestsInFlightStatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
- type ResponseWriter
- type ServerLimiter
- type TrackResponseFunc
- type WriteErrorResponse
Constants ¶
const ( MetadataAuthorization = "authorization" MetadataAgentType = "gitlab-agent-type" )
const ( HTTPRequestHeaderFieldNumber protoreflect.FieldNumber = 1 HTTPRequestDataFieldNumber protoreflect.FieldNumber = 2 HTTPRequestTrailerFieldNumber protoreflect.FieldNumber = 3 HTTPRequestUpgradeDataFieldNumber protoreflect.FieldNumber = 4 HTTPResponseHeaderFieldNumber protoreflect.FieldNumber = 1 HTTPResponseDataFieldNumber protoreflect.FieldNumber = 2 HTTPResponseTrailerFieldNumber protoreflect.FieldNumber = 3 HTTPResponseUpgradeDataFieldNumber protoreflect.FieldNumber = 4 )
const ( FixedAddressResolverScheme = "fixedaddr" FixedAddressResolverTarget = FixedAddressResolverScheme + ":///" )
Variables ¶
var ( HTTPRequestStreamVisitor = streamvisitor.NewLazyStreamVisitor(&HttpRequest{}) HTTPResponseStreamVisitor = streamvisitor.NewLazyStreamVisitor(&HttpResponse{}) )
var File_internal_tool_grpctool_grpctool_proto protoreflect.FileDescriptor
Functions ¶
func AugmentErrorMessage ¶
func HostWithPort ¶
HostWithPort adds port if it was not specified in a URL with a "grpc" or "grpcs" scheme.
func InvertedUnaryClientRPC ¶ added in v19.1.0
func InvertedUnaryClientRPC[Req, Res any](stream grpc.BidiStreamingClient[Res, Req], req *Req) (*Res, error)
InvertedUnaryClientRPC sends a unary RPC over a client bidi stream where request and response types are inverted.
func IsHealthCheckMethod ¶ added in v19.3.0
IsHealthCheckMethod returns true if fullMethod is a method of the standard gRPC health checking service. Health checking RPCs come from load balancers and reverse proxies rather than from the API's normal clients, so they typically need to bypass authentication and rate limiting.
func IsStatusError ¶
func MaybeMTLSCreds ¶
func MaybeMTLSCreds(certFile, keyFile, mtlsClientCAFile string, mtlsEnabled bool) ([]grpc.ServerOption, error)
func MaybeTLSCreds ¶
func MaybeTLSCreds(certFile, keyFile string) ([]grpc.ServerOption, error)
func NewFixedAddressResolver ¶
func NewHeaderMetadata ¶
func NewHeaderMetadata(header http.Header, insecure bool) credentials.PerRPCCredentials
func NewTokenCredentials ¶
func NewTokenCredentials(token api.AgentToken, agentType api.AgentType, insecure bool) credentials.PerRPCCredentials
func RequestCanceled ¶
func RequestTimedOut ¶
func StartServer ¶
func StatusErrorFromContext ¶
StatusErrorFromContext is a version of status.FromContextError(ctx.Err()).Err() that allows to augment the error message.
func StreamClientLimitingInterceptor ¶
func StreamClientLimitingInterceptor(limiter ClientLimiter) grpc.StreamClientInterceptor
StreamClientLimitingInterceptor returns a new stream server interceptor that performs rate limiting on the request.
func StreamClientValidatingInterceptor ¶
func StreamClientValidatingInterceptor(v protovalidate.Validator) grpc.StreamClientInterceptor
StreamClientValidatingInterceptor is a stream client interceptor that performs response stream validation.
func StreamServerErrorReporterInterceptor ¶
func StreamServerErrorReporterInterceptor(log *slog.Logger, errRep errz.ErrReporter) grpc.StreamServerInterceptor
func StreamServerLimitingInterceptor ¶
func StreamServerLimitingInterceptor(limiter ServerLimiter) grpc.StreamServerInterceptor
StreamServerLimitingInterceptor returns a new stream server interceptor that performs limiting based on the given context
func StreamServerSkippingInterceptor ¶ added in v19.3.0
func StreamServerSkippingInterceptor(interceptor grpc.StreamServerInterceptor, skip func(fullMethod string) bool) grpc.StreamServerInterceptor
StreamServerSkippingInterceptor returns a stream server interceptor that invokes the wrapped interceptor for all methods but the ones skip returns true for. The handler is always invoked.
func StreamServerValidatingInterceptor ¶
func StreamServerValidatingInterceptor(v protovalidate.Validator) grpc.StreamServerInterceptor
StreamServerValidatingInterceptor is a stream client interceptor that performs response stream validation.
func UnaryClientLimitingInterceptor ¶
func UnaryClientLimitingInterceptor(limiter ClientLimiter) grpc.UnaryClientInterceptor
UnaryClientLimitingInterceptor returns a new unary client interceptor that performs request rate limiting.
func UnaryClientValidatingInterceptor ¶
func UnaryClientValidatingInterceptor(v protovalidate.Validator) grpc.UnaryClientInterceptor
UnaryClientValidatingInterceptor is a unary client interceptor that performs response validation.
func UnaryServerErrorReporterInterceptor ¶
func UnaryServerErrorReporterInterceptor(log *slog.Logger, errRep errz.ErrReporter) grpc.UnaryServerInterceptor
func UnaryServerLimitingInterceptor ¶
func UnaryServerLimitingInterceptor(limiter ServerLimiter) grpc.UnaryServerInterceptor
UnaryServerLimitingInterceptor returns a new unary server interceptor that performs limiting based on the given context
func UnaryServerSkippingInterceptor ¶ added in v19.3.0
func UnaryServerSkippingInterceptor(interceptor grpc.UnaryServerInterceptor, skip func(fullMethod string) bool) grpc.UnaryServerInterceptor
UnaryServerSkippingInterceptor returns a unary server interceptor that invokes the wrapped interceptor for all methods but the ones skip returns true for. The handler is always invoked.
func UnaryServerValidatingInterceptor ¶
func UnaryServerValidatingInterceptor(v protovalidate.Validator) grpc.UnaryServerInterceptor
UnaryServerValidatingInterceptor is a unary client interceptor that performs response validation.
Types ¶
type AggregateServer ¶
type AggregateServer []GRPCServer
func (AggregateServer) GetServiceInfo ¶
func (s AggregateServer) GetServiceInfo() map[string]grpc.ServiceInfo
func (AggregateServer) RegisterService ¶
func (s AggregateServer) RegisterService(desc *grpc.ServiceDesc, impl any)
type CheckHeader ¶
CheckHeader checks the status code and header of the upstream server's HTTP response. It may return an error or alter the header.
type ClientLimiter ¶
type ClientLimiter interface {
// Wait blocks until limiter permits an event to happen.
// It returns an error if the Context is
// canceled, or the expected wait time exceeds the Context's Deadline.
Wait(context.Context) error
}
ClientLimiter defines the interface to perform client-side request rate limiting. You can use golang.org/x/time/rate.Limiter as an implementation of this interface.
type DoResponse ¶
type DoResponse struct {
// Resp is the server's response to a request.
Resp *http.Response
// UpgradeConn is the underlying network connection to the server.
// May be nil if request was not an Upgrade request or if server decided not to switch protocols
// (non-101 response status code).
UpgradeConn net.Conn
// ConnReader is a buffered reader, wrapping UpgradeConn. Is set when UpgradeConn is set.
// Must be used for reading as it may contain buffered bytes that are no longer available directly via UpgradeConn.
ConnReader *bufio.Reader
}
type GRPCServer ¶
type GRPCServer interface {
grpc.ServiceRegistrar
reflection.ServiceInfoProvider
}
type HTTPDo ¶
type HTTPDo func(ctx context.Context, header *HttpRequest_Header, body io.Reader) (DoResponse, error)
HTTPDo makes an HTTP request and returns a response. If an HTTP upgrade was requested, the underlying network connection is also returned. Implementations that don't support Upgrade should return an error.
type HTTPRequestClient ¶
type HTTPRequestClient = grpc.BidiStreamingClient[HttpRequest, HttpResponse]
type HTTPRoundTripperToOutboundGRPC ¶
type HTTPRoundTripperToOutboundGRPC struct {
HTTP2GRPC HTTPToOutboundGRPC
NewClient func(context.Context) (HTTPRequestClient, error)
HeaderExtra proto.Message
}
type HTTPToOutboundGRPC ¶
type HTTPToOutboundGRPC struct {
Log *slog.Logger
ErrRep errz.ErrReporter
CheckHeader CheckHeader
}
func (*HTTPToOutboundGRPC) HandleIOError ¶
func (x *HTTPToOutboundGRPC) HandleIOError(msg string, err error) *ErrResp
func (*HTTPToOutboundGRPC) HandleInternalError ¶
func (*HTTPToOutboundGRPC) HandleProcessingError ¶
func (*HTTPToOutboundGRPC) PipeInboundToOutbound ¶
func (x *HTTPToOutboundGRPC) PipeInboundToOutbound(ctx context.Context, outboundClient HTTPRequestClient, r *http.Request, headerExtra proto.Message) *ErrResp
func (*HTTPToOutboundGRPC) PipeInboundToOutboundUpgraded ¶
func (x *HTTPToOutboundGRPC) PipeInboundToOutboundUpgraded(outboundClient HTTPRequestClient, inboundStream io.Reader) error
func (*HTTPToOutboundGRPC) PipeOutboundToInbound ¶
func (x *HTTPToOutboundGRPC) PipeOutboundToInbound(ctx context.Context, outboundClient HTTPRequestClient, w ResponseWriter) *ErrResp
func (*HTTPToOutboundGRPC) PipeOutboundToInboundUpgraded ¶
func (x *HTTPToOutboundGRPC) PipeOutboundToInboundUpgraded(outboundClient HTTPRequestClient, inboundStream io.Writer) error
func (*HTTPToOutboundGRPC) SendCloseSend ¶
func (x *HTTPToOutboundGRPC) SendCloseSend(outboundClient HTTPRequestClient)
type HandleIOErrorFunc ¶
type HttpRequest ¶
type HttpRequest struct {
// Types that are valid to be assigned to Message:
//
// *HttpRequest_Header_
// *HttpRequest_Data_
// *HttpRequest_Trailer_
// *HttpRequest_UpgradeData_
Message isHttpRequest_Message `protobuf_oneof:"message"`
// contains filtered or unexported fields
}
func (*HttpRequest) Descriptor
deprecated
func (*HttpRequest) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead.
func (*HttpRequest) GetData ¶
func (x *HttpRequest) GetData() *HttpRequest_Data
func (*HttpRequest) GetHeader ¶
func (x *HttpRequest) GetHeader() *HttpRequest_Header
func (*HttpRequest) GetMessage ¶
func (x *HttpRequest) GetMessage() isHttpRequest_Message
func (*HttpRequest) GetTrailer ¶
func (x *HttpRequest) GetTrailer() *HttpRequest_Trailer
func (*HttpRequest) GetUpgradeData ¶
func (x *HttpRequest) GetUpgradeData() *HttpRequest_UpgradeData
func (*HttpRequest) ProtoMessage ¶
func (*HttpRequest) ProtoMessage()
func (*HttpRequest) ProtoReflect ¶
func (x *HttpRequest) ProtoReflect() protoreflect.Message
func (*HttpRequest) Reset ¶
func (x *HttpRequest) Reset()
func (*HttpRequest) String ¶
func (x *HttpRequest) String() string
type HttpRequest_Data ¶
type HttpRequest_Data struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*HttpRequest_Data) Descriptor
deprecated
func (*HttpRequest_Data) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest_Data.ProtoReflect.Descriptor instead.
func (*HttpRequest_Data) GetData ¶
func (x *HttpRequest_Data) GetData() []byte
func (*HttpRequest_Data) ProtoMessage ¶
func (*HttpRequest_Data) ProtoMessage()
func (*HttpRequest_Data) ProtoReflect ¶
func (x *HttpRequest_Data) ProtoReflect() protoreflect.Message
func (*HttpRequest_Data) Reset ¶
func (x *HttpRequest_Data) Reset()
func (*HttpRequest_Data) String ¶
func (x *HttpRequest_Data) String() string
type HttpRequest_Data_ ¶
type HttpRequest_Data_ struct {
Data *HttpRequest_Data `protobuf:"bytes,2,opt,name=data,oneof"`
}
type HttpRequest_Header ¶
type HttpRequest_Header struct {
Request *prototool.HttpRequest `protobuf:"bytes,1,opt,name=request" json:"request,omitempty"`
Extra *anypb.Any `protobuf:"bytes,2,opt,name=extra" json:"extra,omitempty"`
ContentLength *int64 `protobuf:"varint,3,opt,name=content_length,json=contentLength" json:"content_length,omitempty"`
// contains filtered or unexported fields
}
func (*HttpRequest_Header) Descriptor
deprecated
func (*HttpRequest_Header) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest_Header.ProtoReflect.Descriptor instead.
func (*HttpRequest_Header) GetContentLength ¶
func (x *HttpRequest_Header) GetContentLength() int64
func (*HttpRequest_Header) GetExtra ¶
func (x *HttpRequest_Header) GetExtra() *anypb.Any
func (*HttpRequest_Header) GetRequest ¶
func (x *HttpRequest_Header) GetRequest() *prototool.HttpRequest
func (*HttpRequest_Header) IsRequestWithoutBody ¶
func (x *HttpRequest_Header) IsRequestWithoutBody() bool
IsRequestWithoutBody returns if the request the header belongs to is expected to have no body
func (*HttpRequest_Header) ProtoMessage ¶
func (*HttpRequest_Header) ProtoMessage()
func (*HttpRequest_Header) ProtoReflect ¶
func (x *HttpRequest_Header) ProtoReflect() protoreflect.Message
func (*HttpRequest_Header) Reset ¶
func (x *HttpRequest_Header) Reset()
func (*HttpRequest_Header) String ¶
func (x *HttpRequest_Header) String() string
type HttpRequest_Header_ ¶
type HttpRequest_Header_ struct {
Header *HttpRequest_Header `protobuf:"bytes,1,opt,name=header,oneof"`
}
type HttpRequest_Trailer ¶
type HttpRequest_Trailer struct {
// contains filtered or unexported fields
}
func (*HttpRequest_Trailer) Descriptor
deprecated
func (*HttpRequest_Trailer) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest_Trailer.ProtoReflect.Descriptor instead.
func (*HttpRequest_Trailer) ProtoMessage ¶
func (*HttpRequest_Trailer) ProtoMessage()
func (*HttpRequest_Trailer) ProtoReflect ¶
func (x *HttpRequest_Trailer) ProtoReflect() protoreflect.Message
func (*HttpRequest_Trailer) Reset ¶
func (x *HttpRequest_Trailer) Reset()
func (*HttpRequest_Trailer) String ¶
func (x *HttpRequest_Trailer) String() string
type HttpRequest_Trailer_ ¶
type HttpRequest_Trailer_ struct {
Trailer *HttpRequest_Trailer `protobuf:"bytes,3,opt,name=trailer,oneof"`
}
type HttpRequest_UpgradeData ¶
type HttpRequest_UpgradeData struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*HttpRequest_UpgradeData) Descriptor
deprecated
func (*HttpRequest_UpgradeData) Descriptor() ([]byte, []int)
Deprecated: Use HttpRequest_UpgradeData.ProtoReflect.Descriptor instead.
func (*HttpRequest_UpgradeData) GetData ¶
func (x *HttpRequest_UpgradeData) GetData() []byte
func (*HttpRequest_UpgradeData) ProtoMessage ¶
func (*HttpRequest_UpgradeData) ProtoMessage()
func (*HttpRequest_UpgradeData) ProtoReflect ¶
func (x *HttpRequest_UpgradeData) ProtoReflect() protoreflect.Message
func (*HttpRequest_UpgradeData) Reset ¶
func (x *HttpRequest_UpgradeData) Reset()
func (*HttpRequest_UpgradeData) String ¶
func (x *HttpRequest_UpgradeData) String() string
type HttpRequest_UpgradeData_ ¶
type HttpRequest_UpgradeData_ struct {
UpgradeData *HttpRequest_UpgradeData `protobuf:"bytes,4,opt,name=upgradeData,oneof"`
}
type HttpResponse ¶
type HttpResponse struct {
// Types that are valid to be assigned to Message:
//
// *HttpResponse_Header_
// *HttpResponse_Data_
// *HttpResponse_Trailer_
// *HttpResponse_UpgradeData_
Message isHttpResponse_Message `protobuf_oneof:"message"`
// contains filtered or unexported fields
}
func (*HttpResponse) Descriptor
deprecated
func (*HttpResponse) Descriptor() ([]byte, []int)
Deprecated: Use HttpResponse.ProtoReflect.Descriptor instead.
func (*HttpResponse) GetData ¶
func (x *HttpResponse) GetData() *HttpResponse_Data
func (*HttpResponse) GetHeader ¶
func (x *HttpResponse) GetHeader() *HttpResponse_Header
func (*HttpResponse) GetMessage ¶
func (x *HttpResponse) GetMessage() isHttpResponse_Message
func (*HttpResponse) GetTrailer ¶
func (x *HttpResponse) GetTrailer() *HttpResponse_Trailer
func (*HttpResponse) GetUpgradeData ¶
func (x *HttpResponse) GetUpgradeData() *HttpResponse_UpgradeData
func (*HttpResponse) ProtoMessage ¶
func (*HttpResponse) ProtoMessage()
func (*HttpResponse) ProtoReflect ¶
func (x *HttpResponse) ProtoReflect() protoreflect.Message
func (*HttpResponse) Reset ¶
func (x *HttpResponse) Reset()
func (*HttpResponse) String ¶
func (x *HttpResponse) String() string
type HttpResponse_Data ¶
type HttpResponse_Data struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*HttpResponse_Data) Descriptor
deprecated
func (*HttpResponse_Data) Descriptor() ([]byte, []int)
Deprecated: Use HttpResponse_Data.ProtoReflect.Descriptor instead.
func (*HttpResponse_Data) GetData ¶
func (x *HttpResponse_Data) GetData() []byte
func (*HttpResponse_Data) ProtoMessage ¶
func (*HttpResponse_Data) ProtoMessage()
func (*HttpResponse_Data) ProtoReflect ¶
func (x *HttpResponse_Data) ProtoReflect() protoreflect.Message
func (*HttpResponse_Data) Reset ¶
func (x *HttpResponse_Data) Reset()
func (*HttpResponse_Data) String ¶
func (x *HttpResponse_Data) String() string
type HttpResponse_Data_ ¶
type HttpResponse_Data_ struct {
Data *HttpResponse_Data `protobuf:"bytes,2,opt,name=data,oneof"`
}
type HttpResponse_Header ¶
type HttpResponse_Header struct {
Response *prototool.HttpResponse `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
// contains filtered or unexported fields
}
func (*HttpResponse_Header) Descriptor
deprecated
func (*HttpResponse_Header) Descriptor() ([]byte, []int)
Deprecated: Use HttpResponse_Header.ProtoReflect.Descriptor instead.
func (*HttpResponse_Header) GetResponse ¶
func (x *HttpResponse_Header) GetResponse() *prototool.HttpResponse
func (*HttpResponse_Header) ProtoMessage ¶
func (*HttpResponse_Header) ProtoMessage()
func (*HttpResponse_Header) ProtoReflect ¶
func (x *HttpResponse_Header) ProtoReflect() protoreflect.Message
func (*HttpResponse_Header) Reset ¶
func (x *HttpResponse_Header) Reset()
func (*HttpResponse_Header) String ¶
func (x *HttpResponse_Header) String() string
type HttpResponse_Header_ ¶
type HttpResponse_Header_ struct {
Header *HttpResponse_Header `protobuf:"bytes,1,opt,name=header,oneof"`
}
type HttpResponse_Trailer ¶
type HttpResponse_Trailer struct {
// contains filtered or unexported fields
}
func (*HttpResponse_Trailer) Descriptor
deprecated
func (*HttpResponse_Trailer) Descriptor() ([]byte, []int)
Deprecated: Use HttpResponse_Trailer.ProtoReflect.Descriptor instead.
func (*HttpResponse_Trailer) ProtoMessage ¶
func (*HttpResponse_Trailer) ProtoMessage()
func (*HttpResponse_Trailer) ProtoReflect ¶
func (x *HttpResponse_Trailer) ProtoReflect() protoreflect.Message
func (*HttpResponse_Trailer) Reset ¶
func (x *HttpResponse_Trailer) Reset()
func (*HttpResponse_Trailer) String ¶
func (x *HttpResponse_Trailer) String() string
type HttpResponse_Trailer_ ¶
type HttpResponse_Trailer_ struct {
Trailer *HttpResponse_Trailer `protobuf:"bytes,3,opt,name=trailer,oneof"`
}
type HttpResponse_UpgradeData ¶
type HttpResponse_UpgradeData struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*HttpResponse_UpgradeData) Descriptor
deprecated
func (*HttpResponse_UpgradeData) Descriptor() ([]byte, []int)
Deprecated: Use HttpResponse_UpgradeData.ProtoReflect.Descriptor instead.
func (*HttpResponse_UpgradeData) GetData ¶
func (x *HttpResponse_UpgradeData) GetData() []byte
func (*HttpResponse_UpgradeData) ProtoMessage ¶
func (*HttpResponse_UpgradeData) ProtoMessage()
func (*HttpResponse_UpgradeData) ProtoReflect ¶
func (x *HttpResponse_UpgradeData) ProtoReflect() protoreflect.Message
func (*HttpResponse_UpgradeData) Reset ¶
func (x *HttpResponse_UpgradeData) Reset()
func (*HttpResponse_UpgradeData) String ¶
func (x *HttpResponse_UpgradeData) String() string
type HttpResponse_UpgradeData_ ¶
type HttpResponse_UpgradeData_ struct {
UpgradeData *HttpResponse_UpgradeData `protobuf:"bytes,4,opt,name=upgradeData,oneof"`
}
type InboundGRPCToOutboundHTTP ¶
type InboundGRPCToOutboundHTTP struct {
Log *slog.Logger
ErrRep errz.ErrReporter
HandleIOError HandleIOErrorFunc
HTTPDo HTTPDo
}
func (*InboundGRPCToOutboundHTTP) Pipe ¶
func (x *InboundGRPCToOutboundHTTP) Pipe(inbound InboundGRPCToOutboundHTTPStream) (retErr error)
type InboundGRPCToOutboundHTTPStream ¶
type InboundGRPCToOutboundHTTPStream = grpc.ServerStreamingServer[HttpResponse]
type InboundHTTPToOutboundGRPC ¶
type InboundHTTPToOutboundGRPC struct {
HTTP2GRPC HTTPToOutboundGRPC
NewClient func(context.Context) (HTTPRequestClient, error)
WriteErrorResponse WriteErrorResponse
MergeHeaders MergeHeadersFunc
TrackResponse TrackResponseFunc
}
func (*InboundHTTPToOutboundGRPC) Pipe ¶
func (x *InboundHTTPToOutboundGRPC) Pipe(w http.ResponseWriter, r *http.Request, headerExtra proto.Message) bool
Pipe pipes. headerExtra can be nil.
type InboundStreamToOutboundStream ¶
type InboundStreamToOutboundStream struct {
PipeInboundToOutbound func() error
PipeOutboundToInbound func() error
}
func (*InboundStreamToOutboundStream) Pipe ¶
func (x *InboundStreamToOutboundStream) Pipe() error
type JWTAuther ¶
type JWTAuther struct {
// contains filtered or unexported fields
}
func NewEdDSAJWTAuther ¶
func NewEdDSAJWTAuther(publicKey ed25519.PublicKey, issuer, audience string, loggerFromContext func(context.Context) *slog.Logger) *JWTAuther
NewEdDSAJWTAuther creates a new JWT auth for EdDSA signatures issuer may be empty to disable validation audience may be empty to disable validation
func NewHMACJWTAuther ¶
func NewHMACJWTAuther(secret []byte, issuer, audience string, loggerFromContext func(context.Context) *slog.Logger) *JWTAuther
NewHMACJWTAuther creates a new JWT auth for HMAC signatures issuer may be empty to disable validation audience may be empty to disable validation
func (*JWTAuther) StreamServerInterceptor ¶
func (a *JWTAuther) StreamServerInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamServerInterceptor returns a new stream server interceptors that performs per-request JWT auth.
func (*JWTAuther) UnaryServerInterceptor ¶
func (a *JWTAuther) UnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
UnaryServerInterceptor returns a new unary server interceptors that performs per-request JWT auth.
type JWTCredentials ¶
type JWTCredentials struct {
SigningMethod jwt.SigningMethod
// Type depends on the SigningMethod:
// - []byte for HMAC.
// - *ecdsa.PrivateKey for ECDSA.
// - *rsa.PrivateKey for RSA.
// - crypto.Signer for EdDSA.
SigningKey any
Audience jwt.ClaimStrings
Issuer string
Insecure bool
}
func (*JWTCredentials) GetRequestMetadata ¶
func (*JWTCredentials) RequireTransportSecurity ¶
func (c *JWTCredentials) RequireTransportSecurity() bool
type Logger ¶
Logger implements gRPC logging interface on top of slog.Handler. We don't have an official adapter, unfortunately: https://github.com/grpc/grpc-go/issues/6590.
func (*Logger) ErrorDepth ¶
func (*Logger) FatalDepth ¶
func (*Logger) WarningDepth ¶
type MergeHeadersFunc ¶
type RequestsInFlightStatsHandler ¶
type RequestsInFlightStatsHandler struct {
// contains filtered or unexported fields
}
func NewClientRequestsInFlightStatsHandler ¶
func NewClientRequestsInFlightStatsHandler(m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
func NewRequestsInFlightStatsHandler ¶
func NewRequestsInFlightStatsHandler(sub string, m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
func NewServerRequestsInFlightStatsHandler ¶
func NewServerRequestsInFlightStatsHandler(m otelmetric.Meter) (*RequestsInFlightStatsHandler, error)
func (*RequestsInFlightStatsHandler) HandleConn ¶
func (h *RequestsInFlightStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
func (*RequestsInFlightStatsHandler) HandleRPC ¶
func (h *RequestsInFlightStatsHandler) HandleRPC(ctx context.Context, stat stats.RPCStats)
func (*RequestsInFlightStatsHandler) TagConn ¶
func (h *RequestsInFlightStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
func (*RequestsInFlightStatsHandler) TagRPC ¶
func (h *RequestsInFlightStatsHandler) TagRPC(ctx context.Context, inf *stats.RPCTagInfo) context.Context
type ResponseWriter ¶
type ServerLimiter ¶
type ServerLimiter interface {
// Allow should return true and consume one "limitable event" if the limit has not been exceeded. Otherwise, it returns false and does not count towards the limit
Allow(ctx context.Context) bool
}
ServerLimiter defines the interface to perform server-side request rate limiting. Inspired by golang.org/x/time/rate.Limiter, but accepts a context
type TrackResponseFunc ¶
type TrackResponseFunc func(statusCode int)
type WriteErrorResponse ¶
type WriteErrorResponse func(*ErrResp)
Source Files
¶
- aggregate_server.go
- client_limiting.go
- client_validator.go
- grpctool.pb.go
- grpctool_extra.go
- header_metadata.go
- health.go
- http_roundtripper_to_outbound_grpc.go
- http_stream_vititors.go
- http_to_outbound_grpc.go
- inbound_grpc_to_outbound_http.go
- inbound_http_to_outbound_grpc.go
- inbound_stream_to_outbound_stream.go
- jwt_creds.go
- jwt_server_auth.go
- logger.go
- multi_url_resolver.go
- requests_in_flight_stats_handler.go
- server_error_reporter.go
- server_limiting.go
- server_skip.go
- server_validator.go
- tools.go