wrapper

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 11 Imported by: ? 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

func WrapConn

func WrapConn(c net.Conn, pStats stats.Stats) net.Conn

WrapConn wraps a net.Conn to track connection and traffic statistics. It increments total and current connection counts, and tracks bytes read and written. On Close, it decrements the current connection count. If c or pStats is nil, the original conn is returned unchanged.

func WrapListener

func WrapListener(ln net.Listener, stats stats.Stats) net.Listener

WrapListener wraps a net.Listener to track connection statistics. Each accepted connection is wrapped via WrapConn to count connections and bytes. If ln or stats is nil, the original listener is returned unchanged.

func WrapPacketConn

func WrapPacketConn(pc net.PacketConn, stats stats.Stats) net.PacketConn

WrapPacketConn wraps a net.PacketConn to track input and output bytes. If pc or stats is nil, the original conn is returned unchanged.

func WrapReadWriter

func WrapReadWriter(rw io.ReadWriter, stats stats.Stats) io.ReadWriter

WrapReadWriter wraps an io.ReadWriter to track input and output bytes. If rw or stats is nil, the original ReadWriter is returned unchanged.

func WrapUDPConn

func WrapUDPConn(pc net.PacketConn, pStats stats.Stats) udp.Conn

WrapUDPConn wraps a net.PacketConn as a udp.Conn to track connection and traffic statistics. It increments total and current connection counts (one accepted UDP client session == one connection, mirroring WrapConn) and tracks bytes read and written across all read/write methods (Read, Write, ReadFrom, WriteTo, ReadFromUDP, ReadMsgUDP, WriteToUDP, WriteMsgUDP). On Close, it decrements the current connection count.

If pc is nil, nil is returned. If pStats is nil, the original connection is returned unchanged (consistent with WrapConn and WrapPacketConn).

Types

This section is empty.

Jump to

Keyboard shortcuts

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