server

package
v0.0.0-...-455e706 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT 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 string // 证书位置名
	KeyFile  string // 证书文件名
}

type GenericAPIServer

type GenericAPIServer struct {
	HttpsInfo *HttpsInfo // https

	HttpInfo *HttpInfo // http

	// ShutdownTimeout是用于关闭服务器的超时。这指定服务器运行之前的超时优雅地关机返回。
	ShutdownTimeout time.Duration

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

给 http和https构建好应用 返回 外部直接使用

func (GenericAPIServer) Close

func (s GenericAPIServer) Close()

close

func (*GenericAPIServer) InstallAPIs

func (s *GenericAPIServer) InstallAPIs()

健康检查API gin.

func (*GenericAPIServer) InstallMiddlewares

func (s *GenericAPIServer) InstallMiddlewares()

加载需要加载的中间件

func (*GenericAPIServer) Run

func (s *GenericAPIServer) Run() error

根据 http 和 https 参数 进行构建运行服务 后

func (*GenericAPIServer) Setup

func (s *GenericAPIServer) Setup()

加载gin相关内容 安装程序

type HttpInfo

type HttpInfo struct {
	Addr string
	Port int
}

func (*HttpInfo) Address

func (s *HttpInfo) Address() string

type HttpsInfo

type HttpsInfo struct {
	Addr string
	Port int
	CertKey
}

func (*HttpsInfo) Address

func (s *HttpsInfo) Address() string

构建 "0.0.0.0:8080/443"

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
}

type ServerConfig

type ServerConfig struct {
	HttpsInfo       *HttpsInfo
	HttpInfo        *HttpInfo
	Jwt             *JwtInfo
	Mode            string // gin.Mode
	Middlewares     []string
	Healthz         bool
	EnableProfiling bool
	EnableMetrics   bool
}

Config是用于配置GenericAPIServer的结构。

func NewServerConfig

func NewServerConfig() *ServerConfig

func (*ServerConfig) NewAndInitApiServer

func (c *ServerConfig) NewAndInitApiServer() *GenericAPIServer

根据配置进行应用

Jump to

Keyboard shortcuts

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