servicetoolset

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 28 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenClientTLSConfig

func GenClientTLSConfig(cfg *GRPCTlsConfig) (tlsConfig *tls.Config, err error)

func GenServerTLSConfig

func GenServerTLSConfig(cfg *GRPCTlsConfig) (tlsConfig *tls.Config, err error)

func NewGRPCWebHandler

func NewGRPCWebHandler(parameters GRPCWebHandlerInputParameters) (http.Handler, error)

func SignalContext

func SignalContext(ctx context.Context, logger l.Wrapper) context.Context

Types

type AbstractServer

type AbstractServer interface {
	Run(ctx context.Context) error
}

type BeforeServerStart

type BeforeServerStart func(server *grpc.Server) error

type DiscoveryExConfig

type DiscoveryExConfig struct {
	Setter          discovery.Setter  `json:"-" yaml:"-" ignored:"true"`
	ExternalAddress string            `yaml:"external_address" json:"external_address"`
	Meta            map[string]string `yaml:"meta" json:"meta"`
}

type GRPCServer

type GRPCServer interface {
	Start(init BeforeServerStart) (err error)
	Wait()
	Stop()
	StopAndWait()

	Run(ctx context.Context) (err error)
}

func NewGRPCServer

func NewGRPCServer(routineMan routineman.RoutineMan, cfg *GRPCServerConfig, opts []grpc.ServerOption, defInit BeforeServerStart,
	logger l.Wrapper, extraInterceptors ...interface{}) (GRPCServer, error)

type GRPCServerConfig

type GRPCServerConfig struct {
	Address    string         `yaml:"address" json:"address"`
	TLSConfig  *GRPCTlsConfig `yaml:"tls_config" json:"tls_config"`
	WebAddress string         `yaml:"web_address" json:"web_address"`

	Name              string             `yaml:"name" json:"name"`
	MetaTransKeys     []string           `yaml:"meta_trans_keys" json:"meta_trans_keys"`
	DiscoveryExConfig *DiscoveryExConfig `yaml:"discovery_ex_config" json:"discovery_ex_config"`
}

type GRPCTlsConfig

type GRPCTlsConfig struct {
	RootCAs    [][]byte `yaml:"RootCAs" json:"root_cas" `
	Cert       []byte   `yaml:"Cert" json:"cert"`
	Key        []byte   `yaml:"Key" json:"key"`
	ServerName string   `yaml:"ServerName" json:"server_name"`
}

func GRPCTlsConfigMap

func GRPCTlsConfigMap(fileCfg *GRPCTlsFileConfig) (*GRPCTlsConfig, error)

type GRPCTlsFileConfig

type GRPCTlsFileConfig struct {
	RootCAs    []string `yaml:"RootCAs" json:"root_cas" `
	Cert       string   `yaml:"Cert" json:"cert"`
	Key        string   `yaml:"Key" json:"key"`
	ServerName string   `yaml:"ServerName" json:"server_name"`
}

type GRPCWebHandlerInputParameters

type GRPCWebHandlerInputParameters struct {
	GRPCServer          *grpc.Server
	GRPCWebUseWebsocket bool
	GRPCWebPingInterval time.Duration
}

type HTTPServer

type HTTPServer interface {
	Run(ctx context.Context) (err error)
}

func NewHTTPServer

func NewHTTPServer(address string, logger l.Wrapper, handler http.Handler) HTTPServer

type HttpServerConfig

type HttpServerConfig struct {
	Address           string            `yaml:"address" json:"address"`
	Handler           http.Handler      `json:"-" yaml:"-"`
	DiscoveryExConfig DiscoveryExConfig `yaml:"discovery_ex_config" json:"discovery_ex_config"`
}

type ServerHelper

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

func NewServerHelper

func NewServerHelper(ctx context.Context, logger l.Wrapper) *ServerHelper

func (*ServerHelper) StartServer

func (sh *ServerHelper) StartServer(s AbstractServer)

func (*ServerHelper) Wait

func (sh *ServerHelper) Wait()

type ServerToolset

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

func NewServerToolset

func NewServerToolset(ctx context.Context, logger l.Wrapper) *ServerToolset

func (*ServerToolset) CreateGRpcServer

func (st *ServerToolset) CreateGRpcServer(cfg *GRPCServerConfig, opts []grpc.ServerOption, beforeServerStart BeforeServerStart) (err error)

func (*ServerToolset) CreateHttpServer

func (st *ServerToolset) CreateHttpServer(cfg *HttpServerConfig) error

func (*ServerToolset) Start

func (st *ServerToolset) Start() error

func (*ServerToolset) Wait

func (st *ServerToolset) Wait()

Jump to

Keyboard shortcuts

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