conntrack

package
v0.67.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL