wrapper

package
v0.28.1 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

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapConn

func WrapConn(admission admission.Admission, c net.Conn) net.Conn

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

func WrapListener(service string, admission admission.Admission, ln net.Listener) net.Listener

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

func WrapUDPConn(adm admission.Admission, pc net.PacketConn) udp.Conn

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.

Jump to

Keyboard shortcuts

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