Help us shape the future of Go! Take the 2026 Go Developer Survey

io

package
v0.28.16 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package io provides building blocks to add I/O related features, for example read and write request.Body streams.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed  = errors.New("reader closed")
	ErrBlocked = errors.New("blocked string match found in stream")
)
View Source
var (
	ErrMatcherBufferFull = errors.New("matcher buffer full")
)

Functions

func InspectReader

func InspectReader(ctx context.Context, bo BufferOptions, f func([]byte) (int, error), rc io.ReadCloser) io.ReadCloser

InspectReader wraps the given ReadCloser such that the given function f can inspect the streaming while streaming to the target. A target can be any io.ReadCloser, so for example the request body to the backend or the response body to the client. InspectReader applies given BufferOptions to the matcher.

NOTE: This function is *experimental* and will likely change or disappear in the future.

Types

type BufferOptions

type BufferOptions struct {
	MaxBufferHandling MaxBufferHandling
	ReadBufferSize    uint64
}

type MaxBufferHandling

type MaxBufferHandling int
const (
	MaxBufferBestEffort MaxBufferHandling = iota
	MaxBufferAbort
)

Directories

Path Synopsis
Package iotest provides io related test functionality.
Package iotest provides io related test functionality.

Jump to

Keyboard shortcuts

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