telnetlib

package
v0.0.0-...-d66a22c Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_DELAY_AFTER_WRITE = 300 * time.Millisecond

	// Telnet protocol characters (don't change)
	IAC  = byte(255) // "Interpret As Command"
	DONT = byte(254)
	DO   = byte(253)
	WONT = byte(252)
	WILL = byte(251)
	SB   = byte(250) // Subnegotiation Begin
	SE   = byte(240) // Subnegotiation End

	NULL  = byte(0)
	EOF   = byte(236) // Document End
	SUSP  = byte(237) // Subnegotiation End
	ABORT = byte(238) // Process Stop
	REOR  = byte(239) // Record End
	NOP   = byte(241) // No Operation
	DM    = byte(242) // Data Mark
	BRK   = byte(243) // Break
	IP    = byte(244) // Interrupt process
	AO    = byte(245) // Abort output
	AYT   = byte(246) // Are You There
	EC    = byte(247) // Erase Character
	EL    = byte(248) // Erase Line
	GA    = byte(249) // Go Ahead

	// Telnet protocol options code (don't change)
	// These ones all come from arpa/telnet.h
	BINARY         = byte(0)  // 8-bit data path
	ECHO           = byte(1)  // echo
	RCP            = byte(2)  // prepare to reconnect
	SGA            = byte(3)  // suppress go ahead
	NAMS           = byte(4)  // approximate message size
	STATUS         = byte(5)  // give status
	TM             = byte(6)  // timing mark
	RCTE           = byte(7)  // remote controlled transmission and echo
	NAOL           = byte(8)  // negotiate about output line width
	NAOP           = byte(9)  // negotiate about output page size
	NAOCRD         = byte(10) // negotiate about CR disposition
	NAOHTS         = byte(11) // negotiate about horizontal tabstops
	NAOHTD         = byte(12) // negotiate about horizontal tab disposition
	NAOFFD         = byte(13) // negotiate about formfeed disposition
	NAOVTS         = byte(14) // negotiate about vertical tab stops
	NAOVTD         = byte(15) // negotiate about vertical tab disposition
	NAOLFD         = byte(16) // negotiate about output LF disposition
	XASCII         = byte(17) // extended ascii character set
	LOGOUT         = byte(18) // force logout
	BM             = byte(19) // byte macro
	DET            = byte(20) // data entry terminal
	SUPDUP         = byte(21) // supdup protocol
	SUPDUPOUTPUT   = byte(22) // supdup output
	SNDLOC         = byte(23) // send location
	TTYPE          = byte(24) // terminal type
	EOR            = byte(25) // end or record
	TUID           = byte(26) // TACACS user identification
	OUTMRK         = byte(27) // output marking
	TTYLOC         = byte(28) // terminal location number
	VT3270REGIME   = byte(29) // 3270 regime
	X3PAD          = byte(30) // X.3 PAD
	NAWS           = byte(31) // window size
	TSPEED         = byte(32) // terminal speed
	LFLOW          = byte(33) // remote flow control
	LINEMODE       = byte(34) // Linemode option
	XDISPLOC       = byte(35) // X Display Location
	OLD_ENVIRON    = byte(36) // Old - Environment variables
	AUTHENTICATION = byte(37) // Authenticate
	ENCRYPT        = byte(38) // Encryption option
	NEW_ENVIRON    = byte(39) // New - Environment variables
	// the following ones come from
	// http://www.iana.org/assignments/telnet-options
	// Unfortunately, that document does not assign identifiers
	// to all of them, so we are making them up
	TN3270E             = byte(40)  // TN3270E
	XAUTH               = byte(41)  // XAUTH
	CHARSET             = byte(42)  // CHARSET
	RSP                 = byte(43)  // Telnet Remote Serial Port
	COM_PORT_OPTION     = byte(44)  // Com Port Control Option
	SUPPRESS_LOCAL_ECHO = byte(45)  // Telnet Suppress Local Echo
	TLS                 = byte(46)  // Telnet Start TLS
	KERMIT              = byte(47)  // KERMIT
	SEND_URL            = byte(48)  // SEND-URL
	FORWARD_X           = byte(49)  // FORWARD_X
	PRAGMA_LOGON        = byte(138) // TELOPT PRAGMA LOGON
	SSPI_LOGON          = byte(139) // TELOPT SSPI LOGON
	PRAGMA_HEARTBEAT    = byte(140) // TELOPT PRAGMA HEARTBEAT
	EXOPL               = byte(255) // Extended-Options-List
	NOOPT               = byte(0)
)
View Source
const (
	Closed = iota
	UnauthorizedAccess
	OnlyPassword
	UsernameAndPassword
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	IPAddr   string
	Port     int
	UserName string
	Password string

	LastResponse string
	ServerType   int
	// contains filtered or unexported fields
}

func New

func New(addr string, port int) *Client

func (*Client) Clear

func (c *Client) Clear()

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Login

func (c *Client) Login() error

func (*Client) MakeReply

func (c *Client) MakeReply(command []byte) []byte

func (*Client) MakeReplyFromList

func (c *Client) MakeReplyFromList(list [][]byte) []byte

func (*Client) MakeServerType

func (c *Client) MakeServerType() int

func (*Client) Netloc

func (c *Client) Netloc() string

func (*Client) ReadContext

func (c *Client) ReadContext() string

func (*Client) SerializationResponse

func (c *Client) SerializationResponse(responseBuf []byte) (displayBuf []byte, commandList [][]byte)

func (*Client) WriteContext

func (c *Client) WriteContext(s string)

Jump to

Keyboard shortcuts

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