telnet

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

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

telnet

Telnet is a simple library to connect to a telnet server. You may use it to either read lines from or write lines to a telnet connection.

Installation

go get -u github.com/julisch94/telnet

Usage

func main() {
    connection, err := telnet.Connect("localhost", "7072", "secret")
    if err != nil {
        panic("Failed to connect.")
    }
    defer connection.Close()

    telnet.WriteLine(connection, "version")
    line, _ := telnet.ReadLine(connection)
    fmt.Println("line was read:", line)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanTelnetStream

func CleanTelnetStream(connection *telnet.Conn)

CleanTelnetStream reads everything off the stream until timeouts are received

func Connect

func Connect(host, port, password string) (connection *telnet.Conn, err error)

Connect tries to establish a connection to the given host:port. An additional password will be entered to log in.

func ReadLine

func ReadLine(connection *telnet.Conn) (line string, err error)

ReadLine reads a new line from the connection or returns an error

func WriteLine

func WriteLine(connection *telnet.Conn, line string) (err error)

WriteLine writes the given line to the given connection

Types

This section is empty.

Jump to

Keyboard shortcuts

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