util

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const BufferedNetwork string = "buffnet"

Variables

This section is empty.

Functions

func RegisterGRPCServerFlags

func RegisterGRPCServerFlags(flags *pflag.FlagSet, config *GRPCServerConfig, flagPrefix, serviceName, defaultAddr string, defaultEnabled bool)

RegisterGRPCServerFlags adds the following flags for use with GrpcServerFromFlags: - "$PREFIX-addr" - "$PREFIX-tls-cert-path" - "$PREFIX-tls-key-path" - "$PREFIX-max-conn-age"

func RegisterHTTPServerFlags

func RegisterHTTPServerFlags(flags *pflag.FlagSet, config *HTTPServerConfig, flagPrefix, serviceName, defaultAddr string, defaultEnabled bool)

RegisterHTTPServerFlags adds the following flags for use with HttpServerFromFlags: - "$PREFIX-addr" - "$PREFIX-tls-cert-path" - "$PREFIX-tls-key-path" - "$PREFIX-enabled"

Types

type DialFunc

type DialFunc func(ctx context.Context, opts ...grpc.DialOption) (*grpc.ClientConn, error)

type GRPCServerConfig

type GRPCServerConfig struct {
	Address      string
	Network      string
	TLSCertPath  string
	TLSKeyPath   string
	MaxConnAge   time.Duration
	Enabled      bool
	BufferSize   int
	ClientCAPath string
	MaxWorkers   uint32
	// contains filtered or unexported fields
}

func (*GRPCServerConfig) Complete

func (c *GRPCServerConfig) Complete(level zerolog.Level, svcRegistrationFn func(server *grpc.Server), opts ...grpc.ServerOption) (RunnableGRPCServer, error)

Complete takes a set of default options and returns a completed server

type HTTPServerConfig

type HTTPServerConfig struct {
	Address     string
	TLSCertPath string
	TLSKeyPath  string
	Enabled     bool
	// contains filtered or unexported fields
}

func (*HTTPServerConfig) Complete

func (c *HTTPServerConfig) Complete(level zerolog.Level, handler http.Handler) (RunnableHTTPServer, error)

type NetDialFunc added in v1.6.0

type NetDialFunc func(ctx context.Context, s string) (net.Conn, error)

type RunnableGRPCServer

type RunnableGRPCServer interface {
	WithOpts(opts ...grpc.ServerOption) RunnableGRPCServer
	Listen(ctx context.Context) func() error
	DialContext(ctx context.Context, opts ...grpc.DialOption) (*grpc.ClientConn, error)
	NetDialContext(ctx context.Context, s string) (net.Conn, error)
	Insecure() bool
	GracefulStop()
}

type RunnableHTTPServer

type RunnableHTTPServer interface {
	ListenAndServe() error
	Close()
}

Jump to

Keyboard shortcuts

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