Documentation ¶
Index ¶
- Variables
- func DefaultUserAgent(protocol string, bufVersion string) string
- func DescriptorKind(d protoreflect.Descriptor) string
- func ErrorHasFilename(err error, filename string) error
- func GetAuthority(url *url.URL, headers http.Header) string
- func LoadHeaders(headerFlags []string) (http.Header, error)
- func MakeVerboseTLSConfig(settings *TLSSettings, authority string, printer verbose.Printer) (*tls.Config, error)
- func NewVerboseHTTPClient(transport http.RoundTripper, printer verbose.Printer) connect.HTTPClient
- func ResolveMethodDescriptor(res protoencoding.Resolver, service, method string) (protoreflect.MethodDescriptor, error)
- func TraceTrailersInterceptor(printer verbose.Printer) connect.Interceptor
- type Container
- func (c Container) AppName() string
- func (c Container) Arg(i int) string
- func (c Container) CacheDirPath() string
- func (c Container) ConfigDirPath() string
- func (c Container) DataDirPath() string
- func (c Container) Env(key string) string
- func (c Container) ForEachEnv(f func(string, string))
- func (c Container) Logger() *zap.Logger
- func (c Container) NumArgs() int
- func (c Container) Port() (uint16, error)
- func (c Container) Stderr() io.Writer
- func (c Container) Stdin() io.Reader
- func (c Container) Stdout() io.Writer
- func (c Container) VerbosePrinter() verbose.Printer
- type Invoker
- type ReflectProtocol
- type ReflectionResolver
- func (r *ReflectionResolver) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error)
- func (r *ReflectionResolver) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error)
- func (r *ReflectionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- func (r *ReflectionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- func (r *ReflectionResolver) FindFileByPath(path string) (protoreflect.FileDescriptor, error)
- func (r *ReflectionResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error)
- func (r *ReflectionResolver) FindMessageByURL(url string) (protoreflect.MessageType, error)
- func (r *ReflectionResolver) GetServices() ([]protoreflect.ServiceDescriptor, error)
- func (r *ReflectionResolver) Reset()
- type TLSSettings
- type ZeroLogPrinter
Constants ¶
This section is empty.
Variables ¶
var ( // AllKnownReflectProtocolStrings are all string values for // ReflectProtocol that represent known reflection protocols. AllKnownReflectProtocolStrings = []string{ "grpc-v1", "grpc-v1alpha", } )
Functions ¶
func DefaultUserAgent ¶
DefaultUserAgent returns the default user agent for the given protocol.
func DescriptorKind ¶
func DescriptorKind(d protoreflect.Descriptor) string
DescriptorKind returns a succinct description of the type of the given descriptor.
func ErrorHasFilename ¶
ErrorHasFilename makes sure that the given error includes a reference to the given filename. If not, it wraps the given error and adds the filename. This is to make sure errors are useful -- an error related to file I/O is not very helpful if it doesn't indicate the name of the file.
func GetAuthority ¶
GetAuthority determines the authority for a request with the given URL and request headers. If headers include a "Host" header, that is used. (If the request contains more than one, that is usually not valid or acceptable to servers, but this function will look at only the first.) If there is no such header, the authority is the host portion of the URL (both the domain name/IP address and port).
func LoadHeaders ¶
LoadHeaders computes the set of request headers from the given flag values, loading from file(s) if so instructed. A header flag is usually in the form "name: value", but it may start with "@" to indicate a filename from which headers are loaded. It may also be "*", to indicate that the given others are included in full.
If the filename following an "@" header flag is "-", it means to read from stdin.
The given dataFile is the name of a file from which request data is read. If a "@" header flag indicates to read from the same file, then the headers must be at the start of the file, following by a blank line, followed by the actual request body. In such a case, the returned ReadCloser will be non-nil and correspond to that point in the file (after headers and blank line), so the request body can be read from it.
func MakeVerboseTLSConfig ¶
func MakeVerboseTLSConfig(settings *TLSSettings, authority string, printer verbose.Printer) (*tls.Config, error)
MakeVerboseTLSConfig constructs a *tls.Config that logs information to the given printer as a TLS connection is negotiated.
func NewVerboseHTTPClient ¶
func NewVerboseHTTPClient(transport http.RoundTripper, printer verbose.Printer) connect.HTTPClient
NewVerboseHTTPClient creates a new HTTP client with the given transport and printing verbose trace information to the given printer.
func ResolveMethodDescriptor ¶
func ResolveMethodDescriptor(res protoencoding.Resolver, service, method string) (protoreflect.MethodDescriptor, error)
ResolveMethodDescriptor uses the given resolver to find a descriptor for the requested service and method. The service name must be fully-qualified.
func TraceTrailersInterceptor ¶
TraceTrailersInterceptor returns an interceptor that will print information about trailers for streaming calls to the given printer. This is used with the Connect and gRPC-web protocols since these protocols include trailers in the request body, instead of using actual HTTP trailers. (For the gRPC protocol, which uses actual HTTP trailers, the verbose HTTP client suffices since it already prints information about the trailers.)
Types ¶
type Container ¶
type Container struct { }
func (Container) CacheDirPath ¶
func (Container) ConfigDirPath ¶
func (Container) DataDirPath ¶
func (Container) ForEachEnv ¶
func (Container) VerbosePrinter ¶
type Invoker ¶
type Invoker interface { // Invoke invokes an RPC method using the given input data and request headers. // The dataSource is a string that describes the input data (e.g. a filename). // The actual contents of the request data is read from the given reader. Invoke(ctx context.Context, input rxgo.Observable, headers http.Header) error }
Invoker provides the ability to invoke RPCs dynamically.
func NewInvoker ¶
func NewInvoker( md protoreflect.MethodDescriptor, res protoencoding.Resolver, httpClient connect.HTTPClient, opts []connect.ClientOption, url string, out io.Writer, output rx.ItemSink, ) Invoker
NewInvoker creates a new invoker for invoking the method described by the given descriptor. The given writer is used to write the output response(s) in JSON format. The given resolver is used to resolve Any messages and extensions that appear in the input or output. Other parameters are used to create a Connect client, for issuing the RPC.
type ReflectProtocol ¶
type ReflectProtocol int
ReflectProtocol is a reflection protocol.
const ( // ReflectProtocolUnknown represents that the server reflection protocol // is unknown. If given this value, the server reflection resolver will // cycle through the known reflection protocols from newest to oldest, // trying each one until a reflection protocol that works is found. ReflectProtocolUnknown ReflectProtocol = iota + 1 // ReflectProtocolGRPCV1 represents the gRPC server reflection protocol // defined by the service grpc.reflection.v1.ServerReflection. ReflectProtocolGRPCV1 // ReflectProtocolGRPCV1Alpha represents the gRPC server reflection protocol // defined by the service grpc.reflection.v1alpha.ServerReflection. ReflectProtocolGRPCV1Alpha )
func ParseReflectProtocol ¶
func ParseReflectProtocol(s string) (ReflectProtocol, error)
ParseReflectProtocol parses the ReflectProtocol.
The empty string is a parse error.
func (ReflectProtocol) String ¶
func (r ReflectProtocol) String() string
String implements fmt.Stringer.
type ReflectionResolver ¶
type ReflectionResolver struct {
// contains filtered or unexported fields
}
func NewServerReflectionResolver ¶
func NewServerReflectionResolver( ctx context.Context, httpClient connect.HTTPClient, opts []connect.ClientOption, baseURL string, reflectProtocol ReflectProtocol, headers http.Header, printer verbose.Printer, ) (r *ReflectionResolver, closeResolver func())
NewServerReflectionResolver creates a new resolver using the given details to create an RPC reflection client, to ask the server for descriptors.
func (*ReflectionResolver) FindDescriptorByName ¶
func (r *ReflectionResolver) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error)
func (*ReflectionResolver) FindEnumByName ¶
func (r *ReflectionResolver) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error)
func (*ReflectionResolver) FindExtensionByName ¶
func (r *ReflectionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
func (*ReflectionResolver) FindExtensionByNumber ¶
func (r *ReflectionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
func (*ReflectionResolver) FindFileByPath ¶
func (r *ReflectionResolver) FindFileByPath(path string) (protoreflect.FileDescriptor, error)
func (*ReflectionResolver) FindMessageByName ¶
func (r *ReflectionResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error)
func (*ReflectionResolver) FindMessageByURL ¶
func (r *ReflectionResolver) FindMessageByURL(url string) (protoreflect.MessageType, error)
func (*ReflectionResolver) GetServices ¶
func (r *ReflectionResolver) GetServices() ([]protoreflect.ServiceDescriptor, error)
func (*ReflectionResolver) Reset ¶
func (r *ReflectionResolver) Reset()
type TLSSettings ¶
type TLSSettings struct {
// Filenames for a private key, certificate, and CA certificate pool.
KeyFile, CertFile, CACertFile string
// Override server name, for SNI.
ServerName string
// If true, the server's certificate is not verified.
Insecure bool
}
TLSSettings contains settings related to creating a TLS client.
type ZeroLogPrinter ¶
type ZeroLogPrinter struct{}
func (*ZeroLogPrinter) Printf ¶
func (z *ZeroLogPrinter) Printf(format string, args ...interface{})
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package normalpath provides functions similar to filepath.
|
Package normalpath provides functions similar to filepath. |
Package stringutil implements string utilities.
|
Package stringutil implements string utilities. |