telnet

package
v0.0.0-...-80a2c53 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IAC byte = 255 // Interpret As Command

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(c net.Conn) *Conn

create and initialize telnet connection object

func (*Conn) InstallResizeHandler

func (c *Conn) InstallResizeHandler(handler func(int, int))

func (*Conn) Read

func (c *Conn) Read(data []byte) (int, error)

Here we read data, and process any telnet command if they are encountered. Escaped IAC bytes (= double IAC byte) should be unescaped here as well.

func (*Conn) RequestTermSize

func (c *Conn) RequestTermSize()

func (*Conn) SendCommand

func (c *Conn) SendCommand(cmd byte) error

func (*Conn) SendDo

func (c *Conn) SendDo(o byte) error

func (*Conn) SendDont

func (c *Conn) SendDont(o byte) error

func (*Conn) SendWill

func (c *Conn) SendWill(o byte) error

func (*Conn) SendWont

func (c *Conn) SendWont(o byte) error

func (*Conn) Write

func (c *Conn) Write(data []byte) (totalWritten int, err error)

I have no idea if this code works ok under all circumstances (sudden disconnects etc..). Only time will tell. IAC needs to be escaped (=duplicated), otherwise telnet client thinks we are sending a telnet command.

type ConnectionState

type ConnectionState int

Jump to

Keyboard shortcuts

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