plugin

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 39 Imported by: 2

Documentation

Index

Constants

View Source
const BasePath = "/tmp/grpcox/"

BasePath define path where proto file will persisted

Variables

This section is empty.

Functions

func ComputeSvcConfigs

func ComputeSvcConfigs(services, methods []string) (map[string]*svcConfig, error)

func RPCMetadataHandler

func RPCMetadataHandler(methods []*desc.MethodDescriptor, files []*desc.FileDescriptor) http.Handler

RPCMetadataHandler returns an HTTP handler that can be used to get metadata for a specified method.

The handler accepts GET requests, using a query parameter to indicate the method whose schema metadata should be fetched. The response payload will be JSON. The format of the response body matches the format expected by the JavaScript client code embedded in WebFormContents.

Types

type Grpc

type Grpc struct {
	Host     string
	Method   string
	Metadata []RpcMetadata
	Timeout  float32
	Body     io.Reader
}

type InvokeGrpc

type InvokeGrpc struct {
	G *Grpc
	// contains filtered or unexported fields
}

func NewInvokeGrpc

func NewInvokeGrpc(g *Grpc) *InvokeGrpc

func (*InvokeGrpc) GetMethod added in v0.1.3

func (i *InvokeGrpc) GetMethod(serverName string) (method []string, err error)

func (*InvokeGrpc) GetReq added in v0.1.3

func (i *InvokeGrpc) GetReq(svc, method string) (results *schema, err error)

func (*InvokeGrpc) GetResource added in v0.1.3

func (i *InvokeGrpc) GetResource() (err error)

func (*InvokeGrpc) GetSvs added in v0.1.3

func (i *InvokeGrpc) GetSvs() (svc []string, err error)

func (*InvokeGrpc) InvokeFunction

func (i *InvokeGrpc) InvokeFunction() (results *RpcResult, err error)

func (*InvokeGrpc) Reset added in v0.1.5

func (i *InvokeGrpc) Reset() (err error)

type InvokeOptions

type InvokeOptions struct {
	// The set of metadata to add to all outgoing RPCs. If the invocation
	// request includes conflicting metadata, these values override, and the
	// values in the request will not be sent.
	ExtraMetadata []string
	// The set of HTTP header names that will be preserved. These are HTTP
	// request headers included in the invocation request that will be added as
	// request metadata when invoking the RPC. If the invocation request
	// includes conflicting metadata, the values in the HTTP request headers
	// will override, and the values in the request will not be sent.
	PreserveHeaders []string
	// If verbosity is greater than zero, the handler may log events, such as
	// cases where the request included metadata that conflicts with the
	// ExtraMetadata and PreserveHeaders fields above. It is an int, instead
	// of a bool "verbose" flag, so that additional logs may be added in the
	// future and the caller control how detailed those logs will be.
	Verbosity int
}

InvokeOptions contains optional arguments when creating a gRPCui invocation handler.

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

Resource - hold 3 main function (List, Describe, and Invoke)

func (*Resource) Close

func (r *Resource) Close()

Close - to close all resources that was opened before

func (*Resource) Describe

func (r *Resource) Describe(symbol string) (string, string, error)

Describe - The "describe" verb will print the type of any symbol that the server knows about or that is found in a given protoset file. It also prints a description of that symbol, in the form of snippets of proto source. It won't necessarily be the original source that defined the element, but it will be equivalent.

func (*Resource) Invoke

func (r *Resource) Invoke(ctx context.Context, metadata []string, symbol string, in io.Reader) (string, time.Duration, error)

Invoke - invoking gRPC function

func (*Resource) List

func (r *Resource) List(symbol string) ([]string, error)

List - To list all services exposed by a server symbol can be "" to list all available services symbol also can be service name to list all available method

type RpcMetadata

type RpcMetadata struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type RpcResult

type RpcResult struct {
	Headers   []RpcMetadata        `json:"headers"`
	Error     *rpcError            `json:"error"`
	Responses []rpcResponseElement `json:"responses"`
	Requests  *rpcRequestStats     `json:"requests"`
	Trailers  []RpcMetadata        `json:"trailers"`
	// contains filtered or unexported fields
}

func (*RpcResult) OnReceiveHeaders

func (r *RpcResult) OnReceiveHeaders(md metadata.MD)

func (*RpcResult) OnReceiveResponse

func (r *RpcResult) OnReceiveResponse(m proto.Message)

func (*RpcResult) OnReceiveTrailers

func (r *RpcResult) OnReceiveTrailers(stat *status.Status, md metadata.MD)

func (*RpcResult) OnResolveMethod

func (*RpcResult) OnResolveMethod(*desc.MethodDescriptor)

func (*RpcResult) OnSendHeaders

func (*RpcResult) OnSendHeaders(metadata.MD)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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