io

package
v0.19.54 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

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
)

Jump to

Keyboard shortcuts

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