Documentation ¶
Overview ¶
Package rand contains a Caddy handler that allows random data to be returned.
Index ¶
Constants ¶
This section is empty.
Variables ¶
NewRand function creates a new random data generator.
Functions ¶
This section is empty.
Types ¶
type HeaderSeed ¶
type HeaderSeed struct{}
func (HeaderSeed) Default ¶
func (HeaderSeed) Default() int64
Default returns the current unix micro time.
type HeaderSize ¶
type HeaderSize struct{}
type HeaderValue ¶
func (*HeaderValue[K]) GetValue ¶
func (h *HeaderValue[K]) GetValue(headers http.Header)
GetValue extracts a value from the HTTP headers.
type HeaderValues ¶
type HeaderValues struct {
// contains filtered or unexported fields
}
HeaderValues struct holds the seed and size values extracted from headers.
func NewHeaderValues ¶
func NewHeaderValues(headers http.Header) *HeaderValues
NewHeaderValues creates a new HeaderValues instance from HTTP headers.
type Rand ¶
type Rand struct{}
Rand struct represents the custom Caddy HTTP handler for generating random data.
func (*Rand) CaddyModule ¶
func (r *Rand) CaddyModule() caddy.ModuleInfo
CaddyModule implemnts caddy.Module.
func (*Rand) ServeHTTP ¶
func (r *Rand) ServeHTTP(resp http.ResponseWriter, req *http.Request, _ caddyhttp.Handler) (err error)
ServeHTTP handles sending random data to the client. The following headers can be optionally set to modify the generation of data: - `Rand-Seed`: int64 seed value for the random data generator. - `Rand-Size`: int64 size in bytes of data to generate. A value less than zero represents an infinite stream.
func (*Rand) UnmarshalCaddyfile ¶
UnmarshalCaddyfile implements caddyfile.Unmarshaler.