Documentation
¶
Index ¶
- Constants
- Variables
- func AddCustomTypeFuncs(customTypeFuncs []CustomTypeFunc) error
- func AddCustomValidators(customValidators []CustomValidator) error
- func AddProfilingEndpoints(r *gin.Engine)
- func AddStructValidators(structValidators []StructValidator) error
- func AddValidateAlias(aliases []ValidateAlias) error
- func Cors(config cfg.Config) (gin.HandlerFunc, error)
- func CreateDownloadHandler(handler HandlerWithStream) gin.HandlerFunc
- func CreateHandler(handler HandlerWithoutInput) gin.HandlerFunc
- func CreateJsonHandler(handler HandlerWithInput) gin.HandlerFunc
- func CreateMultiPartFormHandler(handler HandlerWithInput) gin.HandlerFunc
- func CreateMultipleBindingsHandler(handler HandlerWithMultipleBindings) gin.HandlerFunc
- func CreateProtobufHandler(handler HandlerWithInput) gin.HandlerFunc
- func CreateQueryHandler(handler HandlerWithInput) gin.HandlerFunc
- func CreateRawHandler(handler HandlerWithoutInput) gin.HandlerFunc
- func CreateReaderHandler(handler HandlerWithoutInput) gin.HandlerFunc
- func CreateSseHandler(handler HandlerWithStream) gin.HandlerFunc
- func CreateStaticHandler(files embed.FS, dir string, excludes ...string) (func(c *gin.Context), error)
- func CreateStreamHandler(handler HandlerWithStream) gin.HandlerFunc
- func CreateUriHandler(handler HandlerWithInput) gin.HandlerFunc
- func GetStringFromRequest(request *Request, name string) (*string, bool)
- func GetUintFromRequest(request *Request, name string) (*uint, bool)
- func HttpTest[Body HttpBody](method, path, requestPath string, body Body, handler gin.HandlerFunc, ...) *httptest.ResponseRecorder
- func HttpserverSettingsKey(name string) string
- func LoggingMiddleware(logger log.Logger, settings LoggingSettings) gin.HandlerFunc
- func New(name string, definer Definer) kernel.ModuleFactory
- func NewConnectionLifeCycleInterceptor(connectionLifeCycleAdvisor ConnectionLifeCycleAdvisor) gin.HandlerFunc
- func NewCountingBodyReader(reader io.ReadCloser) (io.ReadCloser, *int)
- func NewCountingBodyWriter(writer gin.ResponseWriter) (gin.ResponseWriter, *int)
- func NewGZipBodyReader(body io.ReadCloser) (io.ReadCloser, *int, error)
- func NewHealthCheck() kernel.ModuleFactory
- func NewLoggingMiddlewareWithInterfaces(logger log.Logger, settings LoggingSettings, clock clock.Clock) gin.HandlerFunc
- func NewMetricMiddleware(name string) (middleware gin.HandlerFunc, setupHandler func(definitions []Definition))
- func NewRequestsPerRunnerHandlerWithInterfaces(clock clock.Clock, cwClient gosoCloudwatch.Client, ...) calculator.Handler
- func NewWithSettings(ctx context.Context, name string, definer Definer, settings *Settings) kernel.ModuleFactory
- func ProfilingModuleFactory(_ context.Context, config cfg.Config, _ log.Logger) (map[string]kernel.ModuleFactory, error)
- func ProvideConnectionLifeCycleInterceptor(ctx context.Context, config cfg.Config, logger log.Logger, serverName string) (gin.HandlerFunc, error)
- func RecoveryWithSentry(logger log.Logger) gin.HandlerFunc
- func RequestsPerRunnerHandlerFactory(ctx context.Context, config cfg.Config, logger log.Logger, ...) (calculator.Handler, error)
- func SamplingMiddleware(ctx context.Context, config cfg.Config, logger log.Logger) (gin.HandlerFunc, error)
- func WithCustomModifier(modifier Modifier)
- func WithErrorHandler(handler ErrorHandler)
- type CompressionExcludeSettings
- type CompressionSettings
- type ConnectionLifeCycleAdvisor
- func NewConnectionLifeCycleAdvisor(config cfg.Config, serverName string) (ConnectionLifeCycleAdvisor, error)
- func NewConnectionLifeCycleAdvisorWithInterfaces(providedClock clock.Clock, settings ConnectionLifeCycleAdvisorSettings) ConnectionLifeCycleAdvisor
- func ProvideConnectionLifeCycleAdvisor(ctx context.Context, config cfg.Config, _ log.Logger, serverName string) (ConnectionLifeCycleAdvisor, error)
- type ConnectionLifeCycleAdvisorSettings
- type CustomTypeFunc
- type CustomValidator
- type Definer
- type Definition
- type Definitions
- func (d *Definitions) DELETE(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) GET(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) Group(relativePath string) *Definitions
- func (d *Definitions) Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) OPTIONS(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) PATCH(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) POST(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) PUT(relativePath string, handlers ...gin.HandlerFunc)
- func (d *Definitions) Use(middleware ...gin.HandlerFunc)
- type ErrorHandler
- type HandlerMetadata
- type HandlerWithInput
- type HandlerWithMultipleBindings
- type HandlerWithStream
- type HandlerWithoutInput
- type HealthCheckSettings
- type HttpBody
- type HttpServer
- type HttpServerHealthCheck
- type LoggingSettings
- type Modifier
- type Profiling
- type ProfilingApiSettings
- type ProfilingSettings
- type ProtobufDecodable
- type ProtobufEncodable
- type Request
- type Response
- func NewHtmlResponse(body any, options ...ResponseOption) *Response
- func NewJsonResponse(body any, options ...ResponseOption) *Response
- func NewProtobufResponse(body ProtobufEncodable, options ...ResponseOption) (*Response, error)
- func NewRedirectResponse(url string, options ...ResponseOption) *Response
- func NewResponse(body any, contentType string, statusCode int, header http.Header, ...) *Response
- func NewStatusResponse(statusCode int, options ...ResponseOption) *Response
- type ResponseBodyWriterError
- type ResponseOption
- type RouterSettings
- type ServerMetadata
- type Settings
- type StructValidator
- type TimeoutSettings
- type ValidateAlias
Constants ¶
const ( ApiViewKey = "X-Api-View" ContentTypeText = "text/plain; charset=utf-8" ContentTypeHtml = "text/html; charset=utf-8" ContentTypeJson = "application/json; charset=utf-8" ContentTypeProtobuf = "application/x-protobuf" HttpStatusClientWentAway = 499 )
const ( MetricHttpRequestCount = "HttpRequestCount" MetricHttpRequestCountPerRoute = "HttpRequestCountPerRoute" MetricHttpRequestResponseTime = "HttpRequestResponseTime" MetricHttpStatus = "HttpStatus" )
const ( BaseProfiling = "/debug/profiling" CmdLine = "/cmdline" Profile = "/profile" Symbol = "/symbol" Trace = "/trace" Allocs = "/allocs" Block = "/block" GoRoutine = "/goroutine" Heap = "/heap" Mutex = "/mutex" ThreadCreate = "/threadcreate" )
const PerRunnerMetricName = "HttpServerRequests"
Variables ¶
var ErrAccessForbidden = errors.New("cant access resource")
Functions ¶
func AddCustomTypeFuncs ¶
func AddCustomTypeFuncs(customTypeFuncs []CustomTypeFunc) error
func AddCustomValidators ¶
func AddCustomValidators(customValidators []CustomValidator) error
func AddProfilingEndpoints ¶
func AddStructValidators ¶
func AddStructValidators(structValidators []StructValidator) error
func AddValidateAlias ¶
func AddValidateAlias(aliases []ValidateAlias) error
func CreateDownloadHandler ¶
func CreateDownloadHandler(handler HandlerWithStream) gin.HandlerFunc
CreateDownloadHandler creates a gin.HandlerFunc that handles the stream request and uses the query parameters as input binding Example input struct from handler.GetInput():
type example struct{
A string `query:"a" binding:"required"`
}
func CreateHandler ¶
func CreateHandler(handler HandlerWithoutInput) gin.HandlerFunc
CreateHandler creates a gin.HandlerFunc that handles the request without data binding and without passing the body to the handler
func CreateJsonHandler ¶
func CreateJsonHandler(handler HandlerWithInput) gin.HandlerFunc
CreateJsonHandler creates a gin.HandlerFunc that handles the request with json binding Example input struct from handler.GetInput():
type example struct{
A string `json:"a" binding:"required"`
}
func CreateMultiPartFormHandler ¶
func CreateMultiPartFormHandler(handler HandlerWithInput) gin.HandlerFunc
CreateMultiPartFormHandler creates a gin.HandlerFunc that handles the request with Form multipart data binding Example input struct from handler.GetInput():
type example struct{
File *multipart.FileHeader `form:"file" binding:"required"`
}
func CreateMultipleBindingsHandler ¶
func CreateMultipleBindingsHandler(handler HandlerWithMultipleBindings) gin.HandlerFunc
CreateMultipleBindingsHandler creates a gin.HandlerFunc that handles the request with the bindings the input struct specifies Example input struct from handler.GetInput():
type example struct{
A string `json:"a" binding:"required"`
B string `form:"b" binding:"required"`
}
func CreateProtobufHandler ¶ added in v0.16.0
func CreateProtobufHandler(handler HandlerWithInput) gin.HandlerFunc
CreateProtobufHandler creates a gin.HandlerFunc that handles the request with protobuf binding Example input struct from handler.GetInput():
type example struct{ // <- this struct must implement ProtobufDecodable
A string `json:"a" binding:"required"`
}
func CreateQueryHandler ¶
func CreateQueryHandler(handler HandlerWithInput) gin.HandlerFunc
CreateQueryHandler creates a gin.HandlerFunc that handles the request and uses the query parameters as input binding Example input struct from handler.GetInput():
type example struct{
A string `form:"a" binding:"required"`
}
func CreateRawHandler ¶
func CreateRawHandler(handler HandlerWithoutInput) gin.HandlerFunc
CreateRawHandler creates a gin.HandlerFunc that handles the request without input binding and passes the body to the handler as []byte
func CreateReaderHandler ¶
func CreateReaderHandler(handler HandlerWithoutInput) gin.HandlerFunc
CreateReaderHandler creates a gin.HandlerFunc that handles the request without input binding and passes the body to the handler as io.ReadCloser
func CreateSseHandler ¶
func CreateSseHandler(handler HandlerWithStream) gin.HandlerFunc
CreateSseHandler creates a gin.HandlerFunc that handles the stream request and uses the query parameters as input binding Example input struct from handler.GetInput():
type example struct{
A string `query:"a" binding:"required"`
}
func CreateStaticHandler ¶ added in v0.38.3
func CreateStreamHandler ¶
func CreateStreamHandler(handler HandlerWithStream) gin.HandlerFunc
CreateStreamHandler creates a gin.HandlerFunc that handles the stream request and uses the json body as input binding Example input struct from handler.GetInput():
type example struct{
A string `json:"a" binding:"required"`
}
func CreateUriHandler ¶ added in v0.18.4
func CreateUriHandler(handler HandlerWithInput) gin.HandlerFunc
CreateUriHandler creates a gin.HandlerFunc that handles the request and uses the uri parameters as input binding Example input struct from handler.GetInput():
type example struct{
A string `uri:"a" binding:"required"`
}
func GetStringFromRequest ¶
func HttpTest ¶
func HttpTest[Body HttpBody](method, path, requestPath string, body Body, handler gin.HandlerFunc, requestOptions ...func(r *http.Request)) *httptest.ResponseRecorder
func HttpserverSettingsKey ¶ added in v0.44.0
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger, settings LoggingSettings) gin.HandlerFunc
func NewConnectionLifeCycleInterceptor ¶ added in v0.44.0
func NewConnectionLifeCycleInterceptor(connectionLifeCycleAdvisor ConnectionLifeCycleAdvisor) gin.HandlerFunc
NewConnectionLifeCycleInterceptor creates a gin.HandlerFunc that uses the ConnectionLifeCycleAdvisor to determine whether the connection to the remote address should be closed.
func NewCountingBodyReader ¶
func NewCountingBodyReader(reader io.ReadCloser) (io.ReadCloser, *int)
func NewCountingBodyWriter ¶
func NewCountingBodyWriter(writer gin.ResponseWriter) (gin.ResponseWriter, *int)
func NewGZipBodyReader ¶
func NewGZipBodyReader(body io.ReadCloser) (io.ReadCloser, *int, error)
func NewHealthCheck ¶
func NewHealthCheck() kernel.ModuleFactory
func NewLoggingMiddlewareWithInterfaces ¶ added in v0.34.0
func NewLoggingMiddlewareWithInterfaces(logger log.Logger, settings LoggingSettings, clock clock.Clock) gin.HandlerFunc
func NewMetricMiddleware ¶
func NewMetricMiddleware(name string) (middleware gin.HandlerFunc, setupHandler func(definitions []Definition))
func NewRequestsPerRunnerHandlerWithInterfaces ¶ added in v0.22.0
func NewRequestsPerRunnerHandlerWithInterfaces( clock clock.Clock, cwClient gosoCloudwatch.Client, baseHandler calculator.PerRunnerMetricHandler, calculatorSettings *calculator.CalculatorSettings, handlerSettings *calculator.PerRunnerMetricSettings, serverNames []string, ) calculator.Handler
func NewWithSettings ¶
func ProfilingModuleFactory ¶ added in v0.19.0
func ProvideConnectionLifeCycleInterceptor ¶ added in v0.44.0
func ProvideConnectionLifeCycleInterceptor(ctx context.Context, config cfg.Config, logger log.Logger, serverName string) (gin.HandlerFunc, error)
ProvideConnectionLifeCycleInterceptor provides a ConnectionLifeCycleAdvisorInterceptor that controls closing of connections based on the ConnectionLifeCycleAdvisor.
func RecoveryWithSentry ¶
func RecoveryWithSentry(logger log.Logger) gin.HandlerFunc
func RequestsPerRunnerHandlerFactory ¶ added in v0.22.0
func RequestsPerRunnerHandlerFactory(ctx context.Context, config cfg.Config, logger log.Logger, calculatorSettings *calculator.CalculatorSettings) (calculator.Handler, error)
func SamplingMiddleware ¶ added in v0.54.4
func WithCustomModifier ¶
func WithCustomModifier(modifier Modifier)
func WithErrorHandler ¶
func WithErrorHandler(handler ErrorHandler)
Types ¶
type CompressionExcludeSettings ¶
type CompressionExcludeSettings struct {
Extension []string `cfg:"extension"`
Path []string `cfg:"path"`
PathRegex []string `cfg:"path_regex"`
}
CompressionExcludeSettings allow enabling of gzip support.
type CompressionSettings ¶
type CompressionSettings struct {
Level string `cfg:"level" default:"default" validate:"oneof=none default best fast 0 1 2 3 4 5 6 7 8 9"`
Decompression bool `cfg:"decompression" default:"true"`
// Exclude files by path, extension, or regular expression from being considered for compression.
// Useful if you are serving a format unknown to Gosoline.
Exclude CompressionExcludeSettings `cfg:"exclude"`
}
CompressionSettings control gzip support for requests and responses. By default, compressed requests are accepted and compressed responses are returned (if accepted by the client).
type ConnectionLifeCycleAdvisor ¶ added in v0.44.0
type ConnectionLifeCycleAdvisor interface {
// ShouldCloseConnection checks whether the connection to the remote address should be closed.
ShouldCloseConnection(remoteAddr string, headers http.Header) bool
}
func NewConnectionLifeCycleAdvisor ¶ added in v0.44.0
func NewConnectionLifeCycleAdvisor(config cfg.Config, serverName string) (ConnectionLifeCycleAdvisor, error)
func NewConnectionLifeCycleAdvisorWithInterfaces ¶ added in v0.44.0
func NewConnectionLifeCycleAdvisorWithInterfaces( providedClock clock.Clock, settings ConnectionLifeCycleAdvisorSettings, ) ConnectionLifeCycleAdvisor
func ProvideConnectionLifeCycleAdvisor ¶ added in v0.44.0
func ProvideConnectionLifeCycleAdvisor(ctx context.Context, config cfg.Config, _ log.Logger, serverName string) (ConnectionLifeCycleAdvisor, error)
ProvideConnectionLifeCycleAdvisor returns a ConnectionLifeCycleAdvisor. This is a component that tracks the lifecycle of client connections based on configurable policies. On that basis it provides recommendations on whether a connection should be closed or not. This is useful to prevent clients from keeping connections open, eg in k8s where load balancing only happens on new connections.
type ConnectionLifeCycleAdvisorSettings ¶ added in v0.44.0
type ConnectionLifeCycleAdvisorSettings struct {
Enabled bool `cfg:"enabled" default:"true"`
MaxConnectionAge time.Duration `cfg:"max_age" default:"1m"`
MaxConnectionRequestCount int `cfg:"max_request_count" default:"0"`
}
ConnectionLifeCycleAdvisorSettings configures the traffic distributor middleware controlling maximum life of client connections.
type CustomTypeFunc ¶
type CustomTypeFunc struct {
Func validator.CustomTypeFunc
Types []any
}
A CustomTypeFunc allows you to convert one type to another type before validation. This allows you to validate custom types with the built-in functions for, e.g., integers or strings.
type CustomValidator ¶
A CustomValidator allows you to validate single fields with custom rules. If you need to validate a whole struct, you need to use a StructValidator. See https://github.com/go-playground/validator/issues/470 for more details.
type Definition ¶
type Definition struct {
// contains filtered or unexported fields
}
type Definitions ¶
type Definitions struct {
// contains filtered or unexported fields
}
func (*Definitions) DELETE ¶
func (d *Definitions) DELETE(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) GET ¶
func (d *Definitions) GET(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) Group ¶
func (d *Definitions) Group(relativePath string) *Definitions
func (*Definitions) Handle ¶
func (d *Definitions) Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) OPTIONS ¶
func (d *Definitions) OPTIONS(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) PATCH ¶ added in v0.36.1
func (d *Definitions) PATCH(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) POST ¶
func (d *Definitions) POST(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) PUT ¶
func (d *Definitions) PUT(relativePath string, handlers ...gin.HandlerFunc)
func (*Definitions) Use ¶
func (d *Definitions) Use(middleware ...gin.HandlerFunc)
type ErrorHandler ¶
func GetErrorHandler ¶
func GetErrorHandler() ErrorHandler
type HandlerMetadata ¶
type HandlerMetadata struct {
// Method is the route method of this Handler.
Method string `json:"method"`
// Path is the route path ot this handler.
Path string `json:"path"`
}
HandlerMetadata stores the Path and Method of this Handler.
type HandlerWithInput ¶
type HandlerWithInput interface {
HandlerWithoutInput
GetInput() any
}
type HandlerWithMultipleBindings ¶
type HandlerWithMultipleBindings interface {
HandlerWithInput
GetBindings() []binding.Binding
}
type HandlerWithStream ¶
type HandlerWithoutInput ¶
type HealthCheckSettings ¶
type HealthCheckSettings struct {
Port int `cfg:"port" default:"8090"`
Path string `cfg:"path" default:"/health"`
Timeout TimeoutSettings `cfg:"timeout"`
}
type HttpServer ¶
type HttpServer struct {
kernel.EssentialModule
kernel.ApplicationStage
// contains filtered or unexported fields
}
func NewWithInterfaces ¶
func (*HttpServer) GetPort ¶
func (s *HttpServer) GetPort() (*int, error)
type HttpServerHealthCheck ¶ added in v0.40.11
type HttpServerHealthCheck struct {
kernel.BackgroundModule
kernel.EssentialStage
// contains filtered or unexported fields
}
func NewHealthCheckWithInterfaces ¶
func NewHealthCheckWithInterfaces(logger log.Logger, router *gin.Engine, healthChecker kernel.HealthChecker, settings *HealthCheckSettings) *HttpServerHealthCheck
type LoggingSettings ¶
type Profiling ¶
type Profiling struct {
kernel.BackgroundModule
kernel.ApplicationStage
// contains filtered or unexported fields
}
type ProfilingApiSettings ¶ added in v0.19.0
type ProfilingApiSettings struct {
Port int `cfg:"port" default:"8091"`
}
type ProfilingSettings ¶
type ProfilingSettings struct {
Enabled bool `cfg:"enabled" default:"false"`
Api ProfilingApiSettings `cfg:"api"`
}
type ProtobufDecodable ¶ added in v0.16.0
type ProtobufDecodable interface {
// EmptyMessage should provide an empty instance of the message format to decode from.
EmptyMessage() proto.Message
// FromMessage should extract the data from the message and write it to the receiver.
FromMessage(message proto.Message) error
}
ProtobufDecodable allows CreateProtobufHandler to decode the request body via protobuf.
type ProtobufEncodable ¶ added in v0.16.0
type ProtobufEncodable interface {
// ToMessage turns the response value into a protobuf message representation
ToMessage() (proto.Message, error)
}
ProtobufEncodable is required for NewProtobufResponse to create the protobuf response.
type Response ¶
type Response struct {
Body any
ContentType *string // might be nil
Header http.Header
StatusCode int
}
Don't create a response directly, use New*Response instead
func NewHtmlResponse ¶
func NewHtmlResponse(body any, options ...ResponseOption) *Response
func NewJsonResponse ¶
func NewJsonResponse(body any, options ...ResponseOption) *Response
func NewProtobufResponse ¶ added in v0.16.0
func NewProtobufResponse(body ProtobufEncodable, options ...ResponseOption) (*Response, error)
func NewRedirectResponse ¶
func NewRedirectResponse(url string, options ...ResponseOption) *Response
func NewResponse ¶
func NewStatusResponse ¶
func NewStatusResponse(statusCode int, options ...ResponseOption) *Response
func (*Response) WithContentType ¶
type ResponseBodyWriterError ¶
type ResponseBodyWriterError struct {
Err error
}
func (ResponseBodyWriterError) Error ¶
func (e ResponseBodyWriterError) Error() string
func (ResponseBodyWriterError) Is ¶
func (e ResponseBodyWriterError) Is(err error) bool
func (ResponseBodyWriterError) Unwrap ¶
func (e ResponseBodyWriterError) Unwrap() error
type ResponseOption ¶ added in v0.36.1
type ResponseOption func(resp *Response)
func WithStatusCode ¶ added in v0.36.1
func WithStatusCode(statusCode int) ResponseOption
type RouterSettings ¶ added in v0.47.0
type RouterSettings struct {
UseRawPath bool `cfg:"use_raw_path" default:"false"`
}
type ServerMetadata ¶
type ServerMetadata struct {
Name string `json:"name"`
Handlers []HandlerMetadata `json:"handlers"`
}
type Settings ¶
type Settings struct {
// Port the API listens to.
Port string `cfg:"port" default:"8080"`
// Mode is either debug, release, test.
Mode string `cfg:"mode" default:"release" validate:"oneof=release debug test"`
// Compression settings.
Compression CompressionSettings `cfg:"compression"`
// Gin Router settings.
Router RouterSettings `cfg:"router"`
// Timeout settings.
Timeout TimeoutSettings `cfg:"timeout"`
// Logging settings
Logging LoggingSettings `cfg:"logging"`
}
Settings structure for an API server.
type StructValidator ¶
type StructValidator struct {
Struct any
Validator validator.StructLevelFunc
}
A StructValidator validates every instance of a struct type with the given validation. It is a little bit unfortunate because you now can't have different validation rules for a struct at different places.
type TimeoutSettings ¶
type TimeoutSettings struct {
// You need to give at least 1s as timeout.
// Read timeout is the maximum duration for reading the entire request, including the body.
Read time.Duration `cfg:"read" default:"60s" validate:"min=1000000000"`
// Write timeout is the maximum duration before timing out writes of the response.
Write time.Duration `cfg:"write" default:"60s" validate:"min=1000000000"`
// Idle timeout is the maximum amount of time to wait for the next request when keep-alives are enabled
Idle time.Duration `cfg:"idle" default:"60s" validate:"min=1000000000"`
// Drain timeout is the maximum amount of time to wait after receiving the kernel stop signal and actually shutting down the server
Drain time.Duration `cfg:"drain" default:"0" validate:"min=0"`
// Shutdown timeout is the maximum amount of time to wait for serving active requests before stopping the server
Shutdown time.Duration `cfg:"shutdown" default:"60s" validate:"min=1000000000"`
}
TimeoutSettings configures IO timeouts.
type ValidateAlias ¶
A ValidateAlias allows you to map one or more tags to a different name, making your validation rules easier to read.
Source Files
¶
- compression.go
- compression_io.go
- compression_logs.go
- connection_lifecycle_advisor.go
- cors.go
- custom_validators.go
- definition.go
- error.go
- handler.go
- handler_static.go
- health_check.go
- middleware_logger.go
- middleware_metric.go
- middleware_recover.go
- middleware_sampling.go
- modification.go
- param_reader.go
- profiler.go
- profiling.go
- protobuf.go
- response.go
- rpr_handler.go
- server.go
- settings.go
- test_helper.go