Documentation
¶
Index ¶
- func WrapConn(c net.Conn, pStats stats.Stats) net.Conn
- func WrapListener(ln net.Listener, stats stats.Stats) net.Listener
- func WrapPacketConn(pc net.PacketConn, stats stats.Stats) net.PacketConn
- func WrapReadWriter(rw io.ReadWriter, stats stats.Stats) io.ReadWriter
- func WrapUDPConn(pc net.PacketConn, pStats stats.Stats) udp.Conn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapConn ¶
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 ¶
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 ¶
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.