telnet

package
v0.0.0-...-9c029b6 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2017 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand

func BuildCommand(codes ...TelnetCode) []byte

func ByteToCodeString

func ByteToCodeString(b byte) string

func CodeToString

func CodeToString(code TelnetCode) string

func ToString

func ToString(bytes []byte) string

Types

type Telnet

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

Telnet wraps the given connection object, processing telnet codes from its byte stream and interpreting them as necessary, making it possible to hand the connection object off to other code so that it doesn't have to worry about telnet escape sequences being found in its data.

func NewTelnet

func NewTelnet(conn net.Conn) *Telnet

func (*Telnet) Close

func (t *Telnet) Close() error

func (*Telnet) Data

func (t *Telnet) Data(code TelnetCode) []byte

func (*Telnet) DoTerminalType

func (t *Telnet) DoTerminalType()

func (*Telnet) DoWindowSize

func (t *Telnet) DoWindowSize()

func (*Telnet) Listen

func (t *Telnet) Listen(listenFunc func(TelnetCode, []byte))

func (*Telnet) LocalAddr

func (t *Telnet) LocalAddr() net.Addr

func (*Telnet) Read

func (t *Telnet) Read(p []byte) (int, error)

func (*Telnet) RemoteAddr

func (t *Telnet) RemoteAddr() net.Addr

func (*Telnet) SendCommand

func (t *Telnet) SendCommand(codes ...TelnetCode)

func (*Telnet) SetDeadline

func (t *Telnet) SetDeadline(dl time.Time) error

func (*Telnet) SetReadDeadline

func (t *Telnet) SetReadDeadline(dl time.Time) error

func (*Telnet) SetWriteDeadline

func (t *Telnet) SetWriteDeadline(dl time.Time) error

func (*Telnet) WillEcho

func (t *Telnet) WillEcho()

func (*Telnet) WontEcho

func (t *Telnet) WontEcho()

func (*Telnet) Write

func (t *Telnet) Write(p []byte) (int, error)

type TelnetCode

type TelnetCode int
const (
	NUL  TelnetCode = iota // NULL, no operation
	ECHO TelnetCode = iota // Echo
	SGA  TelnetCode = iota // Suppress go ahead
	ST   TelnetCode = iota // Status
	TM   TelnetCode = iota // Timing mark
	BEL  TelnetCode = iota // Bell
	BS   TelnetCode = iota // Backspace
	HT   TelnetCode = iota // Horizontal tab
	LF   TelnetCode = iota // Line feed
	FF   TelnetCode = iota // Form feed
	CR   TelnetCode = iota // Carriage return
	TT   TelnetCode = iota // Terminal type
	WS   TelnetCode = iota // Window size
	TS   TelnetCode = iota // Terminal speed
	RFC  TelnetCode = iota // Remote flow control
	LM   TelnetCode = iota // Line mode
	EV   TelnetCode = iota // Environment variables
	SE   TelnetCode = iota // End of subnegotiation parameters.
	NOP  TelnetCode = iota // No operation.
	DM   TelnetCode = iota // Data Mark. The data stream portion of a Synch. This should always be accompanied by a TCP Urgent notification.
	BRK  TelnetCode = iota // Break. NVT character BRK.
	IP   TelnetCode = iota // Interrupt Process
	AO   TelnetCode = iota // Abort output
	AYT  TelnetCode = iota // Are you there
	EC   TelnetCode = iota // Erase character
	EL   TelnetCode = iota // Erase line
	GA   TelnetCode = iota // Go ahead signal
	SB   TelnetCode = iota // Indicates that what follows is subnegotiation of the indicated option.
	WILL TelnetCode = iota // Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option.
	WONT TelnetCode = iota // Indicates the refusal to perform, or continue performing, the indicated option.
	DO   TelnetCode = iota // Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option.
	DONT TelnetCode = iota // 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.
	IAC  TelnetCode = iota // Interpret as command

	// Non-standard codes:
	CMP1 TelnetCode = iota // MCCP Compress
	CMP2 TelnetCode = iota // MCCP Compress2
	AARD TelnetCode = iota // Aardwolf MUD out of band communication, http://www.aardwolf.com/blog/2008/07/10/telnet-negotiation-control-mud-client-interaction/
	ATCP TelnetCode = iota // Achaea Telnet Client Protocol, http://www.ironrealms.com/rapture/manual/files/FeatATCP-txt.html
	GMCP TelnetCode = iota // Generic Mud Communication Protocol
)

Jump to

Keyboard shortcuts

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