server

package
v0.0.0-...-772bc38 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MulanPSL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertKey

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

CertKey contains configuration items related to certificate.

type CompletedConfig

type CompletedConfig struct {
	*Config
}

CompletedConfig is the completed configuration for GenericAPIServer.

func (CompletedConfig) New

New returns a new instance of GenericAPIServer from the given config.

type Config

type Config struct {
	SecureServing   *SecureServingInfo
	InsecureServing *InsecureServingInfo
	Jwt             *JwtInfo
	Mode            string
	Middlewares     []string
	Healthz         bool
	EnableProfiling bool
	EnableMetrics   bool
}

Config is a structure used to configure a GenericAPIServer. Its members are sorted roughly in order of importance for composers.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.

type GenericAPIServer

type GenericAPIServer struct {

	// SecureServingInfo holds configuration of the TLS server.
	SecureServingInfo *SecureServingInfo

	// InsecureServingInfo holds configuration of the insecure HTTP server.
	InsecureServingInfo *InsecureServingInfo

	// ShutdownTimeout is the timeout used for server shutdown. This specifies the timeout before server
	// gracefully shutdown returns.
	ShutdownTimeout time.Duration

	*gin.Engine
	// contains filtered or unexported fields
}

GenericAPIServer contains state for an iam api server. type GenericAPIServer gin.Engine.

func (*GenericAPIServer) Close

func (s *GenericAPIServer) Close()

Close graceful shutdown the api server.

func (*GenericAPIServer) InstallAPIs

func (s *GenericAPIServer) InstallAPIs()

InstallAPIs install generic apis.

func (*GenericAPIServer) InstallMiddlewares

func (s *GenericAPIServer) InstallMiddlewares()

InstallMiddlewares install generic middlewares.

func (*GenericAPIServer) Run

func (s *GenericAPIServer) Run() error

Run spawns the http server. It only returns when the port cannot be listened on initially.

func (*GenericAPIServer) Setup

func (s *GenericAPIServer) Setup()

Setup do some setup work for gin engine.

type InsecureServingInfo

type InsecureServingInfo struct {
	Address string
}

InsecureServingInfo holds configuration of the insecure http server.

type JwtInfo

type JwtInfo struct {
	// defaults to "iam jwt"
	Realm string
	// defaults to empty
	Key string
	// defaults to one hour
	Timeout time.Duration
	// defaults to zero
	MaxRefresh time.Duration
}

JwtInfo defines jwt fields used to create jwt authentication middleware.

type SecureServingInfo

type SecureServingInfo struct {
	BindAddress string
	BindPort    int
	CertKey     CertKey
}

SecureServingInfo holds configuration of the TLS server.

func (*SecureServingInfo) Address

func (s *SecureServingInfo) Address() string

Address join host IP address and host port number into a address string, like: 0.0.0.0:8443.

Jump to

Keyboard shortcuts

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