Documentation ¶
Index ¶
- type Config
- type Handler
- type Service
- func (srv Service) Run(ctxParent context.Context, workers ...Worker) error
- func (srv Service) ServeMux() *http.ServeMux
- func (srv *Service) Use(handler Handler) *Service
- func (srv *Service) WithListener(listener net.Listener) *Service
- func (srv *Service) WithShutdown(worker Worker) *Service
- func (srv *Service) WithStatic(fSystem fs.FS) *Service
- func (srv *Service) WithVersion(version string) *Service
- type TLSConfig
- type VersionResponseConfig
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Listen string `long:"listen" default:":8080" description:"Addr and port which server listens at"` MaxHeaderBytes int `long:"maxheader" description:"MaxHeaderBytes"` ReadTimeout time.Duration `long:"rto" default:"10s" description:"HTTP read timeout"` WriteTimeout time.Duration `long:"wto" default:"60s" description:"HTTP write timeout"` GracePeriod time.Duration `long:"grace" default:"10s" description:"Stop grace period"` IPHeader string `long:"ip_header" env:"IP_HEADER" default:"X-Real-IP" description:"HTTP Request Header for remote IP"` UserHeader string `long:"user_header" env:"USER_HEADER" default:"X-Username" description:"HTTP Request Header for username"` TLS TLSConfig `group:"HTTPS Options" namespace:"tls" env-namespace:"TLS"` Version VersionResponseConfig `group:"Version response Options" namespace:"vr"` }
Config holds all config vars.
func (Config) WithAccessLog ¶
WithAccessLog calculates estimate and prints HTTP request log.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds service attributes.
func (*Service) WithListener ¶
WithListener sets service listener.
func (*Service) WithShutdown ¶
WithShutdown registers worker for call on shutdown.
func (*Service) WithStatic ¶
WithStatic sets static filesystem for serve via http.
func (*Service) WithVersion ¶
WithVersion sets hanler returning source code version as js.
type TLSConfig ¶ added in v0.13.0
type TLSConfig struct { CertFile string `long:"cert" description:"CertFile for serving HTTPS instead HTTP" env:"CERT" ` KeyFile string `long:"key" description:"KeyFile for serving HTTPS instead HTTP" env:"KEY" ` NoCheckCertificate bool `long:"no-check" description:"disable tls certificate validation"` }
TLSConfig holds TLS config options
type VersionResponseConfig ¶ added in v0.13.0
type VersionResponseConfig struct { Prefix string `long:"prefix" default:"/js/version.js" description:"URL for version response"` Format string `` /* 161-byte string literal not displayed */ CType string `long:"ctype" default:"text/javascript" description:"js code Content-Type header"` }
VersionResponseConfig
Click to show internal directories.
Click to hide internal directories.