helper

package
v0.0.0-...-7f4d65f Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timeout")

ErrTimeout is thrown when the number of valid reads is exceeded

Functions

func AddCustomDockerStreamHeader

func AddCustomDockerStreamHeader(payload []byte, streamType int, sizeOffset int) []byte

AddCustomDockerStreamHeader behaves indentically to addHeader but allows you to alter the calculated payload size in the header by supplying a sizeOffset to increase/decrease the size stored in the header.

func AddDockerStreamHeader

func AddDockerStreamHeader(payload []byte, streamType int) []byte

AddDockerStreamHeader prefixes the supplied byte slice with a docker stream header as seen in Dockers stdWriter.Write(p []byte).

This takes the following form:

header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}

`STREAM_TYPE` can be:

  • 0: stdin
  • 1: stdout
  • 2: stderr
  • 3: Systemer

`SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of the uint32 size encoded as big endian.

func TimeoutReader

func TimeoutReader(r io.Reader, n int) io.Reader

TimeoutReader wraps a Reader and allows up to n valid reads after which subsequent reads will return ErrTimeout

Types

This section is empty.

Jump to

Keyboard shortcuts

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