servers

package
v0.0.0-...-26754de Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(logger *zap.Logger) func(http.Handler) http.Handler

Types

type GRPCServer

type GRPCServer struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

func NewGRPCServer

func NewGRPCServer(cfg GRPCServerConfig, logger *zap.Logger, opts ...GRPCServerOption) *GRPCServer

func (*GRPCServer) ForcefullyStop

func (s *GRPCServer) ForcefullyStop() error

func (*GRPCServer) GracefullyStop

func (s *GRPCServer) GracefullyStop() error

func (*GRPCServer) Run

func (s *GRPCServer) Run() error

type GRPCServerConfig

type GRPCServerConfig struct {
	Port             int64 `yaml:"port"`
	EnableRecover    bool  `yaml:"enable_recover"` // TODO write recover and tls
	EnableReflection bool  `yaml:"enable_reflection"`
}

func (*GRPCServerConfig) Validate

func (c *GRPCServerConfig) Validate() error

type GRPCServerOption

type GRPCServerOption func(serverOptions *grpcServerOptions)

func GRPCWithServerName

func GRPCWithServerName(serverName string) GRPCServerOption

func GRPCWithServerOptions

func GRPCWithServerOptions(opts ...grpc.ServerOption) GRPCServerOption

func GRPCWithStreamInterceptors

func GRPCWithStreamInterceptors(ins ...grpc.StreamServerInterceptor) GRPCServerOption

func GRPCWithUnaryInterceptors

func GRPCWithUnaryInterceptors(ins ...grpc.UnaryServerInterceptor) GRPCServerOption

type HTTPServerOption

type HTTPServerOption func(*httpServerOption)

func WithAdminServer

func WithAdminServer(cfg ServerConfig) HTTPServerOption

func WithPublicServer

func WithPublicServer(cfg ServerConfig, mux *chi.Mux) HTTPServerOption

type HTTPServerWrapper

type HTTPServerWrapper struct {
	// contains filtered or unexported fields
}

func NewHTTPServerWrapper

func NewHTTPServerWrapper(logger *zap.Logger, opts ...HTTPServerOption) *HTTPServerWrapper

func (*HTTPServerWrapper) GracefulStop

func (h *HTTPServerWrapper) GracefulStop() []func() error

func (*HTTPServerWrapper) Run

func (h *HTTPServerWrapper) Run() []func() error

type ServerConfig

type ServerConfig struct {
	Enable       bool   `yaml:"enable"`
	Endpoint     string `yaml:"endpoint"`
	Port         int    `yaml:"port" env:"PORT"`
	JwtTokenSalt string `yaml:"jwt_token_salt" env:"JWT_TOKEN_SALT"`
}

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

type ServerOption

type ServerOption struct {
	Port int
	Mux  *chi.Mux
}

Jump to

Keyboard shortcuts

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