conntrack

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

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