conntrack

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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