Documentation ¶
Overview ¶
Code generated by github.com/ecordell/optgen. DO NOT EDIT.
Index ¶
- Constants
- func RegisterCommonFlags(cmd *cobra.Command)
- func RegisterDeprecatedHTTPServerFlags(cmd *cobra.Command, flagPrefix, serviceName string) error
- func RegisterGRPCServerFlags(flags *pflag.FlagSet, config *GRPCServerConfig, ...)
- func RegisterHTTPServerFlags(flags *pflag.FlagSet, config *HTTPServerConfig, ...)
- type DialFunc
- type GRPCServerConfig
- func (c *GRPCServerConfig) Complete(level zerolog.Level, svcRegistrationFn func(server *grpc.Server), ...) (RunnableGRPCServer, error)
- func (g GRPCServerConfig) DebugMap() map[string]any
- func (g *GRPCServerConfig) ToOption() GRPCServerConfigOption
- func (g *GRPCServerConfig) WithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig
- type GRPCServerConfigOption
- func WithAddress(address string) GRPCServerConfigOption
- func WithBufferSize(bufferSize int) GRPCServerConfigOption
- func WithClientCAPath(clientCAPath string) GRPCServerConfigOption
- func WithEnabled(enabled bool) GRPCServerConfigOption
- func WithMaxConnAge(maxConnAge time.Duration) GRPCServerConfigOption
- func WithMaxWorkers(maxWorkers uint32) GRPCServerConfigOption
- func WithNetwork(network string) GRPCServerConfigOption
- func WithTLSCertPath(tLSCertPath string) GRPCServerConfigOption
- func WithTLSKeyPath(tLSKeyPath string) GRPCServerConfigOption
- type HTTPServerConfig
- func (c *HTTPServerConfig) Complete(level zerolog.Level, handler http.Handler) (RunnableHTTPServer, error)
- func (h HTTPServerConfig) DebugMap() map[string]any
- func (h *HTTPServerConfig) ToOption() HTTPServerConfigOption
- func (h *HTTPServerConfig) WithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig
- type HTTPServerConfigOption
- type NetDialFunc
- type RunnableGRPCServer
- type RunnableHTTPServer
Constants ¶
const BufferedNetwork string = "buffnet"
Variables ¶
This section is empty.
Functions ¶
func RegisterCommonFlags ¶ added in v0.0.3
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 ¶
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 ¶
func GRPCServerConfigWithOptions(g *GRPCServerConfig, opts ...GRPCServerConfigOption) *GRPCServerConfig
GRPCServerConfigWithOptions configures an existing GRPCServerConfig with the passed in options set
func NewGRPCServerConfigWithOptions ¶
func NewGRPCServerConfigWithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig
NewGRPCServerConfigWithOptions creates a new GRPCServerConfig with the passed in options set
func NewGRPCServerConfigWithOptionsAndDefaults ¶
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 ¶
func (g GRPCServerConfig) DebugMap() map[string]any
DebugMap returns a map form of GRPCServerConfig for debugging
func (*GRPCServerConfig) ToOption ¶
func (g *GRPCServerConfig) ToOption() GRPCServerConfigOption
ToOption returns a new GRPCServerConfigOption that sets the values from the passed in GRPCServerConfig
func (*GRPCServerConfig) WithOptions ¶
func (g *GRPCServerConfig) WithOptions(opts ...GRPCServerConfigOption) *GRPCServerConfig
WithOptions configures the receiver GRPCServerConfig with the passed in options set
type GRPCServerConfigOption ¶
type GRPCServerConfigOption func(g *GRPCServerConfig)
func WithAddress ¶
func WithAddress(address string) GRPCServerConfigOption
WithAddress returns an option that can set Address on a GRPCServerConfig
func WithBufferSize ¶
func WithBufferSize(bufferSize int) GRPCServerConfigOption
WithBufferSize returns an option that can set BufferSize on a GRPCServerConfig
func WithClientCAPath ¶
func WithClientCAPath(clientCAPath string) GRPCServerConfigOption
WithClientCAPath returns an option that can set ClientCAPath on a GRPCServerConfig
func WithEnabled ¶
func WithEnabled(enabled bool) GRPCServerConfigOption
WithEnabled returns an option that can set Enabled on a GRPCServerConfig
func WithMaxConnAge ¶
func WithMaxConnAge(maxConnAge time.Duration) GRPCServerConfigOption
WithMaxConnAge returns an option that can set MaxConnAge on a GRPCServerConfig
func WithMaxWorkers ¶
func WithMaxWorkers(maxWorkers uint32) GRPCServerConfigOption
WithMaxWorkers returns an option that can set MaxWorkers on a GRPCServerConfig
func WithNetwork ¶
func WithNetwork(network string) GRPCServerConfigOption
WithNetwork returns an option that can set Network on a GRPCServerConfig
func WithTLSCertPath ¶
func WithTLSCertPath(tLSCertPath string) GRPCServerConfigOption
WithTLSCertPath returns an option that can set TLSCertPath on a GRPCServerConfig
func WithTLSKeyPath ¶
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 ¶
func HTTPServerConfigWithOptions(h *HTTPServerConfig, opts ...HTTPServerConfigOption) *HTTPServerConfig
HTTPServerConfigWithOptions configures an existing HTTPServerConfig with the passed in options set
func NewHTTPServerConfigWithOptions ¶
func NewHTTPServerConfigWithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig
NewHTTPServerConfigWithOptions creates a new HTTPServerConfig with the passed in options set
func NewHTTPServerConfigWithOptionsAndDefaults ¶
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 ¶
func (h HTTPServerConfig) DebugMap() map[string]any
DebugMap returns a map form of HTTPServerConfig for debugging
func (*HTTPServerConfig) ToOption ¶
func (h *HTTPServerConfig) ToOption() HTTPServerConfigOption
ToOption returns a new HTTPServerConfigOption that sets the values from the passed in HTTPServerConfig
func (*HTTPServerConfig) WithOptions ¶
func (h *HTTPServerConfig) WithOptions(opts ...HTTPServerConfigOption) *HTTPServerConfig
WithOptions configures the receiver HTTPServerConfig with the passed in options set
type HTTPServerConfigOption ¶
type HTTPServerConfigOption func(h *HTTPServerConfig)
func WithHTTPAddress ¶
func WithHTTPAddress(hTTPAddress string) HTTPServerConfigOption
WithHTTPAddress returns an option that can set HTTPAddress on a HTTPServerConfig
func WithHTTPEnabled ¶
func WithHTTPEnabled(hTTPEnabled bool) HTTPServerConfigOption
WithHTTPEnabled returns an option that can set HTTPEnabled on a HTTPServerConfig
func WithHTTPTLSCertPath ¶
func WithHTTPTLSCertPath(hTTPTLSCertPath string) HTTPServerConfigOption
WithHTTPTLSCertPath returns an option that can set HTTPTLSCertPath on a HTTPServerConfig
func WithHTTPTLSKeyPath ¶
func WithHTTPTLSKeyPath(hTTPTLSKeyPath string) HTTPServerConfigOption
WithHTTPTLSKeyPath returns an option that can set HTTPTLSKeyPath on a HTTPServerConfig
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() }