cmd

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Cfg     *config.Config
	Version string
)
View Source
var ErrFatalRegistration = fmt.Errorf("fatal registration error")

ErrFatalRegistration indicates the server permanently rejected registration (no retry)

View Source
var RootCmd = &cobra.Command{
	Use:   "elchi-client",
	Short: "Elchi Client - A gRPC client that communicates with a remote server",
	Long:  `Elchi Client, a gRPC client that securely communicates with a remote server and processes commands.`,
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "Start the client",
	Long:  `Start the client and connect to the remote server.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		logger := logger.NewLogger("main")

		return NewSessionManager(logger).Run()
	},
}

Functions

func Execute

func Execute(version string) error

Types

type ClientSession

type ClientSession struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ClientSession represents a client session with the server

func (*ClientSession) Connect

func (s *ClientSession) Connect(ctx context.Context) error

Connect establishes a connection to the server

func (*ClientSession) Shutdown

func (s *ClientSession) Shutdown(ctx context.Context)

Shutdown performs a graceful shutdown of the session

func (*ClientSession) StreamCommands

func (s *ClientSession) StreamCommands(ctx context.Context, errChan chan<- error)

StreamCommands handles the command stream from the server

func (*ClientSession) TriggerReconnect

func (s *ClientSession) TriggerReconnect()

TriggerReconnect marks the session as disconnected to trigger re-registration

type SessionManager

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

SessionManager handles the lifecycle of a client session

func NewSessionManager

func NewSessionManager(log *logger.Logger) *SessionManager

NewSessionManager creates a new session manager

func (*SessionManager) Run

func (m *SessionManager) Run() error

Run starts the client session

Jump to

Keyboard shortcuts

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