shell

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCommandNotFound = ": command not found\n"
	DefaultExitCommand     = "exit"
	DefaultExitMessage     = "Goodbye!\r\n"
	DefaultPrompt          = "$ "
	DefaultWelcomeMessage  = "\r\nWelcome!\r\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler func(session *telnet.Session) bool

func NewAuthHandler

func NewAuthHandler(username string, password string, maxAttempts int) AuthHandler

NewAuthHandler returns an AuthHandler with the given configuration.

type Command

type Command struct {
	Regex    string
	Response string
}

type Handler

type Handler func(command string) string

type Server

type Server struct {
	// AuthHandler handles authentication attempts against the server.
	AuthHandler AuthHandler

	// GenericHandler can be used as a fallback if no matching command is found within Commands.
	GenericHandler Handler

	// Version is the server version sent to the client after the initial connection.
	Version string

	// Commands contains the available regex matching commands.
	Commands []Command
}

func (*Server) HandlerFunc

func (s *Server) HandlerFunc(session *telnet.Session)

Jump to

Keyboard shortcuts

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