util

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 28 Imported by: 2

Documentation

Overview

Code generated by github.com/ecordell/optgen. DO NOT EDIT.

Index

Constants

View Source
const BufferedNetwork string = "buffnet"

Variables

This section is empty.

Functions

func RegisterCommonFlags added in v1.36.2

func RegisterCommonFlags(cmd *cobra.Command)

Registers flags that are common to many commands. NOTE: these used to be registered in the root command so that they were shared across all commands, but this made it difficult to organize the flags, so we lifted them here.

func RegisterDeprecatedHTTPServerFlags added in v1.24.0

func RegisterDeprecatedHTTPServerFlags(cmd *cobra.Command, flagPrefix, serviceName string) error

RegisterDeprecatedHTTPServerFlags registers a set of HTTP server flags as fully deprecated, for a removed HTTP service.

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        `debugmap:"visible"`
	Network      string        `debugmap:"visible"`
	TLSCertPath  string        `debugmap:"visible"`
	TLSKeyPath   string        `debugmap:"visible"`
	MaxConnAge   time.Duration `debugmap:"visible"`
	Enabled      bool          `debugmap:"visible"`
	BufferSize   int           `debugmap:"visible"`
	ClientCAPath string        `debugmap:"visible"`
	MaxWorkers   uint32        `debugmap:"visible"`
	// contains filtered or unexported fields
}

func GRPCServerConfigWithOptions added in v1.22.0

func GRPCServerConfigWithOptions(g *GRPCServerConfig, opts ...GRPCServerConfigOption) *GRPCServerConfig

GRPCServerConfigWithOptions configures an existing GRPCServerConfig with the passed in options set

func NewGRPCServerConfigWithOptions added in v1.22.0

func NewGRPCServerConfigWithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig

NewGRPCServerConfigWithOptions creates a new GRPCServerConfig with the passed in options set

func NewGRPCServerConfigWithOptionsAndDefaults added in v1.22.0

func NewGRPCServerConfigWithOptionsAndDefaults(opts ...GRPCServerConfigOption) *GRPCServerConfig

NewGRPCServerConfigWithOptionsAndDefaults creates a new GRPCServerConfig with the passed in options set starting from the defaults

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

func (GRPCServerConfig) DebugMap added in v1.22.0

func (g GRPCServerConfig) DebugMap() map[string]any

DebugMap returns a map form of GRPCServerConfig for debugging

func (*GRPCServerConfig) ToOption added in v1.22.0

ToOption returns a new GRPCServerConfigOption that sets the values from the passed in GRPCServerConfig

func (*GRPCServerConfig) WithOptions added in v1.22.0

func (g *GRPCServerConfig) WithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig

WithOptions configures the receiver GRPCServerConfig with the passed in options set

type GRPCServerConfigOption added in v1.22.0

type GRPCServerConfigOption func(g *GRPCServerConfig)

func WithAddress added in v1.22.0

func WithAddress(address string) GRPCServerConfigOption

WithAddress returns an option that can set Address on a GRPCServerConfig

func WithBufferSize added in v1.22.0

func WithBufferSize(bufferSize int) GRPCServerConfigOption

WithBufferSize returns an option that can set BufferSize on a GRPCServerConfig

func WithClientCAPath added in v1.22.0

func WithClientCAPath(clientCAPath string) GRPCServerConfigOption

WithClientCAPath returns an option that can set ClientCAPath on a GRPCServerConfig

func WithEnabled added in v1.22.0

func WithEnabled(enabled bool) GRPCServerConfigOption

WithEnabled returns an option that can set Enabled on a GRPCServerConfig

func WithMaxConnAge added in v1.22.0

func WithMaxConnAge(maxConnAge time.Duration) GRPCServerConfigOption

WithMaxConnAge returns an option that can set MaxConnAge on a GRPCServerConfig

func WithMaxWorkers added in v1.22.0

func WithMaxWorkers(maxWorkers uint32) GRPCServerConfigOption

WithMaxWorkers returns an option that can set MaxWorkers on a GRPCServerConfig

func WithNetwork added in v1.22.0

func WithNetwork(network string) GRPCServerConfigOption

WithNetwork returns an option that can set Network on a GRPCServerConfig

func WithTLSCertPath added in v1.22.0

func WithTLSCertPath(tLSCertPath string) GRPCServerConfigOption

WithTLSCertPath returns an option that can set TLSCertPath on a GRPCServerConfig

func WithTLSKeyPath added in v1.22.0

func WithTLSKeyPath(tLSKeyPath string) GRPCServerConfigOption

WithTLSKeyPath returns an option that can set TLSKeyPath on a GRPCServerConfig

type HTTPServerConfig

type HTTPServerConfig struct {
	HTTPAddress     string `debugmap:"visible"`
	HTTPTLSCertPath string `debugmap:"visible"`
	HTTPTLSKeyPath  string `debugmap:"visible"`
	HTTPEnabled     bool   `debugmap:"visible"`
	// contains filtered or unexported fields
}

func HTTPServerConfigWithOptions added in v1.22.0

func HTTPServerConfigWithOptions(h *HTTPServerConfig, opts ...HTTPServerConfigOption) *HTTPServerConfig

HTTPServerConfigWithOptions configures an existing HTTPServerConfig with the passed in options set

func NewHTTPServerConfigWithOptions added in v1.22.0

func NewHTTPServerConfigWithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig

NewHTTPServerConfigWithOptions creates a new HTTPServerConfig with the passed in options set

func NewHTTPServerConfigWithOptionsAndDefaults added in v1.22.0

func NewHTTPServerConfigWithOptionsAndDefaults(opts ...HTTPServerConfigOption) *HTTPServerConfig

NewHTTPServerConfigWithOptionsAndDefaults creates a new HTTPServerConfig with the passed in options set starting from the defaults

func (*HTTPServerConfig) Complete

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

func (HTTPServerConfig) DebugMap added in v1.22.0

func (h HTTPServerConfig) DebugMap() map[string]any

DebugMap returns a map form of HTTPServerConfig for debugging

func (*HTTPServerConfig) ToOption added in v1.22.0

ToOption returns a new HTTPServerConfigOption that sets the values from the passed in HTTPServerConfig

func (*HTTPServerConfig) WithOptions added in v1.22.0

func (h *HTTPServerConfig) WithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig

WithOptions configures the receiver HTTPServerConfig with the passed in options set

type HTTPServerConfigOption added in v1.22.0

type HTTPServerConfigOption func(h *HTTPServerConfig)

func WithHTTPAddress added in v1.22.0

func WithHTTPAddress(hTTPAddress string) HTTPServerConfigOption

WithHTTPAddress returns an option that can set HTTPAddress on a HTTPServerConfig

func WithHTTPEnabled added in v1.22.0

func WithHTTPEnabled(hTTPEnabled bool) HTTPServerConfigOption

WithHTTPEnabled returns an option that can set HTTPEnabled on a HTTPServerConfig

func WithHTTPTLSCertPath added in v1.22.0

func WithHTTPTLSCertPath(hTTPTLSCertPath string) HTTPServerConfigOption

WithHTTPTLSCertPath returns an option that can set HTTPTLSCertPath on a HTTPServerConfig

func WithHTTPTLSKeyPath added in v1.22.0

func WithHTTPTLSKeyPath(hTTPTLSKeyPath string) HTTPServerConfigOption

WithHTTPTLSKeyPath returns an option that can set HTTPTLSKeyPath on a HTTPServerConfig

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