options

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateListener

func CreateListener(addr string) (net.Listener, int, error)

CreateListener create net listener by given address and returns it and port.

Types

type CertKey

type CertKey struct {
	// CertFile is a file containing a PEM-encoded certificate, and possibly the complete certificate chain
	CertFile string `json:"cert-file"        mapstructure:"cert-file"`
	// KeyFile is a file containing a PEM-encoded private key for the certificate specified by CertFile
	KeyFile string `json:"private-key-file" mapstructure:"private-key-file"`
}

CertKey contains configuration items related to certificate.

type GRPCServerOptions

type GRPCServerOptions struct {
	ChunkSize             int `json:"chunksize"               mapstructure:"chunksize"`
	ReceiveTimeoutMinutes int `json:"receive-timeout-minutes"                          mapstructrue:"receive-timeout-minutes"`
}

func NewGRPCServerOptions

func NewGRPCServerOptions() *GRPCServerOptions

func (*GRPCServerOptions) AddFlags

func (g *GRPCServerOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a specific gRPC Server to the specified FlagSet.

func (*GRPCServerOptions) ApplyTo

func (g *GRPCServerOptions) ApplyTo(c *server.Config) error

ApplyTo applies the run options to the method receiver and returns self.

func (*GRPCServerOptions) Validate

func (g *GRPCServerOptions) Validate() []error

Validate checks validation of GRPCServerOptions.

type GeneratableKeyCert

type GeneratableKeyCert struct {
	// CertKey allows setting an explicit cert/key file to use.
	CertKey CertKey `json:"cert-key" mapstructure:"cert-key"`

	// CertDirectory specifies a directory to write generated certificates to if CertFile/KeyFile aren't explicitly set.
	// PairName is used to determine the filenames within CertDirectory.
	// If CertDirectory and PairName are not set, an in-memory certificate will be generated.
	CertDirectory string `json:"cert-dir"  mapstructure:"cert-dir"`
	// PairName is the name which will be used with CertDirectory to make a cert and key filenames.
	// It becomes CertDirectory/PairName.crt and CertDirectory/PairName.key
	PairName string `json:"pair-name" mapstructure:"pair-name"`
}

GeneratableKeyCert contains configuration items related to certificate.

type InsecureServingOptions

type InsecureServingOptions struct {
	BindAddress string `json:"bind-address" mapstructure:"bind-address"`
	BindPort    int    `json:"bind-port"    mapstructure:"bind-port"`
}

InsecureServingOptions are for creating an unauthenticated, unauthorized, insecure port. No one should be using these anymore.

func NewInsecureServingOptions

func NewInsecureServingOptions() *InsecureServingOptions

NewInsecureServingOptions is for creating an unauthenticated, unauthorized, insecure port. No one should be using these anymore.

func (*InsecureServingOptions) AddFlags

func (s *InsecureServingOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags related to features for a specific api server to the specified FlagSet.

func (*InsecureServingOptions) ApplyTo

func (s *InsecureServingOptions) ApplyTo(c *server.Config) error

ApplyTo applies the run options to the method receiver and returns self.

func (*InsecureServingOptions) Validate

func (s *InsecureServingOptions) Validate() []error

Validate is used to parse and validate the parameters entered by the user at the command line when the program starts.

type LoggerOptions added in v1.0.11

type LoggerOptions struct {
	Name                  string   `json:"name"                     mapstructure:"name"`
	InfoOutputPaths       []string `json:"info-output-paths"        mapstructure:"info-output-paths"`
	ErrorOutputPaths      []string `json:"error-output-paths"       mapstructure:"error-output-paths"`
	InnerErrorOutputPaths []string `json:"inner-error-output-paths" mapstructure:"inner-error-output-paths"`
	InfoLevel             string   `json:"info-level"               mapstructure:"info-level"`
	ErrorLevel            string   `json:"error-level"              mapstucture:"error-level"`
	Format                string   `json:"format"                   mapstructure:"format"`
	DisableCaller         bool     `json:"disable-caller"           mapstructure:"disable-caller"`
	DisableStacktrace     bool     `json:"disable-stacktrace"       mapstructure:"disable-stacktrace"`
	EnableColor           bool     `json:"enable-color"             mapstructure:"enable-color"`
	Development           bool     `json:"development"              mapstructure:"development"`
}

func NewLoggerOptions added in v1.0.11

func NewLoggerOptions() *LoggerOptions

func (*LoggerOptions) AddFlags added in v1.0.11

func (o *LoggerOptions) AddFlags(fs *pflag.FlagSet)

func (*LoggerOptions) ApplyTo added in v1.0.11

func (o *LoggerOptions) ApplyTo(conf *logger.Config) error

func (*LoggerOptions) Complete added in v1.0.11

func (o *LoggerOptions) Complete() error

func (*LoggerOptions) Validate added in v1.0.11

func (o *LoggerOptions) Validate() []error

type MonitorOptions

type MonitorOptions struct {
	SyncInterval      time.Duration `json:"sync-interval"       mapstructure:"sync-interval"`
	CycleTime         time.Duration `json:"cycle-time"          mapstructure:"cycle-time"`
	FrequencyPerCycle int           `json:"frequency-per-cycle" mapstructure:"frequency-per-cycle"`
}

func NewMonitorOptions

func NewMonitorOptions() *MonitorOptions

func (*MonitorOptions) AddFlags

func (m *MonitorOptions) AddFlags(fs *pflag.FlagSet)

func (*MonitorOptions) ApplyTo

func (m *MonitorOptions) ApplyTo(c monitor.Config) error

func (*MonitorOptions) Validate

func (m *MonitorOptions) Validate() []error

type RAOptions

type RAOptions struct {
	Host string `json:"host" mapstructure:"host"`
	Port int    `json:"port" mapstructure:"port"`
}

RAOptions contains the options used to connect to the RA server.

func NewRAOptions

func NewRAOptions() *RAOptions

func (*RAOptions) AddFlags

func (ra *RAOptions) AddFlags(fs *pflag.FlagSet)

func (*RAOptions) ApplyTo

func (ra *RAOptions) ApplyTo(c *server.Config) error

func (*RAOptions) Validate

func (ra *RAOptions) Validate() []error

type SecureServingOptions

type SecureServingOptions struct {
	BindAddress string `json:"bind-address" mapstructure:"bind-address"`
	// BindPort is ignored when Listener is set, will disable even with 0.
	BindPort int `json:"bind-port"    mapstructure:"bind-port"`
	// ServerCert is the TLS cert info for serving secure traffic
	ServerCert GeneratableKeyCert `json:"tls"          mapstructure:"tls"`
}

SecureServingOptions contains configuration items related to TLS server startup.

func NewSecureServingOptions

func NewSecureServingOptions() *SecureServingOptions

NewSecureServingOptions creates a SecureServingOptions object with default parameters.

func (*SecureServingOptions) AddFlags

func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags related to TLS server for a specific APIServer to the specified FlagSet.

func (*SecureServingOptions) ApplyTo

func (s *SecureServingOptions) ApplyTo(c *server.Config) error

ApplyTo applies the run options to the method receiver and returns self.

func (*SecureServingOptions) Complete

func (s *SecureServingOptions) Complete() error

Complete fills in any fields not set that are required to have valid data.

func (*SecureServingOptions) Validate

func (s *SecureServingOptions) Validate() []error

Validate is used to parse and validate the parameters entered by the user at the command line when the program starts.

type ServerRunOptions

type ServerRunOptions struct {
	Healthz     bool     `json:"healthz"     mapstructure:"healthz"`
	Middlewares []string `json:"middlewares" mapstructure:"middlewares"`
}

ServerRunOptions contains the options while running a generic api server.

func NewServerRunOptions

func NewServerRunOptions() *ServerRunOptions

NewServerRunOptions creates a new ServerRunOptions object with default parameters.

func (*ServerRunOptions) AddFlags

func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a specific APIServer to the specified FlagSet.

func (*ServerRunOptions) ApplyTo

func (s *ServerRunOptions) ApplyTo(c *server.Config) error

ApplyTo applies the run options to the method receiver and returns self.

func (*ServerRunOptions) Validate

func (s *ServerRunOptions) Validate() []error

Validate checks validation of ServerRunOptions.

type WebServerConfigOptions

type WebServerConfigOptions struct {
	ServerName               string `json:"server-name"      mapstructure:"server-name"`
	ServerType               string `json:"server-type"      mapstructure:"server-type"`
	ConfigPath               string `json:"config-path"      mapstructure:"config-path"`
	VerifyExecPath           string `json:"verify-exec-path" mapstructure:"verify-exec-path"`
	LogsDirPath              string `json:"logs-dir-path"    mapstructure:"logs-dir-path"`
	BackupDir                string `json:"backup-dir"       mapstructure:"backup-dir"`
	BackupCycle              int    `json:"backup-cycle"     mapstructure:"backup-cycle"`
	BackupsRetentionDuration int    `json:"backups-retention-duration" mapstructure:"backups-retention-duration"`
}

func NewWebServerConfigOptions

func NewWebServerConfigOptions() *WebServerConfigOptions

func (*WebServerConfigOptions) AddFlags

func (c *WebServerConfigOptions) AddFlags(fs *pflag.FlagSet)

func (*WebServerConfigOptions) ApplyToNginx added in v1.0.11

func (c *WebServerConfigOptions) ApplyToNginx(config *nginx.Config)

func (*WebServerConfigOptions) Validate

func (c *WebServerConfigOptions) Validate() []error

type WebServerConfigsOptions

type WebServerConfigsOptions struct {
	WebServerConfigs []*WebServerConfigOptions `json:"items" mapstructure:"items"`
}

func NewWebServerConfigsOptions

func NewWebServerConfigsOptions() *WebServerConfigsOptions

func (*WebServerConfigsOptions) Validate

func (cs *WebServerConfigsOptions) Validate() []error

type WebServerLogWatcherOptions

type WebServerLogWatcherOptions struct {
	MaxConnections int           `json:"max-connections" mapstructure:"max-connections"`
	WatchTimeout   time.Duration `json:"watch-timeout"   mapstructure:"watch-timeout"`
}

func NewWebServerLogWatcherOptions

func NewWebServerLogWatcherOptions() *WebServerLogWatcherOptions

func (*WebServerLogWatcherOptions) AddFlags

func (w *WebServerLogWatcherOptions) AddFlags(fs *pflag.FlagSet)

func (*WebServerLogWatcherOptions) ApplyTo

func (*WebServerLogWatcherOptions) Validate

func (w *WebServerLogWatcherOptions) Validate() []error

Jump to

Keyboard shortcuts

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