conntrack

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MPL-2.0 Imports: 7 Imported by: 1 module, 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 Builder

type Builder struct {
	// TrackTraffic enables counting of bytes read and written by the connection.
	// Use Rx and Tx to get the number of bytes read and written.
	TrackTraffic bool

	// OnClose is called after the underlying connection is closed and before the Close method returns.
	// OnClose is called at most once.
	OnClose func()
}

func (Builder) Build

func (b Builder) Build(c net.Conn) net.Conn

func (Builder) BuildWithObserver

func (b Builder) BuildWithObserver(c net.Conn) (net.Conn, *Observer)

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

Observer allows to observe the number of bytes read and written from a connection.

func ObserverFromConn

func ObserverFromConn(conn net.Conn) *Observer

func (*Observer) Rx

func (o *Observer) Rx() uint64

Rx returns the number of bytes read from the connection. It requires TrackTraffic to be set to true, otherwise it returns 0.

func (*Observer) Tx

func (o *Observer) Tx() uint64

Tx returns the number of bytes written to the connection. It requires TrackTraffic to be set to true, otherwise it returns 0.

Jump to

Keyboard shortcuts

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