session

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package session starts the session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISession

type ISession interface {
	ISessionSubTypeSupport
	ISessionTypeSupport
	OpenDataChannel(ctx context.Context) (string, error)
}

ISession defines the interface for session operations.

type ISessionPlugin

type ISessionPlugin interface {
	SetSessionHandlers(ctx context.Context) error
	ProcessStreamMessagePayload(streamDataMessage message.ClientMessage) (isHandlerReady bool, err error)
	Stop() error
	Name() string
}

ISessionPlugin defines the interface for session type implementations.

type ISessionSubTypeSupport

type ISessionSubTypeSupport interface {
	SendFlag(flagType message.PayloadTypeFlag) error
	SendInputDataMessage(payloadType message.PayloadType, inputData []byte) error
	GetAgentVersion() string
	TerminateSession(ctx context.Context) error
	GetTargetID() string
	GetSessionID() string
}

ISessionSubTypeSupport defines the interface for session plugin support operations.

type ISessionSupport

type ISessionSupport interface {
	ISessionTypeSupport
	ISessionSubTypeSupport
}

ISessionSupport defines the interface for session support. It combines the functionalities of ISessionTypeSupport and ISessionSubTypeSupport.

type ISessionTypeSupport

type ISessionTypeSupport interface {
	GetAgentVersion() string
	GetSessionID() string
	GetSessionProperties() any
	RegisterOutputStreamHandler(handler datachannel.OutputStreamDataMessageHandler, isSessionSpecificHandler bool)
	RegisterIncomingMessageHandler(handler datachannel.IncomingMessageHandler)
	RegisterStopHandler(handler datachannel.StopHandler)
	DisplayMessage(message message.ClientMessage)
	SendInputDataMessage(payloadType message.PayloadType, inputData []byte) error
	Close() error
}

ISessionTypeSupport is an interface that defines the methods for session type support.

type Session

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

Session represents an active session with its configuration and state.

func NewSession

func NewSession(ssmClient *ssm.Client, dataChannel datachannel.IDataChannel, sessionID string, logger log.T) (*Session, error)

NewSession creates a new session instance with the provided parameters.

func (*Session) Close

func (s *Session) Close() error

Close closes the data channel.

func (*Session) DisplayMessage

func (s *Session) DisplayMessage(message message.ClientMessage)

DisplayMessage displays a message to the user.

func (*Session) GetAgentVersion

func (s *Session) GetAgentVersion() string

GetAgentVersion retrieves the agent version from the data channel.

func (*Session) GetSessionID

func (s *Session) GetSessionID() string

GetSessionID retrieves the session ID from the session.

func (*Session) GetSessionProperties

func (s *Session) GetSessionProperties() any

GetSessionProperties retrieves the session properties from the session.

func (*Session) GetTargetID

func (s *Session) GetTargetID() string

GetTargetID retrieves the target ID from the session.

func (*Session) OpenDataChannel

func (s *Session) OpenDataChannel(ctx context.Context) (string, error)

OpenDataChannel initializes datachannel.

func (*Session) RegisterIncomingMessageHandler added in v0.2.0

func (s *Session) RegisterIncomingMessageHandler(handler datachannel.IncomingMessageHandler)

RegisterIncomingMessageHandler sets the message handler for the DataChannel.

func (*Session) RegisterOutputStreamHandler

func (s *Session) RegisterOutputStreamHandler(handler datachannel.OutputStreamDataMessageHandler, sessionSpecific bool)

RegisterOutputStreamHandler registers a handler for output stream messages.

func (*Session) RegisterStopHandler added in v0.2.0

func (s *Session) RegisterStopHandler(handler datachannel.StopHandler)

RegisterStopHandler sets the message handler for the DataChannel.

func (*Session) SendFlag

func (s *Session) SendFlag(flagType message.PayloadTypeFlag) error

SendFlag sends a flag message through the data channel.

func (*Session) SendInputDataMessage

func (s *Session) SendInputDataMessage(payloadType message.PayloadType, inputData []byte) error

SendInputDataMessage sends input data messages through the data channel.

func (*Session) TerminateSession

func (s *Session) TerminateSession(ctx context.Context) error

TerminateSession calls TerminateSession API.

Directories

Path Synopsis
Package portsession starts port session.
Package portsession starts port session.
Package sessionutil contains utility methods required to start session.
Package sessionutil contains utility methods required to start session.
Package shellsession starts shell session.
Package shellsession starts shell session.

Jump to

Keyboard shortcuts

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