Versions in this module Expand all Collapse all v0 v0.0.2 Apr 29, 2021 v0.0.1 Apr 27, 2021 Changes in this version + const HeaderXRequestedFrame + const HeaderXRequestedWith + const RequestedByActionFormFrame + var DefaultKeepAliveCount = 8 + var DefaultKeepAliveIdleInterval = 15 * time.Minute + var DefaultKeepAliveInterval = 5 * time.Second + var ErrNoListenersFound = errors.New("No listeners found") + func Fallback(handlers ...http.Handler) http.Handler + func GetUrl(r *http.Request) string + func HttpScheme(r *http.Request) (scheme string) + func IsActionFormRequest(r *http.Request) bool + func IsXhrRequest(r *http.Request) bool + func NewResponseWriter(w http.ResponseWriter) *responseWriter + func NewTeeResponseWriter(w http.ResponseWriter, tee ...io.Writer) *teeResponseWriter + func PopPrefix(ctx context.Context, pth string) context.Context + func Prefix(ctx context.Context) string + func PrefixHandler(prefix string, handler http.Handler, defaultHandler ...http.Handler) http.Handler + func PrefixR(r *http.Request) string + func PushPrefix(ctx context.Context, pth string) context.Context + func PushPrefixR(r *http.Request, pth string) *http.Request + func Redirect(w http.ResponseWriter, r *http.Request, url string, status int, force ...bool) + func RedirectHeader(headerName string, w http.ResponseWriter, r *http.Request, url string, ...) + func RemoteIP(r *http.Request) (ip net.IP) + func ServeContent(w http.ResponseWriter, r *http.Request, name string, modtime time.Time, ...) + func SetPrefix(ctx context.Context, pth string) context.Context + func SetPrefixR(r *http.Request, pth string) *http.Request + func StripPrefix(w http.ResponseWriter, r *http.Request, handler http.Handler, prefix string, ...) + func StripStaticPrefix(prefix string, h http.Handler) http.Handler + func URL(r *http.Request, pth ...string) string + func URLScheme(r *http.Request, scheme string, pth ...string) string + func WsScheme(r *http.Request) (scheme string) + func WsURL(r *http.Request, pth ...string) string + type Addr string + func (a Addr) CreateListener() (net.Listener, error) + func (a Addr) IsUnix() bool + func (a Addr) Network() (net string, addr string) + func (a Addr) Port() int + func (a Addr) UnixPath() string + type Config struct + DisableSlashPermanentRedirect bool + DisableStripRequestPrefix bool + Listeners []ListenerConfig + MaxPostSize int64 + NotFoundDisabled bool + Prefix string + RequestPrefixHeader string + UnlimitedPostSize bool + type ContextKey int + const CtxPrefix + const DefaultUriPrefixHeader + type FallbackHandlers []http.Handler + func (this *FallbackHandlers) Add(handler ...http.Handler) + func (this FallbackHandlers) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Http2Config struct + Config *http2.Server + Disabled bool + type KeepAliveConfig struct + Duration time.Duration + Value string + func (ka KeepAliveConfig) Get() (dur time.Duration, err error) + type KeepAliveListener struct + KeepAliveCount int + KeepAliveIdleInterval time.Duration + KeepAliveInterval time.Duration + func NewKeepAliveListener(listener net.Listener) *KeepAliveListener + func (ln KeepAliveListener) Accept() (net.Conn, error) + type Listener struct + KeepAlive time.Duration + Log logging.Logger + Server *http.Server + Tls *TlsConfig + func (l *Listener) Accept() (con net.Conn, err error) + func (l *Listener) Close() (err error) + func (l *Listener) Connections() (cons []net.Conn) + func (l *Listener) IsRunning() bool + func (l *Listener) ListenAndServe() error + func (l *Listener) Setup() error + func (l *Listener) Shutdown(ctx context.Context) (err error) + func (l *Listener) ShutdownLog(ctx context.Context) (err error) + func (l *Listener) Start(done func()) (stop task.Stoper, err error) + func (l *Listener) Stop() + type ListenerConfig struct + Addr Addr + Http2 Http2Config + KeepAliveCount int + KeepAliveIdleInterval *KeepAliveConfig + KeepAliveInterval *KeepAliveConfig + Timeouts TimeoutsConfig + Tls *TlsConfig + func (cfg *ListenerConfig) CreateServer() (s *http.Server, err error) + type Listeners []*Listener + func (l Listeners) Tasks() task.Slice + type PrefixHandlers []struct + func (this *PrefixHandlers) Set(prefix string, handler http.Handler) + func (this *PrefixHandlers) With(prefix string, handler http.Handler) + func (this PrefixHandlers) Get(uri string) http.Handler + func (this PrefixHandlers) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ResponseWriter interface + BytesWritten func() int + Status func() int + Unwrap func() http.ResponseWriter + Wrote func() bool + WroteHeader func() bool + func ResponseWriterOf(w http.ResponseWriter) (wd ResponseWriter) + type Server struct + Config *Config + Handler http.Handler + func NewServer(cfg *Config, handler http.Handler) *Server + func (s *Server) AddTask(t ...task.Task) + func (s *Server) Close() error + func (s *Server) GetPostSetup() []func(s *Server) error + func (s *Server) GetPostShutdown() []func() + func (s *Server) GetPreSetup() []func(s *Server) error + func (s *Server) InitListeners() (err error) + func (s *Server) Listeners() []*Listener + func (s *Server) OnListener(f ...func(lis *Listener)) + func (s *Server) PostSetup(f ...func(s *Server) error) + func (s *Server) PostShutdown(f ...func()) + func (s *Server) PostShutdownE(f ...func() error) + func (s *Server) PreSetup(f ...func(s *Server) error) + func (s *Server) Prepare() (err error) + func (s *Server) Run() (err error) + func (s *Server) SetLog(log logging.Logger) + func (s *Server) Setup() (err error) + func (s *Server) Shutdown(ctx context.Context) (err error) + func (s *Server) Start(done func()) (stop task.Stoper, err error) + type TeeResponseWriter interface + Tee func(io.Writer) + func TeeResponseWriterOf(w http.ResponseWriter) (wd TeeResponseWriter) + type TimeoutsConfig struct + IdleTimeout time.Duration + MaxHeaderBytes int + ReadHeaderTimeout time.Duration + ReadTimeout time.Duration + WriteTimeout time.Duration + type TlsConfig struct + CertFile string + Generate *tlsgen.Config + KeyFile string + NPNDisabled bool + func (cfg *TlsConfig) Valid() bool