proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxBodyCaptureBytes = 64 * 1024

DefaultMaxBodyCaptureBytes limits how many bytes of a body are buffered for security scanning (64 KB). The rest of the stream passes through to the client at full line-rate without consuming RAM.

View Source
const StreamBufferSize = 32 * 1024

StreamBufferSize defines the buffer size used for streaming data chunks (32 KB).

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer() *[]byte

GetBuffer retrieves a recycled 32KB buffer from the memory pool.

func PutBuffer

func PutBuffer(b *[]byte)

PutBuffer returns a buffer to the memory pool.

Types

type BoundedCaptureWriter

type BoundedCaptureWriter struct {
	// contains filtered or unexported fields
}

BoundedCaptureWriter records up to limit bytes while accepting unbounded writes.

func NewBoundedCaptureWriter

func NewBoundedCaptureWriter(limit int) *BoundedCaptureWriter

NewBoundedCaptureWriter creates a writer that caps stored bytes at limit.

func ReadAndCapture

func ReadAndCapture(rc io.ReadCloser, limit int) (io.ReadCloser, *BoundedCaptureWriter)

ReadAndCapture wraps an io.ReadCloser with a bounded capture buffer. As the caller reads from the returned reader, bytes are streamed directly while the first 'limit' bytes are copied into the capture buffer.

func (*BoundedCaptureWriter) Bytes

func (w *BoundedCaptureWriter) Bytes() []byte

Bytes returns the captured bytes.

func (*BoundedCaptureWriter) Write

func (w *BoundedCaptureWriter) Write(p []byte) (n int, err error)

type EBPFManager

type EBPFManager struct {
	ProxyPort int
	PID       int
	CGroup    string
}

EBPFManager coordinates transparent traffic redirection.

func NewEBPFManager

func NewEBPFManager(proxyPort int) *EBPFManager

NewEBPFManager initializes the eBPF / redirection coordinator.

func (*EBPFManager) CheckEnvironmentSupport

func (m *EBPFManager) CheckEnvironmentSupport() (bool, string)

CheckEnvironmentSupport checks if the host OS supports eBPF socket redirection directly.

func (*EBPFManager) GenerateEBPFInstructions

func (m *EBPFManager) GenerateEBPFInstructions() string

GenerateEBPFInstructions returns the Linux eBPF cgroup program and iptables redirection script.

type ProxyServer

type ProxyServer struct {
	// contains filtered or unexported fields
}

ProxyServer is the high-throughput asynchronous proxy engine.

func NewProxyServer

func NewProxyServer(addr string, cm *certs.CertificateManager, rb *ringbuffer.RingBuffer) *ProxyServer

NewProxyServer creates a new ProxyServer.

func (*ProxyServer) Close

func (p *ProxyServer) Close() error

Close terminates the proxy server.

func (*ProxyServer) GetMockEngine

func (p *ProxyServer) GetMockEngine() *mock.Engine

GetMockEngine returns the active mock & chaos engine.

func (*ProxyServer) ServeHTTP

func (p *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP delegates between HTTPS CONNECT tunneling (TLS bumping) and plain HTTP proxy requests.

func (*ProxyServer) SetInsecureUpstreamTLS

func (p *ProxyServer) SetInsecureUpstreamTLS(insecure bool)

SetInsecureUpstreamTLS enables or disables skipping certificate verification on upstream endpoints.

func (*ProxyServer) SetMockEngine

func (p *ProxyServer) SetMockEngine(eng *mock.Engine)

SetMockEngine configures the mock & chaos engine.

func (*ProxyServer) Start

func (p *ProxyServer) Start() error

Start runs the proxy server listener.

type RedirectionMode

type RedirectionMode string

RedirectionMode describes the network interception strategy.

const (
	ModeExplicitProxy RedirectionMode = "EXPLICIT_HTTP_PROXY"
	ModeEBPF          RedirectionMode = "EBPF_CGROUP"
	ModeIPTables      RedirectionMode = "IPTABLES_TRANSPARENT"
)

Jump to

Keyboard shortcuts

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