channels

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

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

Go to latest
Published: Dec 27, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQueueFull is returned when the queue is full.
	ErrQueueFull = errors.New("winsize: queue is full")
	// ErrQueueClosed is returned when a channel is full.
	ErrQueueClosed = errors.New("chan is closed, cannot append data")
)

Functions

This section is empty.

Types

type Builder

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

Builder is builder for channels.

func DirectTCPIPBuilderSkeleton

func DirectTCPIPBuilderSkeleton() *Builder

DirectTCPIPBuilderSkeleton returns a new ChannelHandlerBuilder, which has the corresponding field set to handle directTCPIP.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new ChannelBuilder.

func SessionBuilderSkeleton

func SessionBuilderSkeleton() *Builder

SessionBuilderSkeleton returns a ChannelHandlerBuilder, which has the corresponding field set to handle sessions.

func (*Builder) Build

func (b *Builder) Build() (*Handler, error)

Build builds the channel.

func (*Builder) SetChannel

func (b *Builder) SetChannel(channel ssh.Channel)

SetChannel sets the channel.

func (*Builder) SetDirectTCPIPData

func (b *Builder) SetDirectTCPIPData(directTCPIPData *payload.ForwardTCPChannelOpen)

SetDirectTCPIPData sets the directTCPIPData.

func (*Builder) SetK8sUserAPI

func (b *Builder) SetK8sUserAPI(api kubernetes.K8sAPIUser)

SetK8sUserAPI sets the k8sAPIUser.

func (*Builder) SetLog

func (b *Builder) SetLog(logger *zap.Logger)

SetLog sets the logger.

func (*Builder) SetOnReqDefault

func (b *Builder) SetOnReqDefault(onReqDefault func(context.Context, *ssh.Request, *callbackData))

SetOnReqDefault sets the onReqDefault callback.

func (*Builder) SetOnReqPty

func (b *Builder) SetOnReqPty(onReqPty func(context.Context, *ssh.Request, *callbackData))

SetOnReqPty sets the onReqPty callback.

func (*Builder) SetOnReqShell

func (b *Builder) SetOnReqShell(onReqShell func(context.Context, *ssh.Request, *callbackData))

SetOnReqShell sets the onReqShell callback.

func (*Builder) SetOnReqSubSys

func (b *Builder) SetOnReqSubSys(onReqSubSys func(context.Context, *ssh.Request, *callbackData))

SetOnReqSubSys sets the onReqSubSys callback.

func (*Builder) SetOnReqWinCh

func (b *Builder) SetOnReqWinCh(onReqWinCh func(context.Context, *ssh.Request, *callbackData))

SetOnReqWinCh sets the onReqWinCh callback.

func (*Builder) SetOnRequest

func (b *Builder) SetOnRequest(onRequest func(context.Context, *ssh.Request, *callbackData))

SetOnRequest sets the onRequest callback.

func (*Builder) SetOnStartup

func (b *Builder) SetOnStartup(onStartup func(context.Context, *callbackData))

SetOnStartup sets the onStartup callback.

func (*Builder) SetRequests

func (b *Builder) SetRequests(requests <-chan *ssh.Request)

SetRequests sets the requests.

func (*Builder) WithChannelType

func (b *Builder) WithChannelType(channelType string) *Builder

WithChannelType sets the channel type.

type Channel

type Channel interface {
	Serve(ctx context.Context)
	Wait()
}

Channel is the interface that wraps the Serve and Wait methods.

type Handler

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

Handler handles incoming requests on a Handler.

func (*Handler) Serve

func (h *Handler) Serve(ctx context.Context)

Serve starts the server. It will block until the context is canceled or s.requests is closed.

func (*Handler) Wait

func (h *Handler) Wait()

Wait waits until serve has finished (including all goroutines started by it).

type TerminalSizeHandler

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

TerminalSizeHandler stores the Height and Width of a terminal.

func NewTerminalSizeHandler

func NewTerminalSizeHandler(cap int) *TerminalSizeHandler

NewTerminalSizeHandler creates a new Winsize.

func (*TerminalSizeHandler) Close

func (w *TerminalSizeHandler) Close()

Close closes the winsize queue and chan.

func (*TerminalSizeHandler) Fill

Fill appends the data to the queue.

func (*TerminalSizeHandler) Next

Next returns the size. The chanel must be served. Otherwise the connection will hang.

Jump to

Keyboard shortcuts

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