iac
Node.js interface to Telnet's Interpret As Command
Install with npm:
$ npm install --save iac
iac
relies on es6 Proxy
, therefore you must use Node.js version 6.0.0 or above.
Examples
As the server
const net = const iac = net
As the client
const net = const iac = net
API
iac.OPERATION.OPTION
will always be a Buffer
, where:
OPERATION is one of:
- will
- wont
- do
- dont
- sb (special case)
OPTION is one of:
- binary (Binary Transmission)
- echo
- suppress (Suppress Go Ahead)
- status [not fully supported]
- timing (Timing Mark)
- terminal (Terminal Type)
- naws (Negotiate About Window Size)
- speed (Terminal Speed)
- flow (Remote Flow Control)
- linemode
- env (Environment Variables)
Both OPERATION and OPTION are case insensitive. If either are not one of the operations/options listed then it shall return undefined
.
e.g.
const iac = // IAC DONT SUPPRESS-GO-AHEADiacdontsuppress // IAC WILL LINEMODEiacwilllinemode
Subnegotiation
To use subnegotiation, call iac.sb.OPTION()
:
- Strings are interpolated into ASCII
- Numbers are passed directly
- Passing no arguments implies subnegotiation value required (1).
e.g.
const iac = // IAC SB NAWS 0 80 0 24 IAC SEiacsb // IAC SB TERMINAL-TYPE 1 IAC SEiacsb
On
iac
also provides support for assigning handlers for socket data of specific IAC commands on a socket with iac.on(socket, command, handler)
. command should be something like iac.do.suppress
or iac.sb.status
.
e.g.
const net = const iac = net