Documentation ¶
Index ¶
- Constants
- type TelnetClient
- func (tc *TelnetClient) Close()
- func (tc *TelnetClient) Dial() (err error)
- func (tc *TelnetClient) Execute(name string, args ...string) (stdout []byte, err error)
- func (tc *TelnetClient) ReadByte() (b byte, err error)
- func (tc *TelnetClient) ReadUntil(data *[]byte, delim byte) (n int, err error)
- func (tc *TelnetClient) ReadUntilBanner() (output []byte, err error)
- func (tc *TelnetClient) ReadUntilPrompt(process func(data []byte) bool) (output []byte, err error)
- func (tc *TelnetClient) SkipBytes(n int) error
- func (tc *TelnetClient) Write(data []byte) (n int, err error)
Constants ¶
const ( // IAC interpret as command IAC = 255 // SB is subnegotiation of the indicated option follows SB = 250 // SE is end of subnegotiation parameters SE = 240 // WILL indicates the desire to begin WILL = 251 // WONT indicates the refusal to perform, // continue performing, the indicated option WONT = 252 // DO indicates the request that the other // party perform, or confirmation that you are // expecting the other party to perform, the indicated option DO = 253 // DONT 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 DONT = 254 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TelnetClient ¶
type TelnetClient struct { Login string Password string Address string Port string Timeout time.Duration Verbose bool LogWriter *bufio.Writer // contains filtered or unexported fields }
TelnetClient is basic descriptor
func (*TelnetClient) Close ¶
func (tc *TelnetClient) Close()
func (*TelnetClient) Dial ¶
func (tc *TelnetClient) Dial() (err error)
Dial does open connect to telnet server
func (*TelnetClient) Execute ¶
func (tc *TelnetClient) Execute( name string, args ...string, ) (stdout []byte, err error)
Execute sends command on remote server and returns whole output
func (*TelnetClient) ReadByte ¶
func (tc *TelnetClient) ReadByte() (b byte, err error)
ReadByte receives byte from remote server, avoiding commands
func (*TelnetClient) ReadUntil ¶
func (tc *TelnetClient) ReadUntil(data *[]byte, delim byte) (n int, err error)
ReadUntil reads bytes until a specific symbol. Delimiter character will be written to result buffer
func (*TelnetClient) ReadUntilBanner ¶
func (tc *TelnetClient) ReadUntilBanner() (output []byte, err error)
ReadUntilBanner reads until banner, i.e. whole output from command
func (*TelnetClient) ReadUntilPrompt ¶
func (tc *TelnetClient) ReadUntilPrompt( process func(data []byte) bool, ) (output []byte, err error)
ReadUntilPrompt reads data until process function stops. If process function returns true, reading will be stopped Process function give chunk of line i.e. from start of line to last white space or whole line, if next line delimiter is found
func (*TelnetClient) SkipBytes ¶
func (tc *TelnetClient) SkipBytes(n int) error
SkipBytes skip a number of bytes (typically, sent command echo)