Documentation ¶
Overview ¶
Package streamer describes interface for interaction on network level.
Index ¶
- Variables
- func CloserCTX(ctx context.Context, fn func()) context.CancelFunc
- func GetLastBytes(data []byte, last int) []byte
- func NetReader(ctx context.Context, buff chan []byte, conn net.Conn, logger *zap.Logger) error
- func NewTimerWithDefault(duration time.Duration) *time.Timer
- func StopTimer(timer *time.Timer)
- func TCPDialCtx(ctx context.Context, network, addr string) (net.Conn, error)
- func ThrowCmdTimeoutException(lastRead []byte) error
- func ThrowEOFException(lastRead []byte) error
- func ThrowReadTimeoutException(lastRead []byte) error
- type Chmod
- type CmdTimeoutException
- type Connector
- type Const
- type EOFException
- type File
- type ReadRes
- type ReadResImpl
- type ReadTimeoutException
- type ReadXRes
- type ReadXType
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSupported = errors.New("not supported")
Functions ¶
func CloserCTX ¶
func CloserCTX(ctx context.Context, fn func()) context.CancelFunc
CloserCTX calls fn if ctx is cancelled. Returns cancel function.
func GetLastBytes ¶
func TCPDialCtx ¶
TCPDialCtx net.Dial version with context arg
func ThrowEOFException ¶
Types ¶
type CmdTimeoutException ¶
type CmdTimeoutException struct {
// contains filtered or unexported fields
}
func (*CmdTimeoutException) Error ¶
func (e *CmdTimeoutException) Error() string
type Connector ¶
type Connector interface { Init(context.Context) error GetCredentials() credentials.Credentials SetCredentialsInterceptor(func(credentials.Credentials) credentials.Credentials) SetTrace(trace.CB) SetReadTimeout(time.Duration) time.Duration Close() ReadTo(context.Context, expr.Expr) (ReadRes, error) Read(ctx context.Context, n int) ([]byte, error) Cmd(ctx context.Context, cmd string) (cmd.CmdRes, error) Write([]byte) error HasFeature(Const) bool Download(paths []string, recurse bool) (map[string]File, error) Upload(map[string]File) error InitAgentForward() error }
type EOFException ¶
type EOFException struct {
LastRead []byte
}
func (*EOFException) Error ¶
func (m *EOFException) Error() string
func (*EOFException) Is ¶
func (m *EOFException) Is(target error) bool
type ReadResImpl ¶
type ReadResImpl struct {
// contains filtered or unexported fields
}
func NewReadResImpl ¶
func NewReadResImplWithUnder ¶ added in v1.0.7
func (ReadResImpl) GetAfter ¶
func (m ReadResImpl) GetAfter() []byte
func (ReadResImpl) GetBefore ¶
func (m ReadResImpl) GetBefore() []byte
func (ReadResImpl) GetMatched ¶
func (m ReadResImpl) GetMatched() []byte
func (ReadResImpl) GetMatchedGroups ¶
func (m ReadResImpl) GetMatchedGroups() map[string][]byte
func (ReadResImpl) GetPatternNo ¶
func (m ReadResImpl) GetPatternNo() int
func (ReadResImpl) GetUnderlyingRes ¶ added in v1.0.7
func (m ReadResImpl) GetUnderlyingRes() ReadRes
type ReadTimeoutException ¶
type ReadTimeoutException struct {
LastRead []byte
}
func (*ReadTimeoutException) Error ¶
func (m *ReadTimeoutException) Error() string
func (*ReadTimeoutException) Is ¶
func (m *ReadTimeoutException) Is(target error) bool
type ReadXRes ¶
func GenericReadX ¶
func GenericReadX(ctx context.Context, inBuffer []byte, readCh chan []byte, readSize int, readTimeout time.Duration, regExpr expr.Expr, maxReadSize int, maxDuration time.Duration) (*ReadXRes, []byte, []byte, error)
GenericReadX reads from readCh till expr matched, exceeded time or read more than size. Returns error if nothing was read during readTimeout or ctx was Done readSize - maximum read size maxDuration - maximum time for reading regExpr - read till regex match Returns read res, left bytes, read bytes, error
Click to show internal directories.
Click to hide internal directories.