Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HijackTracker ¶
type HijackTracker struct {
// contains filtered or unexported fields
}
HijackTracker tracks connections that have been hijacked (e.g. WebSocket upgrades). http.Server.Shutdown does not close hijacked connections, so they must be tracked and closed explicitly during graceful shutdown.
Connections are indexed by the request Host so they can be closed per-domain when a service mapping is removed.
Use Middleware as the outermost HTTP middleware to ensure hijacked connections are tracked and automatically deregistered when closed.
func (*HijackTracker) CloseAll ¶
func (t *HijackTracker) CloseAll() int
CloseAll closes all tracked hijacked connections and returns the count.
func (*HijackTracker) CloseByHost ¶ added in v0.67.0
func (t *HijackTracker) CloseByHost(host string) int
CloseByHost closes all tracked hijacked connections for the given host and returns the number of connections closed.
func (*HijackTracker) Middleware ¶
func (t *HijackTracker) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that wraps the ResponseWriter so that hijacked connections are tracked and automatically deregistered from the tracker when closed. This should be the outermost middleware in the chain.