grpc

package
v1.8.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockingNewClient added in v1.8.8

func BlockingNewClient(ctx context.Context, network, address string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)

BlockingNewClient is a helper method to dial the given address, using optional TLS credentials, and blocking until the returned connection is ready. If the given credentials are nil, the connection will be insecure (plain-text). Lifted from: https://github.com/fullstorydev/grpcurl/blob/master/grpcurl.go

func ContextWithSanitizer added in v1.8.8

func ContextWithSanitizer(ctx context.Context, sanitizer Sanitizer) context.Context

ContextWithSanitizer returns a new context with sanitizer set.

func ErrorCodeGitStreamServerInterceptor added in v1.8.8

func ErrorCodeGitStreamServerInterceptor() grpc.StreamServerInterceptor

ErrorCodeGitStreamServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any.

func ErrorCodeGitUnaryServerInterceptor added in v1.8.8

func ErrorCodeGitUnaryServerInterceptor() grpc.UnaryServerInterceptor

ErrorCodeGitUnaryServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any.

func ErrorCodeK8sStreamServerInterceptor added in v1.8.8

func ErrorCodeK8sStreamServerInterceptor() grpc.StreamServerInterceptor

ErrorCodeK8sStreamServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any.

func ErrorCodeK8sUnaryServerInterceptor added in v1.8.8

func ErrorCodeK8sUnaryServerInterceptor() grpc.UnaryServerInterceptor

ErrorCodeK8sUnaryServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any.

func ErrorSanitizerUnaryServerInterceptor added in v1.8.8

func ErrorSanitizerUnaryServerInterceptor() grpc.UnaryServerInterceptor

ErrorSanitizerUnaryServerInterceptor returns a new unary server interceptor that sanitizes error messages and provides Sanitizer to define replacements.

func InterceptorLogger added in v1.8.8

func InterceptorLogger(l logrus.FieldLogger) logging.Logger

InterceptorLogger adapts logrus logger to interceptor logger.

func LoggerRecoveryHandler added in v1.8.8

func LoggerRecoveryHandler(log *logrus.Entry) recovery.RecoveryHandlerFunc

LoggerRecoveryHandler return a handler for recovering from panics and returning error

func MustMarshal added in v1.8.8

func MustMarshal(v any) []byte

MustMarshal is a convenience function to marshal an object successfully or panic

func NewSanitizer added in v1.8.8

func NewSanitizer() *sanitizer

NewSanitizer returns a new Sanitizer instance

func PayloadStreamServerInterceptor added in v0.7.0

func PayloadStreamServerInterceptor(entry *logrus.Entry, logClaims bool, decider func(context.Context, interceptors.CallMeta) bool) grpc.StreamServerInterceptor

func PayloadUnaryServerInterceptor added in v0.7.0

func PayloadUnaryServerInterceptor(entry *logrus.Entry, logClaims bool, decider func(context.Context, interceptors.CallMeta) bool) grpc.UnaryServerInterceptor

func RetryOnlyForServerStreamInterceptor added in v1.8.8

func RetryOnlyForServerStreamInterceptor(retryOpts ...grpc_retry.CallOption) grpc.StreamClientInterceptor

func UnwrapGRPCStatus added in v1.8.8

func UnwrapGRPCStatus(err error) *status.Status

UnwrapGRPCStatus will attempt to cast the given error into a grpc Status object unwrapping all existing inner errors. Will return nil if none of the nested errors can be casted.

func UserAgentStreamServerInterceptor added in v0.11.0

func UserAgentStreamServerInterceptor(clientName, constraintStr string) grpc.StreamServerInterceptor

UserAgentStreamServerInterceptor returns a StreamServerInterceptor which enforces a minimum client version in the user agent

func UserAgentUnaryServerInterceptor added in v0.11.0

func UserAgentUnaryServerInterceptor(clientName, constraintStr string) grpc.UnaryServerInterceptor

UserAgentUnaryServerInterceptor returns a UnaryServerInterceptor which enforces a minimum client version in the user agent

Types

type JSONMarshaler added in v1.8.8

type JSONMarshaler struct{}

JSONMarshaler is a type which satisfies the grpc-gateway Marshaler interface

func (*JSONMarshaler) ContentType added in v1.8.8

func (j *JSONMarshaler) ContentType() string

ContentType implements gwruntime.Marshaler.

func (*JSONMarshaler) Marshal added in v1.8.8

func (j *JSONMarshaler) Marshal(v any) ([]byte, error)

Marshal implements gwruntime.Marshaler.

func (*JSONMarshaler) NewDecoder added in v1.8.8

func (j *JSONMarshaler) NewDecoder(r io.Reader) gwruntime.Decoder

NewDecoder implements gwruntime.Marshaler.

func (*JSONMarshaler) NewEncoder added in v1.8.8

func (j *JSONMarshaler) NewEncoder(w io.Writer) gwruntime.Encoder

NewEncoder implements gwruntime.Marshaler.

func (*JSONMarshaler) Unmarshal added in v1.8.8

func (j *JSONMarshaler) Unmarshal(data []byte, v any) error

Unmarshal implements gwruntime.Marshaler.

type Sanitizer added in v1.8.8

type Sanitizer interface {
	Replace(s string) string
	AddReplacement(val string, replacement string)
	AddRegexReplacement(regex *regexp.Regexp, replacement string)
}

Sanitizer provides methods to define list of strings and replacements

func SanitizerFromContext added in v1.8.8

func SanitizerFromContext(ctx context.Context) (Sanitizer, bool)

SanitizerFromContext returns sanitizer from context.

type TLSTestResult added in v0.3.0

type TLSTestResult struct {
	TLS         bool
	InsecureErr error
}

func TestTLS added in v0.3.0

func TestTLS(address string, dialTime time.Duration) (*TLSTestResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL