Documentation
¶
Overview ¶
Package wrapper provides net.Listener and net.Conn wrappers that enforce admission control at the network level.
The listener wrapper checks each accepted connection against the admission controller before returning it to the caller. Denied connections are closed immediately and the listener continues accepting (transparent rejection).
The connection wrappers (TCP, UDP, generic packet) check admission on each read operation, effectively dropping traffic from denied addresses without closing the underlying transport.
Index ¶
- func WrapConn(admission admission.Admission, c net.Conn) net.Conn
- func WrapListener(service string, admission admission.Admission, ln net.Listener) net.Listener
- func WrapPacketConn(admission admission.Admission, pc net.PacketConn) net.PacketConn
- func WrapUDPConn(adm admission.Admission, pc net.PacketConn) udp.Conn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapConn ¶
WrapConn wraps a net.Conn with per-read admission control. If admission is nil, the original connection is returned unchanged.
When admission is denied on a Read, io.EOF is returned so the caller sees a clean end-of-stream rather than a hard error.
func WrapListener ¶
WrapListener wraps a net.Listener with admission control. If admission is nil, the original listener is returned unchanged (no-op).
The service name is passed to the admission controller via admission.WithService so that the controller can distinguish between different services sharing the same admission rules.
func WrapPacketConn ¶
func WrapPacketConn(admission admission.Admission, pc net.PacketConn) net.PacketConn
WrapPacketConn wraps a net.PacketConn with per-packet admission control. If admission is nil, the original connection is returned unchanged.
Denied packets are silently discarded; ReadFrom loops until it receives a packet from an allowed address or encounters an error.
func WrapUDPConn ¶
WrapUDPConn wraps a net.PacketConn as a udp.Conn with admission control. This is used in UDP forwarding paths where the connection is treated as a connected UDP socket. If pc is nil, nil is returned. If admission is nil, the original connection is returned unchanged (no-op).
Types ¶
This section is empty.