utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const LevelNone slog.Level = -8

Variables

This section is empty.

Functions

This section is empty.

Types

type CharacterModeTracker added in v0.7.0

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

func NewCharacterModeTracker added in v0.7.0

func NewCharacterModeTracker(t *telnet.Terminal) *CharacterModeTracker

func (*CharacterModeTracker) IsCharacterMode added in v0.7.0

func (t *CharacterModeTracker) IsCharacterMode() bool

IsCharacterMode will return true if both the ECHO and SUPPRESS-GO-AHEAD options are enabled. Technically this is supposed to be the case when NEITHER or BOTH are enabled, as traditionally, "kludge line mode", the line-at-a-time operation you might be familiar with, is supposed to occur when either ECHO or SUPPRESS-GO-AHEAD, but not both, are enabled. However, MUDs traditionally operate in a line-at-a-time manner and do not usually request SUPPRESS-GO-AHEAD (instead using IAC GA to indicate the location of a prompt to clients), resulting in a relatively common expectation that kludge line mode is active when neither telopt is active.

As a result, in order to allow the broadest support for the most clients possible, it's recommended that you activate both SUPPRESS-GO-AHEAD and EOR when you want to support line-at-a-time mode and activate both SUPPRESS-GO-AHEAD and ECHO when when you want to support character mode. If line-at-a-time is desired and EOR is not available, then leaving SUPPRESS-GO-AHEAD and ECHO both inactive and proceeding with line-at-a-time will generally work.

BBS's additionally sometimes use LINEMODE which can negotiate whether to use line or character mode in the form of the EDIT flag in MODE

func (*CharacterModeTracker) TelOptEvent added in v0.7.0

func (t *CharacterModeTracker) TelOptEvent(terminal *telnet.Terminal, data telnet.TelOptEvent)

type DebugLog

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

func NewDebugLog

func NewDebugLog(terminal *telnet.Terminal, logger *slog.Logger, config DebugLogConfig) *DebugLog

type DebugLogConfig

type DebugLogConfig struct {
	EncounteredErrorLevel  slog.Level
	IncomingCommandLevel   slog.Level
	IncomingTextLevel      slog.Level
	OutboundCommandLevel   slog.Level
	OutboundTextLevel      slog.Level
	TelOptEventLevel       slog.Level
	TelOptStageChangeLevel slog.Level
}

type KeyboardFeed

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

func NewKeyboardFeed

func NewKeyboardFeed(terminal *telnet.Terminal, input io.Reader, lineFeed *LineFeed, characterMode *CharacterModeTracker) (*KeyboardFeed, error)

func (*KeyboardFeed) FeedLoop

func (f *KeyboardFeed) FeedLoop() error

type LineFeed added in v0.4.0

type LineFeed struct {
	LineOut telnet.TerminalDataHandler
	EchoOut telnet.TerminalDataHandler
	// contains filtered or unexported fields
}

func NewLineFeed added in v0.4.0

func NewLineFeed(terminal *telnet.Terminal, lineOut, echoOut telnet.TerminalDataHandler, config LineFeedConfig) *LineFeed

func (*LineFeed) CharacterMode added in v0.4.0

func (l *LineFeed) CharacterMode() bool

func (*LineFeed) Flush added in v0.4.0

func (l *LineFeed) Flush(newline bool)

func (*LineFeed) LineIn added in v0.4.0

func (l *LineFeed) LineIn(t *telnet.Terminal, data telnet.TerminalData)

func (*LineFeed) SetCharacterMode added in v0.4.0

func (l *LineFeed) SetCharacterMode(charMode bool)

func (*LineFeed) SetSuppressLocalEcho added in v0.4.0

func (l *LineFeed) SetSuppressLocalEcho(suppress bool)

func (*LineFeed) SuppressLocalEcho added in v0.4.0

func (l *LineFeed) SuppressLocalEcho() bool

func (*LineFeed) Text added in v0.4.0

func (l *LineFeed) Text() string

type LineFeedConfig added in v0.4.0

type LineFeedConfig struct {
	MaxLength         int
	CharacterMode     bool
	SuppressLocalEcho bool
}

Jump to

Keyboard shortcuts

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