grpccheckerhelper

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSON = Format("json")
	FormatText = Format("text")
)

Variables

View Source
var ErrReflectionNotSupported = errors.New("server does not support the reflection API")

Functions

func AnyResolverFromDescriptorSource

func AnyResolverFromDescriptorSource(source DescriptorSource) jsonpb.AnyResolver

func BuildCredentialsTLS added in v1.0.12

func BuildCredentialsTLS(caCerts, clientCert, clientKey, serverName string) (credentials.TransportCredentials, error)

func GetDescriptorText

func GetDescriptorText(dsc desc.Descriptor, _ DescriptorSource) (string, error)

func MetadataFromHeaders

func MetadataFromHeaders(headers []string) metadata.MD

func NewClientGRPC added in v1.0.12

func NewClientGRPC(ctx context.Context, arg ClientDialOptions) (*grpc.ClientConn, error)

func RequestParserAndFormatter

func RequestParserAndFormatter(format Format, descSource DescriptorSource, in io.Reader, opts FormatOptions) (RequestParser, Formatter, error)

Types

type CheckerResponse

type CheckerResponse struct {
	Error        error
	Status       string
	MessageRPC   string
	ConnectionTs float64
	ConnectTs    float64
	ResolveTs    float64
	Reflections  map[string]interface{}
	RespTrailers metadata.MD
}

type ClientDialOptions added in v1.0.12

type ClientDialOptions struct {
	Target        string
	TimeoutSec    float64
	KeepaliveSec  float64
	MaxMsgSize    int
	Network       string // tcp or unix
	CertsCA       string
	Certificate   string
	PrivateKey    string
	ServerNameTLS string
	IgnoreCert    bool
}

type CompositeSource

type CompositeSource struct {
	Reflection DescriptorSource
	File       DescriptorSource
}

func (CompositeSource) AllExtensionsForType

func (cs CompositeSource) AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error)

func (CompositeSource) FindSymbol

func (cs CompositeSource) FindSymbol(fullyQualifiedName string) (desc.Descriptor, error)

func (CompositeSource) ListServices

func (cs CompositeSource) ListServices() ([]string, error)

type DefaultEventHandler

type DefaultEventHandler struct {
	Out            io.Writer
	Formatter      Formatter
	VerbosityLevel int
	ConnectStart   time.Time
	NumResponses   int
	Status         *status.Status
}

type DescriptorSource

type DescriptorSource interface {
	ListServices() ([]string, error)
	FindSymbol(fullyQualifiedName string) (desc.Descriptor, error)
	AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error)
}

func DescriptorSourceFromFileDescriptors

func DescriptorSourceFromFileDescriptors(files ...*desc.FileDescriptor) (DescriptorSource, error)

func DescriptorSourceFromProtoFileContent

func DescriptorSourceFromProtoFileContent(fileContent string) (DescriptorSource, error)

func DescriptorSourceFromServer

func DescriptorSourceFromServer(_ context.Context, refClient *grpcreflect.Client) DescriptorSource

type Format

type Format string

type FormatOptions

type FormatOptions struct {
	EmitJSONDefaultFields bool
	AllowUnknownFields    bool
	IncludeTextSeparator  bool
}

type Formatter

type Formatter func(proto.Message) (string, error)

func NewJSONFormatter

func NewJSONFormatter(emitDefaults bool, resolver jsonpb.AnyResolver) Formatter

func NewTextFormatter

func NewTextFormatter(includeSeparator bool) Formatter

type InvokeResponse

type InvokeResponse struct {
	Status       string
	MessageRPC   string
	Error        error
	ResolveTs    float64
	ConnectTs    float64
	RespTrailers metadata.MD
}

func DynamicInvokeRPC added in v1.0.12

func DynamicInvokeRPC(ctx context.Context, source DescriptorSource, ch grpcdynamic.Channel, methodName string, headers []string, handler *DefaultEventHandler, requestData RequestSupplier) InvokeResponse

type RequestParser

type RequestParser interface {
	Next(msg proto.Message) error
	NumRequests() int
}

func NewJSONRequestParserWithUnmarshaler

func NewJSONRequestParserWithUnmarshaler(in io.Reader, unmarshaler jsonpb.Unmarshaler) RequestParser

func NewTextRequestParser

func NewTextRequestParser(in io.Reader) RequestParser

type RequestSupplier

type RequestSupplier func(proto.Message) error

Jump to

Keyboard shortcuts

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