term

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ASCII_BACKSPACE = 8
View Source
const ASCII_CR = 13
View Source
const ASCII_DELETE = 127
View Source
const ASCII_LF = 10
View Source
const ASCII_NULL = 0
View Source
const ASCII_SPACE = 32
View Source
const ASCII_TAB = 9

Variables

View Source
var (
	ANSI_ESC  byte = 27 // \033
	ANSI_BEEP byte = 7  // When sent to client, causes beep (or windows chime, or whatever)
)
View Source
var (
	MspEnable  = TerminalCommand{[]byte{TELNET_IAC, TELNET_WILL, MSP}, []byte{}} // Indicates the server wants to enable MSP.
	MspDisable = TerminalCommand{[]byte{TELNET_IAC, TELNET_WONT, MSP}, []byte{}} // Indicates the server wants to disable MSP.

	MspAccept = TerminalCommand{[]byte{TELNET_IAC, TELNET_DO, MSP}, []byte{}}   // Indicates the client accepts MSP
	MspRefuse = TerminalCommand{[]byte{TELNET_IAC, TELNET_DONT, MSP}, []byte{}} // Indicates the client refuses MSP

	MspCommand = TerminalCommand{[]byte{TELNET_IAC, TELNET_SB, MSP}, []byte{TELNET_IAC, TELNET_SE}} // Send via TELNET MSP Command
)
View Source
var (
	CRLF    = []byte{13, 10}
	CRLFStr = string(CRLF)

	BELL    = []byte{13, 7} // may beep, may flash the window, may bounce from the bar on macos
	BELLStr = string(BELL)

	///////////////////////////
	// Useful sequences
	///////////////////////////
	// Move cursor back, print a space, move cursor back again.
	BACKSPACE_SEQUENCE = []byte{ASCII_BACKSPACE, ASCII_SPACE, ASCII_BACKSPACE}

	// // Request resolution from the client
	TelnetScreenSizeRequest = TerminalCommand{[]byte{TELNET_IAC, TELNET_DO, TELNET_OPT_NAWS}, []byte{}}
	// // Client response with their resolution
	TelnetScreenSizeResponse = TerminalCommand{[]byte{TELNET_IAC, TELNET_SB, TELNET_OPT_NAWS}, []byte{}}

	//
	// GENERAL SETUP
	//
	// // Do/Don't Suppress Go Ahead
	TelnetSuppressGoAhead     = TerminalCommand{[]byte{TELNET_IAC, TELNET_WILL, TELNET_OPT_SUP_GO_AHD}, []byte{}}
	TelnetDontSuppressGoAhead = TerminalCommand{[]byte{TELNET_IAC, TELNET_DONT, TELNET_OPT_SUP_GO_AHD}, []byte{}}
	// // Echo On
	TelnetEchoOn = TerminalCommand{[]byte{TELNET_IAC, TELNET_WILL, TELNET_OPT_ECHO}, []byte{}}
	// // Echo Off
	TelnetEchoOff = TerminalCommand{[]byte{TELNET_IAC, TELNET_WONT, TELNET_OPT_ECHO}, []byte{}}
	// // Line Mode Off
	TelnetLineModeOff = TerminalCommand{[]byte{TELNET_IAC, TELNET_WONT, TELNET_OPT_LINE_MODE}, []byte{}}

	//
	// Handshake example:
	// Server (TelnetRequestChangeCharset)	-> Client
	// Server 								<- (TelnetAgreeChangeCharset) Client
	// Server (TelnetCharset)				-> Client
	// Server								<- (TelnetAcceptedChangeCharset) Client
	//
	// Indicate wish to change charset
	TelnetRequestChangeCharset = TerminalCommand{[]byte{TELNET_IAC, TELNET_WILL, TELNET_OPT_CHARSET}, []byte{}}
	// Client agreed to accept a change
	TelnetAgreeChangeCharset = TerminalCommand{[]byte{TELNET_IAC, TELNET_DO, TELNET_OPT_CHARSET}, []byte{}}
	// Send actual charset change
	// Can separate with a space multiple charsets:
	// " UTF-8 ISO-8859-1"
	TelnetCharset = TerminalCommand{[]byte{TELNET_IAC, TELNET_SB, TELNET_OPT_CHARSET, 1}, []byte{TELNET_IAC, TELNET_SE}}
	// Client accepted change
	TelnetAcceptedChangeCharset = TerminalCommand{[]byte{TELNET_IAC, TELNET_SB, 2}, []byte{TELNET_IAC, TELNET_SE}}
	// Client rejectected change
	TelnetRejectedChangeCharset = TerminalCommand{[]byte{TELNET_IAC, TELNET_SB, 3, TELNET_IAC, TELNET_SE}, []byte{}}
	// Go Ahead
	TelnetGoAhead = TerminalCommand{[]byte{TELNET_IAC, TELNET_GA}, []byte{}}

	// Did they hit the escape key?
	AnsiEscapeKey = TerminalCommand{[]byte{ANSI_ESC}, []byte{}}

	// 4-bit color - Can contain fg, bg, bold, etc.
	AnsiColor4Bit = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'m'}}
	// 8 Bit color
	AnsiColor8BitFG = TerminalCommand{[]byte{ANSI_ESC, '[', '3', '8', ';', '5', ';'}, []byte{'m'}}
	AnsiColor8BitBG = TerminalCommand{[]byte{ANSI_ESC, '[', '4', '8', ';', '5', ';'}, []byte{'m'}}
	// 24 Bit color - RGB
	AnsiColor24BitFG = TerminalCommand{[]byte{ANSI_ESC, '[', '3', '8', ';', '2', ';'}, []byte{'m'}}
	AnsiColor24BitBG = TerminalCommand{[]byte{ANSI_ESC, '[', '4', '8', ';', '2', ';'}, []byte{'m'}}
	// Reset colors back to client default
	AnsiColorReset = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'0', 'm'}}
	// Enable alternative screen buffer
	AnsiAltModeStart = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'?', '1', '0', '4', '9', 'h'}}
	// Disable alternative screen buffer
	AnsiAltModeEnd = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'?', '1', '0', '4', '9', 'l'}}
	// Hide Cursor
	AnsiCursorHide = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'?', '2', '5', 'l'}} // DECTCEM
	// Show Cursor
	AnsiCursorShow = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'?', '2', '5', 'h'}} // DECTCEM
	// Clear from cursor to end of screen
	AnsiClearForward = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'0', 'J'}}
	// Clear from cursor to beginning of screen
	AnsiClearBack = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', 'J'}}
	// Clear Scrollback
	AnsiClearScreen = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', 'J'}}
	// Clear Screen and scrollback Buffer
	AnsiScreenAndScrollbackClear = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'3', 'J'}}
	// Clear from the cursor to the end of the line
	AnsiEraseLineForward = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'0', 'K'}}
	// Clear from the cursor to the start of the line
	AnsiEraseLineBackward = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', 'K'}}
	// Clear enter line
	AnsiEraseLine = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', 'K'}}
	// Hide Text
	AnsiTextHide = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'8', 'm'}}
	// Show Text
	AnsiTextShow = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', '8', 'm'}}

	AnsiReportMouseClick      = TerminalCommand{[]byte{ANSI_ESC, '[', '?', '1', '0', '0', '2', 'h'}, []byte{ANSI_ESC, '[', '?', '1', '0', '0', '6', 'h'}}
	AnsiSaveCursorPosition    = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'s'}}
	AnsiRestoreCursorPosition = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'u'}}
	AnsiRequestCursorPosition = TerminalCommand{[]byte{ANSI_ESC, '[', '6'}, []byte{'n'}}
	AnsiCharSetUTF8           = TerminalCommand{[]byte{ANSI_ESC, '%'}, []byte{'G'}}
	// Client is reporting a mouse click
	// ESC [  <  0  ;  1  ;  1  m
	// [27 91 60 48 59 49 59 49 109]
	// ESC [  <  0  ;  1  4  0  ;  4  8  m
	// [27 91 60 48 59 49 52 48 59 52 56 109]
	AnsiClientMouseDown = TerminalCommand{[]byte{ANSI_ESC, '[', '<', '0', ';'}, []byte{'M'}}
	AnsiClientMouseUp   = TerminalCommand{[]byte{ANSI_ESC, '[', '<', '0', ';'}, []byte{'m'}}
	// To request the client terminal dimensions (hacky way):
	// 1. Save the cursor position
	// 2. Move the cursor to the bottom right corner
	// 3. Request the cursor position
	// 4. Restore the cursor position
	AnsiRequestResolution = TerminalCommand{[]byte(AnsiSaveCursorPosition.String() + AnsiMoveCursorBottomRight.String() + AnsiRequestCursorPosition.String() + AnsiRestoreCursorPosition.String()), []byte{}}
	// Client is reporting screen size
	// Looks like: ESC [  40 ; 80  R
	AnsiClientScreenSize = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'R'}}
	// Move the cursor - any number after '[' is how many spaces to move
	AnsiMoveCursor         = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'H'}}
	AnsiMoveCursorUp       = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'A'}}
	AnsiMoveCursorDown     = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'B'}}
	AnsiMoveCursorForward  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'C'}}
	AnsiMoveCursorBackward = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'D'}}
	// Move the cursor to a specific column - any number after '[' is column. Default 1.
	AnsiMoveCursorColumn = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'G'}}

	AnsiMoveCursorBottomRight = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'9', '9', '9', ';', '9', '9', '9', 'H'}}
	AnsiMoveCursorTopLeft     = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', ';', '1', 'H'}}
	// \033[<65;9(xPos);19(yPos)M
	AnsiMouseWheelUp   = TerminalCommand{[]byte{ANSI_ESC, '[', '<', '6', '5', ';'}, []byte{'M'}}
	AnsiMouseWheelDown = TerminalCommand{[]byte{ANSI_ESC, '[', '<', '6', '4', ';'}, []byte{'M'}}

	AnsiF1  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '1', '~'}} // Putty sends this
	AnsiF2  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '2', '~'}} // Putty sends this
	AnsiF3  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '3', '~'}} // Putty sends this
	AnsiF4  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '4', '~'}} // Putty sends this
	AnsiF5  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '5', '~'}} // Putty sends this
	AnsiF6  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '7', '~'}} // Putty sends this
	AnsiF7  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '8', '~'}} // Putty sends this
	AnsiF8  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'1', '9', '~'}} // Putty sends this
	AnsiF9  = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', '0', '~'}} // Putty sends this
	AnsiF10 = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', '1', '~'}} // Putty sends this
	AnsiF11 = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', '3', '~'}} // Putty sends this
	AnsiF12 = TerminalCommand{[]byte{ANSI_ESC, '['}, []byte{'2', '4', '~'}} // Putty sends this
	AnsiF1b = TerminalCommand{[]byte{ANSI_ESC, 'O'}, []byte{'P'}}           // macos terminal telnet
	AnsiF2b = TerminalCommand{[]byte{ANSI_ESC, 'O'}, []byte{'Q'}}           // macos terminal telnet
	AnsiF3b = TerminalCommand{[]byte{ANSI_ESC, 'O'}, []byte{'R'}}           // macos terminal telnet
	AnsiF4b = TerminalCommand{[]byte{ANSI_ESC, 'O'}, []byte{'S'}}           // macos terminal telnet

	// Payload is the window title to set it to
	AnsiSetWindowTitle = TerminalCommand{[]byte{ANSI_ESC, ']', '2', ';'}, []byte{'S', 'T'}}

	// Payload is frequency in Hz
	AnsiSetBellFrequency = TerminalCommand{[]byte{ANSI_ESC, '[', '1', '0', ';'}, []byte{']'}}
	// Payload is bell duration in msec
	AnsiSetBellDuration = TerminalCommand{[]byte{ANSI_ESC, '[', '1', '1', ';'}, []byte{']'}}
)

Functions

func AnsiCommandToString

func AnsiCommandToString(cmdBytes []byte) string

func AnsiParseMouseClickPayload

func AnsiParseMouseClickPayload(info []byte) (xPos int, yPos int, err error)

ESC [ < 0 ; 1 ; 1 m [27 91 60 48 59 49 59 49 109] ESC [ < 0 ; 1 4 0 ; 4 8 m [27 91 60 48 59 49 52 48 59 52 56 109]

func AnsiParseMouseWheelScroll

func AnsiParseMouseWheelScroll(info []byte) (xPos int, yPos int, err error)

func AnsiParseScreenSizePayload

func AnsiParseScreenSizePayload(info []byte) (width int, height int, err error)

func BytesString

func BytesString(cmdBytes []byte) string

func IsAnsiCommand

func IsAnsiCommand(b []byte) bool

func IsMSPCommand

func IsMSPCommand(b []byte) bool

func IsTelnetCommand

func IsTelnetCommand(b []byte) bool

func Matches

func Matches(input []byte, cmd TerminalCommand) (ok bool, payload []byte)

func TelnetCommandToString

func TelnetCommandToString(cmdBytes []byte) string

func TelnetParseScreenSizePayload

func TelnetParseScreenSizePayload(info []byte) (width int, height int, err error)

Types

type ANSIByte

type ANSIByte = byte

type IACByte

type IACByte = byte
const (
	TELNET_IAC  IACByte = 255 // Interpret as command
	TELNET_DONT IACByte = 254 // Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.
	TELNET_DO   IACByte = 253 // Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option.
	TELNET_WONT IACByte = 252 // Indicates the refusal to perform, or continue performing, the indicated option.
	TELNET_WILL IACByte = 251 // Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option.
	TELNET_SB   IACByte = 250 // Subnegotiation of the indicated option follows.
	TELNET_GA   IACByte = 249 // Go ahead. Used, under certain circumstances, to tell the other end that it can transmit.
	TELNET_EL   IACByte = 248 // Erase line. Delete characters from the data stream back to but not including the previous CRLF.
	TELNET_EC   IACByte = 247 // Erase character. The receiver should delete the last preceding undeleted character from the data stream.
	TELNET_AYT  IACByte = 246 // Are you there. Send back to the NVT some visible evidence that the AYT was received.
	TELNET_AO   IACByte = 245 // Abort output. Allows the current process to run to completion but do not send its output to the user.
	TELNET_IP   IACByte = 244 // Suspend, interrupt or abort the process to which the NVT is connected.
	TELNET_BRK  IACByte = 243 // Break. Indicates that the "break" or "attention" key was hit.
	TELNET_DM   IACByte = 242 // Data mark. Indicates the position of a Synch event within the data stream. This should always be accompanied by a TCP urgent notification.
	TELNET_NOP  IACByte = 241 // No operation
	TELNET_SE   IACByte = 240 // End of subnegotiation parameters

	// Common...
	TELNET_OPT_TXBIN      IACByte = 0  // Transmit Binary													RFC: http://pcmicro.com/netfoss/RFC856.html
	TELNET_OPT_ECHO       IACByte = 1  // Echo																RFC: http://pcmicro.com/netfoss/RFC857.html
	TELNET_OPT_SUP_GO_AHD IACByte = 3  // Suppress Go Ahead													RFC: http://pcmicro.com/netfoss/RFC858.html
	TELNET_OPT_STAT       IACByte = 5  // Status															RFC: http://pcmicro.com/netfoss/RFC859.html
	TELNET_OPT_TMARK      IACByte = 6  // Timing Mark														RFC: http://pcmicro.com/netfoss/RFC860.html
	TELNET_OPT_TERM_TYPE  IACByte = 24 // Terminal Type														RFC: https://www.ietf.org/rfc/rfc1091.txt
	TELNET_OPT_NAWS       IACByte = 31 // NAWS, Negotiate About Window Size.								RFC: https://www.ietf.org/rfc/rfc1073.txt
	TELNET_OPT_TERM_SPD   IACByte = 32 // Terminal Speed													RFC: https://www.ietf.org/rfc/rfc1079.txt
	TELNET_OPT_RMT_FC     IACByte = 33 // Remote Flow Control												RFC: https://www.ietf.org/rfc/rfc1372.txt
	TELNET_OPT_LINE_MODE  IACByte = 34 // Linemode															RFC: https://www.ietf.org/rfc/rfc1184.txt
	TELNET_OPT_ENV        IACByte = 36 // Environment														RFC: https://www.ietf.org/rfc/rfc1408.txt
	// Uncommon...
	TELNET_OPT_RECONN            IACByte = 2  // Reconnection												RFC:
	TELNET_OPT_APRXMSGSZ         IACByte = 4  // Approx Message Size Negotiation.							RFC:
	TELNET_OPT_RMT_TRANSECHO     IACByte = 7  // Remote Controlled Trans and Echo							RFC: https://www.ietf.org/rfc/rfc563.txt : https://www.ietf.org/rfc/rfc726.txt
	TELNET_OPT_OUTPUT_LW         IACByte = 8  // Output Line Width											RFC:
	TELNET_OPT_OUTPUT_PGSZ       IACByte = 9  // Output Page Size											RFC:
	TELNET_OPT_NEG_CR            IACByte = 10 // Negotiate About Output Carriage-Return Disposition			RFC: https://www.ietf.org/rfc/rfc652.txt
	TELNET_OPT_NEG_HTAB_STOP     IACByte = 11 // Negotiate About Output Horizontal Tabstops					RFC: https://www.ietf.org/rfc/rfc653.txt
	TELNET_OPT_NEG_HTAB_DISP     IACByte = 12 // NAOHTD, Negotiate About Output Horizontal Tab Disposition	RFC: https://www.ietf.org/rfc/rfc654.txt
	TELNET_OPT_NEG_FF_DISP       IACByte = 13 // Negotiate About Output Formfeed Disposition				RFC: https://www.ietf.org/rfc/rfc655.txt
	TELNET_OPT_NEG_VTAB_STOP     IACByte = 14 // Negotiate About Vertical Tabstops							RFC: https://www.ietf.org/rfc/rfc656.txt
	TELNET_OPT_NEG_VTAB_DISP     IACByte = 15 // Negotiate About Output Vertcial Tab Disposition			RFC: https://www.ietf.org/rfc/rfc657.txt
	TELNET_OPT_NEG_LF_DISP       IACByte = 16 // Negotiate About Output Linefeed Disposition				RFC: https://www.ietf.org/rfc/rfc658.txt
	TELNET_OPT_EXT_ASCII         IACByte = 17 // Extended ASCII.											RFC: https://www.ietf.org/rfc/rfc698.txt
	TELNET_OPT_LOGOUT            IACByte = 18 // Logout.													RFC: https://www.ietf.org/rfc/rfc727.txt
	TELNET_OPT_BYTE_MACRO        IACByte = 19 // Byte Macro													RFC: https://www.ietf.org/rfc/rfc735.txt
	TELNET_OPT_DATAENTRY_TERM    IACByte = 20 // Data Entry Terminal										RFC: https://www.ietf.org/rfc/rfc732.txt : https://www.ietf.org/rfc/rfc1043.txt
	TELNET_OPT_SUPDUP            IACByte = 21 // SUPDUP														RFC: https://www.ietf.org/rfc/rfc734.txt : https://www.ietf.org/rfc/rfc736.txt
	TELNET_OPT_SUPDUP_OUT        IACByte = 22 // SUPDUP Output												RFC: https://www.ietf.org/rfc/rfc749.txt
	TELNET_OPT_SEND_LOC          IACByte = 23 // Send Location												RFC: https://www.ietf.org/rfc/rfc779.txt
	TELNET_OPT_EOR               IACByte = 25 // End of Record												RFC: https://www.ietf.org/rfc/rfc885.txt
	TELNET_OPT_TACACS_USER_ID    IACByte = 26 // TACACS User Identification									RFC: https://www.ietf.org/rfc/rfc927.txt
	TELNET_OPT_OUTPUT_MARK       IACByte = 27 // Output Marking												RFC: https://www.ietf.org/rfc/rfc933.txt
	TELNET_OPT_TTYLOC            IACByte = 28 // TTYLOC, Terminal Location Number.							RFC: https://www.ietf.org/rfc/rfc946.txt
	TELNET_OPT_3270_REGIME       IACByte = 29 // Telnet 3270 Regime											RFC: https://www.ietf.org/rfc/rfc1041.txt
	TELNET_OPT_X3_PAD            IACByte = 30 // X.3 PAD.													RFC: https://www.ietf.org/rfc/rfc1053.txt
	TELNET_OPT_X_DISP_LOC        IACByte = 35 // X Display Location.										RFC: https://www.ietf.org/rfc/rfc1096.txt
	TELNET_OPT_AUTH              IACByte = 37 // Authentication												RFC: https://www.ietf.org/rfc/rfc1416.txt | https://www.ietf.org/rfc/rfc2941.txt | https://www.ietf.org/rfc/rfc2942.txt | https://www.ietf.org/rfc/rfc2943.txt | https://www.ietf.org/rfc/rfc2951.txt
	TELNET_OPT_CRYPT             IACByte = 38 // Encryption Option											RFC: https://www.ietf.org/rfc/rfc2946.txt
	TELNET_OPT_NEW_ENV           IACByte = 39 // New Environment											RFC: https://www.ietf.org/rfc/rfc1572.txt
	TELNET_OPT_TN3270E           IACByte = 40 // TN3270E													RFC: https://www.ietf.org/rfc/rfc2355.txt
	TELNET_OPT_XAUTH             IACByte = 41 // XAUTH														RFC:
	TELNET_OPT_CHARSET           IACByte = 42 // CHARSET													RFC: https://www.ietf.org/rfc/rfc2066.txt
	TELNET_OPT_RSP               IACByte = 43 // RSP, Telnet Remote Serial Port								RFC:
	TELNET_OPT_COM_PORT          IACByte = 44 // Com Port Control											RFC: https://www.ietf.org/rfc/rfc2217.txt
	TELNET_OPT_SUPPRESS_LOC_ECHO IACByte = 45 // Telnet Suppress Local Echo									RFC:
	TELNET_OPT_START_TLS         IACByte = 46 // Telnet Start TLS											RFC:
	TELNET_OPT_KERMIT            IACByte = 47 // KERMIT														RFC: https://www.ietf.org/rfc/rfc2840.txt
	TELNET_OPT_SEND_URL          IACByte = 48 // SEND-URL													RFC:
	TELNET_OPT_FORWARD_X         IACByte = 49 // FORWARD_X													RFC:
	TELNET_OPT_137               IACByte = 137
	TELNET_OPT_PRAGMA_LOGON      IACByte = 138 // TELOPT PRAGMA LOGON										RFC:
	TELNET_OPT_SSPI_LOGON        IACByte = 139 // TELOPT SSPI LOGON											RFC:
	TELNET_OPT_PRAGMA_HEARTBEAT  IACByte = 140 // TELOPT PRAGMA HEARTBEAT									RFC:
	TELNET_OPT_254               IACByte = 254
	TELNET_OPT_EXTENDED_OPT      IACByte = 255 // Extended-Options-List										RFC: https://www.ietf.org/rfc/rfc861.txt
)

func TelnetDO

func TelnetDO(what IACByte) []IACByte

func TelnetDONT

func TelnetDONT(what IACByte) []IACByte

func TelnetWILL

func TelnetWILL(what IACByte) []IACByte

https://users.cs.cf.ac.uk/Dave.Marshall/Internet/node142.html TelnetWILL(TELNET_OPT_SUP_GO_AHD) + TelnetWill(TELNET_OPT_ECHO) + TelnetWONT(TELNET_OPT_LINE_MODE)

func TelnetWONT

func TelnetWONT(what IACByte) []IACByte

type TerminalCommand

type TerminalCommand struct {
	Chars    []byte
	EndChars []byte
}

func (*TerminalCommand) BytesWithPayload

func (cmd *TerminalCommand) BytesWithPayload(payload []byte) []byte

func (*TerminalCommand) DebugString

func (c *TerminalCommand) DebugString() string

func (*TerminalCommand) ExtractBody

func (cmd *TerminalCommand) ExtractBody(input []byte) []byte

func (*TerminalCommand) String

func (c *TerminalCommand) String() string

func (*TerminalCommand) StringWithPayload

func (c *TerminalCommand) StringWithPayload(payload string) string

type TerminalCommandPayloadParser

type TerminalCommandPayloadParser func(b []byte) []byte

Jump to

Keyboard shortcuts

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