Documentation ¶
Overview ¶
Package servers provides implementation of Go API for managing server flow
Package server provides implementation of Go API for managing server flow
Index ¶
- Variables
- type Option
- func WithDisableRestart() Option
- func WithEnableRestart() Option
- func WithErrorGroup(eg errgroup.Group) Option
- func WithGRPCConnectionTimeout(to string) Option
- func WithGRPCHeaderTableSize(size int) Option
- func WithGRPCInitialConnWindowSize(size int) Option
- func WithGRPCInitialWindowSize(size int) Option
- func WithGRPCInterceptors(name ...string) Option
- func WithGRPCKeepaliveMaxConnAge(max string) Option
- func WithGRPCKeepaliveMaxConnAgeGrace(max string) Option
- func WithGRPCKeepaliveMaxConnIdle(max string) Option
- func WithGRPCKeepaliveTime(dur string) Option
- func WithGRPCKeepaliveTimeout(dur string) Option
- func WithGRPCMaxHeaderListSize(size int) Option
- func WithGRPCMaxReceiveMessageSize(size int) Option
- func WithGRPCMaxSendMessageSize(size int) Option
- func WithGRPCOption(opts ...grpc.ServerOption) Option
- func WithGRPCReadBufferSize(size int) Option
- func WithGRPCRegistFunc(f func(*grpc.Server)) Option
- func WithGRPCServer(srv *grpc.Server) Option
- func WithGRPCWriteBufferSize(size int) Option
- func WithHTTPHandler(h http.Handler) Option
- func WithHTTPServer(srv *http.Server) Option
- func WithHost(host string) Option
- func WithIdleTimeout(dur string) Option
- func WithListenConfig(lc *net.ListenConfig) Option
- func WithName(name string) Option
- func WithPort(port uint) Option
- func WithPreStartFunc(f func() error) Option
- func WithPreStopFunction(f func() error) Option
- func WithProbeWaitTime(dur string) Option
- func WithReadHeaderTimeout(dur string) Option
- func WithReadTimeout(dur string) Option
- func WithServerMode(m ServerMode) Option
- func WithShutdownDuration(dur string) Option
- func WithTLSConfig(cfg *tls.Config) Option
- func WithWriteTimeout(dur string) Option
- type Server
- type ServerMode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HealthServerOpts = func(name, host, path string, port uint) []Option { return []Option{ WithName(name), WithErrorGroup(errgroup.Get()), WithHTTPHandler(func() http.Handler { mux := http.NewServeMux() mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodGet { w.Header().Set(rest.ContentType, rest.TextPlain+";"+rest.CharsetUTF8) w.WriteHeader(http.StatusOK) _, err := fmt.Fprint(w, http.StatusText(http.StatusOK)) if err != nil { log.Error(err, info.Get()) } } }) return mux }()), WithHost(host), WithIdleTimeout("3s"), WithPort(port), WithProbeWaitTime("2s"), WithReadHeaderTimeout("3s"), WithReadTimeout("2s"), WithServerMode(REST), WithShutdownDuration("4s"), WithWriteTimeout("3s"), } } )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*server)
func WithDisableRestart ¶
func WithDisableRestart() Option
func WithEnableRestart ¶
func WithEnableRestart() Option
func WithErrorGroup ¶
func WithGRPCHeaderTableSize ¶
func WithGRPCInterceptors ¶
func WithGRPCKeepaliveTime ¶
func WithGRPCOption ¶
func WithGRPCOption(opts ...grpc.ServerOption) Option
func WithGRPCReadBufferSize ¶
func WithGRPCRegistFunc ¶
func WithGRPCServer ¶
func WithGRPCWriteBufferSize ¶
func WithHTTPHandler ¶
func WithHTTPServer ¶
func WithIdleTimeout ¶
func WithListenConfig ¶
func WithListenConfig(lc *net.ListenConfig) Option
func WithPreStartFunc ¶
func WithPreStopFunction ¶
func WithProbeWaitTime ¶
func WithReadHeaderTimeout ¶
func WithReadTimeout ¶
func WithServerMode ¶
func WithServerMode(m ServerMode) Option
func WithShutdownDuration ¶
func WithTLSConfig ¶
func WithWriteTimeout ¶
type Server ¶
type ServerMode ¶ added in v0.0.44
type ServerMode uint8
const ( REST ServerMode = 1 + iota GRPC GQL )
func Mode ¶
func Mode(m string) ServerMode
func (ServerMode) String ¶ added in v0.0.44
func (m ServerMode) String() string
Click to show internal directories.
Click to hide internal directories.