util

package
v0.3.24 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 39 Imported by: 111

Documentation

Index

Constants

View Source
const BUFFER_SIZE = 65536

Variables

View Source
var (
	MaxResultsSliceSize     = 1_000 // 0 for limitless
	ResultsStreamBufferSize = 100
)

Functions

func BytesToString

func BytesToString(bytes []byte) string

This conversion *does not* copy data. Note that converting via "(string)([]byte)" *does* copy data. Also note that you *should not* change the byte slice after conversion, because Go strings are treated as immutable. This would cause a segmentation violation panic.

func ContextualRead added in v0.2.2

func ContextualRead(context contextpkg.Context, reader io.Reader, p []byte) (int, error)

func CopySSH

func CopySSH(host string, port int, username string, key string, reader io.Reader, targetPath string, permissions *int64) error

func CreateRSAX509Certificate added in v0.3.13

func CreateRSAX509Certificate(organization string, host string, rsaBits int, duration time.Duration) (*rsa.PrivateKey, *x509.Certificate, error)

Generates a random RSA key pair and uses it to sign a X.509 certificate with a random serial number.

If host is empy it will default to "localhost". If rsaBits is 0 it will default to 2048. If duration is 0 it will default to one year.

func CreateSelfSignedTLSConfig added in v0.1.38

func CreateSelfSignedTLSConfig(organization string, host string, rsaBits int, duration time.Duration) (*tls.Config, error)

Creates a TLS config with a single X.509 certificate signed with a new RSA key pair.

If rsaBits is 0 it will default to 2048. If duration is 0 it will default to one year.

func CreateTLSConfig added in v0.1.38

func CreateTLSConfig(certificate []byte, key []byte) (*tls.Config, error)

func DoesFileExist added in v0.1.59

func DoesFileExist(path string) (bool, error)

func DumpIPAddress added in v0.1.60

func DumpIPAddress(address any)

func ExecSSH

func ExecSSH(host string, port int, username string, key string, stdin io.Reader, command ...string) (string, error)

func Exit added in v0.1.22

func Exit(code int)

func ExitOnSignal added in v0.3.12

func ExitOnSignal(signal os.Signal, exitCode int)

func ExitOnSignals added in v0.3.11

func ExitOnSignals()

func Fail

func Fail(message string)

func FailOnError

func FailOnError(err error)

func Failf

func Failf(f string, args ...any)

func FixTarballEntryPath added in v0.3.7

func FixTarballEntryPath(path string) string

func FromBase64 added in v0.1.4

func FromBase64(b64 string) ([]byte, error)

func GatherResults added in v0.3.15

func GatherResults[E any](results Results[E]) ([]E, error)

func GetFileHash

func GetFileHash(path string) (string, error)

func GetGoBin added in v0.1.31

func GetGoBin() (string, error)

func GetGoPath added in v0.1.31

func GetGoPath() (string, error)

func IPAddressPortWithoutZone added in v0.3.18

func IPAddressPortWithoutZone(address string) string

func InitializeCPUProfiling added in v0.2.6

func InitializeCPUProfiling(path string)

func InitializeColorization added in v0.2.6

func InitializeColorization(colorize string)

Attempts to enable colorization for os.Stdout and os.Stderr according to the colorize argument. If cleanup is required, will set register it with OnExit. Errors will Fail.

The colorize argument can be:

  • "true", "TRUE", "True", "t", "T", "1": Attempts to enable colorization if os.Stdout and os.Stdout support it. If it succeeds will set [ColorizeStdout], [StdoutStylist], [ColorizeStderr], and [StderrStylist] accordingly.
  • "false", "FALSE", "False", "f", "F", "0": Does nothing.
  • "force": Sets [ColorizeStdout], [StdoutStylist], [ColorizeStderr], and [StderrStylist] as if coloriziation were enabled.

Other colorize values will Fail.

See terminal.InitializeColorization.

func IsFileExecutable added in v0.1.59

func IsFileExecutable(mode fs.FileMode) bool

func IsFileHidden added in v0.1.59

func IsFileHidden(path string) bool

func IsFloat added in v0.3.3

func IsFloat(value any) bool

Returns true if value is a float64 or float32.

func IsIPv6 added in v0.1.60

func IsIPv6(address string) bool

Returns true if the IP address string representation is IPv6.

Note that this function does no validation and assumes the argument is already a valid IPv6 or IPv4 address.

func IsInteger added in v0.3.3

func IsInteger(value any) bool

Returns true if value is an int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, or uint.

func IsNumber added in v0.3.3

func IsNumber(value any) bool

Returns true if value is an int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, uint, float64, or float32.

func IsUDPAddrEqual added in v0.1.60

func IsUDPAddrEqual(a *net.UDPAddr, b *net.UDPAddr) bool

Returns true if the two UDP addresses are equal.

func IterateResults added in v0.3.15

func IterateResults[E any](results Results[E], iterate IterateResultsFunc[E]) error

func JoinIPAddressPort added in v0.1.60

func JoinIPAddressPort(address string, port int) string

Returns "[address]:port" for IPv6 and "address:port" for IPv4.

Meant to satisfy the unfortunate requirement of many APIs to provide an address (or hostname) and port with a single string argument.

func JoinIPAddressZone added in v0.3.14

func JoinIPAddressZone(address string, zone string) string

If the zone is not empty returns "address%zone". It is expected that the argument does not already have a zone.

For IPv6 address string representations only, see: https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses_(with_zone_index)

func JoinQuote added in v0.1.60

func JoinQuote(strings []string, separator string) string

func JoinQuoteL added in v0.1.60

func JoinQuoteL(strings []string, separator string, lastSeparator string, coupleSeparator string) string

func NewContextualReadCloser added in v0.2.2

func NewContextualReadCloser(context contextpkg.Context, reader io.ReadCloser) io.ReadCloser

Creates a io.ReadCloser

func NewContextualReader added in v0.2.2

func NewContextualReader(context contextpkg.Context, reader io.Reader) io.Reader

func NewMockLocker added in v0.1.51

func NewMockLocker() sync.Locker

func NewX509Certificate added in v0.3.13

func NewX509Certificate(organization string, host string, duration time.Duration, rsa bool, ca bool) (*x509.Certificate, error)

Initializes a X.509 certificate with a random serial number.

If duration is 0 it will default to one year.

func ParseX509CertificatePool added in v0.3.13

func ParseX509CertificatePool(bytes []byte) (*x509.CertPool, error)

func ParseX509Certificates added in v0.1.6

func ParseX509Certificates(bytes []byte) ([]*x509.Certificate, error)

func RandomSerialNumber added in v0.3.13

func RandomSerialNumber() (*big.Int, error)

func ReaderSize

func ReaderSize(reader io.Reader) (int64, error)

func ResetAdHocLocks added in v0.1.51

func ResetAdHocLocks()

func SanitizeFilename

func SanitizeFilename(name string) string

func SetFlagsFromEnvironment

func SetFlagsFromEnvironment(prefix string)

func SetupSignalHandler

func SetupSignalHandler() <-chan struct{}

Registers handlers for SIGINT and (on Posix systems) SIGTERM. The returned channel will be closed when either signal is sent.

func SignX509Certificate added in v0.1.38

func SignX509Certificate(certificate *x509.Certificate, privateKey any, publicKey any) (*x509.Certificate, error)

Signs a X.509 certificate.

For RSA, privateKey should be *rsa.PrivateKey and publicKey should be *rsa.PublicKey.

func SplitIPAddressPort added in v0.3.18

func SplitIPAddressPort(addressPort string) (string, int, bool)

func StringToBytes

func StringToBytes(string_ string) (bytes []byte)

This conversion *does not* copy data. Note that converting via "([]byte)(string)" *does* copy data. Also note that you *should not* change the byte slice after conversion, because Go strings are treated as immutable. This would cause a segmentation violation panic.

func ToBase64 added in v0.1.4

func ToBase64(bytes []byte) string

func ToBroadcastIPAddress added in v0.1.60

func ToBroadcastIPAddress(address string) (string, error)

The argument is validated as being a multicast address, e.g. "ff02::1" (IPv6) or "239.0.0.1" (IPv4). For IPv6, if it does not include a zone, a valid zone will be added by enumerating the active local interfaces, chosing one arbitrarily.

func ToBytes added in v0.1.61

func ToBytes(content any) []byte

func ToDromedaryCase added in v0.1.61

func ToDromedaryCase(name string) string

func ToFloat64 added in v0.3.3

func ToFloat64(value any) (float64, bool)

Converts any number type to float64.

Support types are int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, uint, float64, and float32.

Precision may be lost.

func ToInt64 added in v0.3.3

func ToInt64(value any) (int64, bool)

Converts any number type to int64.

Supported types are int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, uint, float64, and float32.

Precision may be lost.

func ToKebabCase added in v0.1.61

func ToKebabCase(name string) string

func ToRawTerminal added in v0.1.63

func ToRawTerminal(f func() error)

func ToReachableIPAddress added in v0.1.60

func ToReachableIPAddress(address string) (string, error)

Always returns a specified address. If the argument is already a specified address, returns it as is. Otherwise (when it's "::" or "0.0.0.0") will attempt to find a specified address by enumerating the active local interfaces, chosing one arbitrarily, with a preference for a global unicast address.

The IP version of the returned address will match that of the argument, IPv6 for "::" and IPv4 for "0.0.0.0".

Note that a returned IPv6 address may include a zone (when not a global unicast).

func ToSnakeCase added in v0.1.61

func ToSnakeCase(name string) string

func ToString added in v0.1.59

func ToString(value any) string

Converts any value to a string.

Will use the fmt.Stringer interface if implemented.

Will use the [error] interface if implemented.

nil will become "nil". []byte will become a string. Primitive types will use strconv. Any other type will use fmt.Sprintf("%+v").

func ToStrings added in v0.1.60

func ToStrings(values []any) []string

Calls ToString on all slice elements.

func ToUInt64 added in v0.3.3

func ToUInt64(value any) (uint64, bool)

Converts any number type to uint64.

Support types are int64, int32, int16, int8, int, uint64, uint32, uint16, uint8, uint, float64, and float32.

Precision may be lost.

func Touch added in v0.1.62

func Touch(path string, permissions fs.FileMode, dirPermissions fs.FileMode) error

func WriteBytesToChannel added in v0.3.5

func WriteBytesToChannel(ch chan []byte, p []byte, copy bool) (int, error)

Sends the byte slice to a channel and returns its length.

When copy is true will copy the byte slice before sending it to the channel. This is necessary for ensuring that the submitted data is indeed the data that will be received, even if the underlying array changes after this call.

func WriteNewline added in v0.1.27

func WriteNewline(writer io.Writer) error

func WriteTLSCertificatePEM added in v0.3.13

func WriteTLSCertificatePEM(writer io.Writer, certificate *tls.Certificate) error

func WriteTLSRSAKeyPEM added in v0.3.13

func WriteTLSRSAKeyPEM(writer io.Writer, certificate *tls.Certificate) error

Types

type BufferedWriter added in v0.1.22

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

func NewBufferedWriter added in v0.1.22

func NewBufferedWriter(writer io.Writer, size int, copy bool) *BufferedWriter

Creates a thread-safe io.WriterCloser that separates the acceptance of byte slices via BufferedWriter.Write from the actual writing of the data to the underlying io.Writer, which occurs on a separate goroutine.

The size argument is for the internal channel, referring to the maximum number of write submissions to be buffered (not the number of bytes). If the buffering channel is full then BufferedWriter.Write will return an error. The actual write errors are ignored.

When copy is true the implementation copies the byte slice before sending it to the separate goroutine. This ensures that the submitted data is indeed the data that will be written, even if the underlying array changes after submission.

func (*BufferedWriter) Close added in v0.1.22

func (self *BufferedWriter) Close() error

(io.Closer interface)

func (*BufferedWriter) Write added in v0.1.22

func (self *BufferedWriter) Write(p []byte) (int, error)

(io.Writer interface)

type ChannelReader added in v0.1.59

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

func NewChannelReader added in v0.1.59

func NewChannelReader(ch chan []byte) *ChannelReader

Creates an io.Reader that reads bytes from a channel. This works via a separate goroutine that pipes (via io.Pipe) the channel data.

func (*ChannelReader) Read added in v0.1.59

func (self *ChannelReader) Read(p []byte) (n int, err error)

(io.Reader interface)

type ChannelWriter added in v0.1.57

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

func NewChannelWriter added in v0.1.57

func NewChannelWriter(ch chan []byte, copy bool) *ChannelWriter

Creates an io.Writer that writes bytes to a channel. The expectation is that something else will be receiving from the channel and processing the bytes. Writing is non-blocking: if the channel is full then ChannelWriter.Write will return an error.

When copy is true the implementation copies the byte slice before sending it to the channel. This ensures that the submitted data is indeed the data that will be received, even if the underlying array changes after submission.

func (*ChannelWriter) Write added in v0.1.57

func (self *ChannelWriter) Write(p []byte) (int, error)

(io.Writer interface)

type ContextualReadCloser added in v0.2.2

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

Creates a io.ReadCloser that allows cancellation of reading via a provided context. Note that cancellation is not guaranteed because the underlying reader is called in-thread. At best we can guarantee that subsequent calls to ContextualReadCloser.Read will fail after cancellation.

func (ContextualReadCloser) Close added in v0.2.2

func (self ContextualReadCloser) Close() error

(io.Closer interface)

func (*ContextualReadCloser) Read added in v0.2.2

func (self *ContextualReadCloser) Read(p []byte) (int, error)

(io.Reader interface)

type ContextualReader added in v0.2.2

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

Creates a io.Reader that allows cancellation of reading via a provided context. Note that cancellation is not guaranteed because the underlying reader is called in-thread. At best we can guarantee that subsequent calls to ContextualReader.Read will fail after cancellation.

func (*ContextualReader) Read added in v0.2.2

func (self *ContextualReader) Read(p []byte) (int, error)

(io.Reader interface)

type CoordinatedWork added in v0.1.52

type CoordinatedWork struct {
	sync.Map
}

func NewCoordinatedWork added in v0.1.52

func NewCoordinatedWork() *CoordinatedWork

func (*CoordinatedWork) Start added in v0.1.52

func (self *CoordinatedWork) Start(context contextpkg.Context, key string) (Promise, bool)

type Executor added in v0.3.16

type Executor[T any] interface {
	Queue(task T)
	Wait() []error
	Close()
}

type ExitFunctionHandle added in v0.1.22

type ExitFunctionHandle int

func OnExit added in v0.1.22

func OnExit(exitFunction func()) ExitFunctionHandle

func OnExitError added in v0.1.50

func OnExitError(exitFunction func() error) ExitFunctionHandle

func (ExitFunctionHandle) Cancel added in v0.1.22

func (self ExitFunctionHandle) Cancel()

type FilterIPFunc added in v0.3.14

type FilterIPFunc func(ip net.IP) bool

type FilterInterfaceFunc added in v0.3.14

type FilterInterfaceFunc func(interface_ net.Interface) bool

type ForceHTTPSRoundTripper added in v0.1.4

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

func NewForceHTTPSRoundTripper added in v0.1.4

func NewForceHTTPSRoundTripper(roundTripper http.RoundTripper) *ForceHTTPSRoundTripper

func (*ForceHTTPSRoundTripper) RoundTrip added in v0.1.4

func (self *ForceHTTPSRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

http.RoundTripper interface

type GetResults added in v0.3.22

type GetResults[E any] func(offset uint) (Results[E], error)

type IPAddressCollector added in v0.3.14

type IPAddressCollector struct {
	// If nil, will call net.Interfaces().
	Interfaces []net.Interface

	// Which IP version to accept.
	IPv6 bool

	// Include IPv6 zone in returned addresses.
	WithZone bool

	// Return true to accept an interface (can be nil).
	FilterInterface FilterInterfaceFunc

	// Return true to accept an IP (can be nil).
	// Note that the argument's address (ip.String()) does not include the IPv6 zone.
	FilterIP FilterIPFunc
}

func (*IPAddressCollector) Collect added in v0.3.14

func (self *IPAddressCollector) Collect() ([]string, error)

type IPStack added in v0.3.14

type IPStack string
const (
	DualStack IPStack = "dual"
	IPv6Stack IPStack = "ipv6"
	IPv4Stack IPStack = "ipv4"
)

func (IPStack) ClientBind added in v0.3.14

func (self IPStack) ClientBind(address string) IPStackBind

func (IPStack) Level2Protocol added in v0.3.14

func (self IPStack) Level2Protocol() string

func (IPStack) ServerBinds added in v0.3.14

func (self IPStack) ServerBinds(address string) []IPStackBind

func (IPStack) StartServers added in v0.3.18

func (self IPStack) StartServers(address string, start IPStackStartServerFunc) error

func (IPStack) Validate added in v0.3.14

func (self IPStack) Validate(name string) error

type IPStackBind added in v0.3.14

type IPStackBind struct {
	Level2Protocol string
	Address        string
}

type IPStackStartServerFunc added in v0.3.18

type IPStackStartServerFunc func(level2protocol string, address string) error

type IterateResultsFunc added in v0.3.15

type IterateResultsFunc[E any] func(entity E) error

type LockType added in v0.1.51

type LockType int
const (
	DefaultLock LockType = 0
	SyncLock    LockType = 1
	DebugLock   LockType = 2
	MockLock    LockType = 3
)

type LockableEntity added in v0.1.51

type LockableEntity interface {
	GetEntityLock() RWLocker
}

type MockLocker added in v0.1.51

type MockLocker struct{}

func (MockLocker) Lock added in v0.1.51

func (self MockLocker) Lock()

(sync.Locker interface)

func (MockLocker) Unlock added in v0.1.51

func (self MockLocker) Unlock()

(sync.Locker interface)

type MockRWLocker added in v0.1.51

type MockRWLocker struct {
	MockLocker
}

func (MockRWLocker) RLock added in v0.1.51

func (self MockRWLocker) RLock()

(RWLocker interface)

func (MockRWLocker) RLocker added in v0.1.51

func (self MockRWLocker) RLocker() sync.Locker

(RWLocker interface)

func (MockRWLocker) RUnlock added in v0.1.51

func (self MockRWLocker) RUnlock()

(RWLocker interface)

type NamedPipe added in v0.1.58

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

func NewTempNamedPipe added in v0.1.58

func NewTempNamedPipe(writer io.Writer, mode uint32) (*NamedPipe, error)

Creates a named pipe using syscall.Mkfifo in the OS temp directory. Currently only supported on Linux.

func (*NamedPipe) Close added in v0.1.58

func (self *NamedPipe) Close() error

(io.Closer interface)

func (*NamedPipe) Write added in v0.1.58

func (self *NamedPipe) Write(p []byte) (int, error)

(io.Writer interface)

type ParallelExecutor added in v0.3.16

type ParallelExecutor[T any] struct {
	PanicAsError string // when non-empty, wil capture panics as errors under this name
	// contains filtered or unexported fields
}

func NewParallelExecutor added in v0.3.16

func NewParallelExecutor[T any](bufferSize int, processor func(task T) error) *ParallelExecutor[T]

func (*ParallelExecutor[T]) Close added in v0.3.19

func (self *ParallelExecutor[T]) Close()

(Executor interface)

func (*ParallelExecutor[T]) Queue added in v0.3.16

func (self *ParallelExecutor[T]) Queue(task T)

(Executor interface)

func (*ParallelExecutor[T]) Start added in v0.3.16

func (self *ParallelExecutor[T]) Start(workers int)

func (*ParallelExecutor[T]) Wait added in v0.3.16

func (self *ParallelExecutor[T]) Wait() []error

(Executor interface)

type Promise added in v0.1.52

type Promise chan struct{}

func NewPromise added in v0.1.52

func NewPromise() Promise

func (Promise) Release added in v0.1.52

func (self Promise) Release()

func (Promise) Wait added in v0.1.52

func (self Promise) Wait(context contextpkg.Context) error

type RWLocker added in v0.1.51

type RWLocker interface {
	sync.Locker
	RLock()
	RUnlock()
	RLocker() sync.Locker
}

func GetAdHocLock added in v0.1.51

func GetAdHocLock(pointer any, type_ LockType) RWLocker

Warning: Because pointers can be re-used after the resource is freed, there is no way for us to guarantee ad-hoc locks would not be reused Thus this facililty should only be used for objects with a known and managed life span.

func GetEntityLock added in v0.1.51

func GetEntityLock(entity any) RWLocker

From LockableEntity interface.

func NewDebugRWLocker added in v0.1.51

func NewDebugRWLocker() RWLocker

func NewDefaultRWLocker added in v0.1.51

func NewDefaultRWLocker() RWLocker

func NewMockRWLocker added in v0.1.51

func NewMockRWLocker() RWLocker

func NewRWLocker added in v0.1.51

func NewRWLocker(type_ LockType) RWLocker

func NewSyncRWLocker added in v0.1.52

func NewSyncRWLocker() RWLocker

type Results added in v0.3.15

type Results[E any] interface {
	Next() (E, error) // can return io.EOF
	Release()
}

func CombineResults added in v0.3.22

func CombineResults[E any](get GetResults[E]) Results[E]

type ResultsSlice added in v0.3.15

type ResultsSlice[E any] struct {
	// contains filtered or unexported fields
}

func NewResult added in v0.3.23

func NewResult[E any](entity E) *ResultsSlice[E]

func NewResultsSlice added in v0.3.15

func NewResultsSlice[E any](entities []E) *ResultsSlice[E]

func (*ResultsSlice[E]) Next added in v0.3.15

func (self *ResultsSlice[E]) Next() (E, error)

(Results interface)

func (*ResultsSlice[E]) Release added in v0.3.15

func (self *ResultsSlice[E]) Release()

(Results interface)

type ResultsStream added in v0.3.15

type ResultsStream[E any] struct {
	// contains filtered or unexported fields
}

func NewResultsStream added in v0.3.15

func NewResultsStream[E any](release func()) *ResultsStream[E]

func (*ResultsStream[E]) Close added in v0.3.15

func (self *ResultsStream[E]) Close(err error)

Special handling for nil and io.EOF

func (*ResultsStream[E]) Next added in v0.3.15

func (self *ResultsStream[E]) Next() (E, error)

(Results interface)

func (*ResultsStream[E]) Release added in v0.3.15

func (self *ResultsStream[E]) Release()

(Results interface)

func (*ResultsStream[E]) Send added in v0.3.15

func (self *ResultsStream[E]) Send(info E)

type RuneReader added in v0.3.15

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

func NewRuneReader added in v0.3.15

func NewRuneReader(runes []rune) *RuneReader

func (*RuneReader) ReadRune added in v0.3.15

func (self *RuneReader) ReadRune() (rune, int, error)

(io.RuneReader interface)

type SyncedWriter added in v0.1.22

type SyncedWriter struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewSyncedWriter added in v0.1.22

func NewSyncedWriter(writer io.Writer) *SyncedWriter

Creates a thread-safe io.WriterCloser that synchronizes all the SyncedWriter.Write calls via a mutex.

If the underlying writer does not support io.Closer then SyncedWriter.Close will do nothing.

func (*SyncedWriter) Close added in v0.1.22

func (self *SyncedWriter) Close() error

(io.Closer interface)

func (*SyncedWriter) Write added in v0.1.22

func (self *SyncedWriter) Write(p []byte) (int, error)

(io.Writer interface)

type TarEncoder

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

func NewTarEncoder

func NewTarEncoder(reader io.Reader, name string, size int64) *TarEncoder

func (*TarEncoder) Drain

func (self *TarEncoder) Drain()

func (*TarEncoder) Encode

func (self *TarEncoder) Encode() io.Reader

type TarballEntryReader added in v0.3.7

type TarballEntryReader struct {
	TarballReader *TarballReader
}

func NewTarballEntryReader added in v0.3.7

func NewTarballEntryReader(tarballReader *TarballReader) *TarballEntryReader

func (*TarballEntryReader) Close added in v0.3.7

func (self *TarballEntryReader) Close() error

(io.Closer interface)

func (*TarballEntryReader) Read added in v0.3.7

func (self *TarballEntryReader) Read(p []byte) (n int, err error)

(io.Reader interface)

type TarballReader added in v0.3.7

type TarballReader struct {
	TarReader         *tar.Reader
	ArchiveReader     io.ReadCloser
	CompressionReader io.ReadCloser
}

func NewTarballReader added in v0.3.7

func NewTarballReader(reader *tar.Reader, archiveReader io.ReadCloser, compressionReader io.ReadCloser) *TarballReader

func (*TarballReader) Close added in v0.3.7

func (self *TarballReader) Close() error

(io.Closer interface)

func (*TarballReader) Has added in v0.3.7

func (self *TarballReader) Has(path string) (bool, error)

func (*TarballReader) Iterate added in v0.3.7

func (self *TarballReader) Iterate(f func(*tar.Header) bool) error

func (*TarballReader) Open added in v0.3.7

func (self *TarballReader) Open(path string) (*TarballEntryReader, error)

type TestLogWriter added in v0.1.51

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

func NewTestLogWriter added in v0.1.51

func NewTestLogWriter(t *testing.T) *TestLogWriter

func (*TestLogWriter) Write added in v0.1.51

func (self *TestLogWriter) Write(p []byte) (n int, err error)

(io.Writer interface)

Jump to

Keyboard shortcuts

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