diff --git a/vendor/github.com/gbazil/telnet/LICENSE b/vendor/github.com/gbazil/telnet/LICENSE deleted file mode 100644 index bb0dc4da..00000000 --- a/vendor/github.com/gbazil/telnet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Vasily Suvorov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/gbazil/telnet/README.md b/vendor/github.com/gbazil/telnet/README.md deleted file mode 100644 index 0e83318c..00000000 --- a/vendor/github.com/gbazil/telnet/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# telnet - -[© Vasily Suvorov 2016](http://bazil.pro) - -#### DESCRIPTION - -Package telnet provides very simple interface for interacting with telnet devices from golang's routines. - -[![GoDoc](https://godoc.org/github.com/gbazil/telnet?status.svg)](https://godoc.org/github.com/gbazil/telnet) diff --git a/vendor/github.com/gbazil/telnet/telnet.go b/vendor/github.com/gbazil/telnet/telnet.go deleted file mode 100644 index 5e00214d..00000000 --- a/vendor/github.com/gbazil/telnet/telnet.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package telnet provides very simple interface for interacting with telnet devices from go routines. -package telnet - -import ( - "bufio" - "bytes" - "net" - "strings" - "time" -) - -// Telnet presents struct with net.Conn interface for telnet protocol plus buffered reader and timeout setup -type Telnet struct { - conn net.Conn - reader *bufio.Reader - timeout time.Duration -} - -// 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 Dial(addr string) (t Telnet, err error) { - t.conn, err = net.Dial("tcp", addr) - - if err == nil { - t.reader = bufio.NewReader(t.conn) - t.timeout = time.Second * 5 // default - } - - return -} - -// DialTimeout acts like Dial but takes a specific timeout (in nanoseconds). -func DialTimeout(addr string, timeout time.Duration) (t Telnet, err error) { - t.conn, err = net.DialTimeout("tcp", addr, timeout) - - if err == nil { - t.reader = bufio.NewReader(t.conn) - t.timeout = timeout - } - - return -} - -// Read reads all data into string from telnet device until it meets the expected or stops on timeout. -func (t Telnet) Read(expect string) (str string, err error) { - var buf bytes.Buffer - t.conn.SetReadDeadline(time.Now().Add(t.timeout)) - - for { - b, e := t.reader.ReadByte() - if e != nil { - err = e - break - } - - if b == 255 { - t.reader.Discard(2) - } else { - buf.WriteByte(b) - } - - if strings.Contains(buf.String(), expect) { - str = buf.String() - break - } - } - - return -} - -// Write writes string (command or data) to telnet device. Do not forget add LF to end of string! -func (t Telnet) Write(s string) (i int, err error) { - t.conn.SetWriteDeadline(time.Now().Add(t.timeout)) - i, err = t.conn.Write([]byte(s)) - return -} - -// SetTimeout changes default or start timeout for all interactions -func (t Telnet) SetTimeout(timeout time.Duration) { - t.timeout = timeout -}