netutils

package
v0.0.0-...-14476bf Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadWithTimeout

func ReadWithTimeout(ch <-chan (interface{}),
	timeoutMillis time.Duration) (val interface{}, err error)

reads 1 element from the channel with a timeout. unfortunately this piece of code is pretty useless in it's generalized form you can use a chan X as a chan interface{}, you need another chan to wrap it -_-g

Types

type CircularBuf

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

a a circular byte buffer

func NewCircularBuf

func NewCircularBuf(capacity int) *CircularBuf

func (*CircularBuf) Capacity

func (b *CircularBuf) Capacity() int

func (*CircularBuf) GimmeBuf

func (b *CircularBuf) GimmeBuf() []byte

func (*CircularBuf) Read

func (b *CircularBuf) Read(p []byte) (bytesCopied int, err error)

the read consumes the buffer

func (*CircularBuf) Size

func (b *CircularBuf) Size() int

func (*CircularBuf) Write

func (b *CircularBuf) Write(buf []byte) (bytesCopied int, err error)

Jump to

Keyboard shortcuts

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