telnet

package module
v0.0.0-...-db1df58 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT Imports: 5 Imported by: 0

README

telnet

© Vasily Suvorov 2016

DESCRIPTION

Package telnet provides very simple interface for interacting with telnet devices from golang's routines.

GoDoc

Documentation

Overview

Package telnet provides very simple interface for interacting with telnet devices from go routines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Telnet

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

Telnet presents struct with net.Conn interface for telnet protocol plus buffered reader and timeout setup

func Dial

func Dial(addr string) (t Telnet, err error)

Dial constructs connection to a telnet device. Address string must be in format: "ip:port" (e.g. "127.0.0.1:23"). Default timeout is set to 5 seconds.

func DialTimeout

func DialTimeout(addr string, timeout time.Duration) (t Telnet, err error)

DialTimeout acts like Dial but takes a specific timeout (in nanoseconds).

func (Telnet) Read

func (t Telnet) Read(expect string) (str string, err error)

Read reads all data into string from telnet device until it meets the expected or stops on timeout.

func (Telnet) SetTimeout

func (t Telnet) SetTimeout(timeout time.Duration)

SetTimeout changes default or start timeout for all interactions

func (Telnet) Write

func (t Telnet) Write(s string) (i int, err error)

Write writes string (command or data) to telnet device. Do not forget add LF to end of string!

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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