Documentation ¶
Index ¶
- Constants
- type Client
- func (this *Client) Close() error
- func (this *Client) FirstPrompt() string
- func (this *Client) LocalAddr() net.Addr
- func (this *Client) Read(buf []byte) (int, error)
- func (this *Client) ReadByte() (byte, error)
- func (this *Client) ReadRune() (r rune, size int, err error)
- func (this *Client) ReadUtil(delim byte) (bytes.Buffer, error)
- func (this *Client) ReadUtil2(delims ...string) (bytes.Buffer, int, error)
- func (this *Client) RemoteAddr() net.Addr
- func (this *Client) ScrollToNewLine() error
- func (this *Client) SetDeadline(t time.Time) error
- func (this *Client) SetEcho(echo bool) error
- func (this *Client) SetReadDeadline(t time.Time) error
- func (this *Client) SetSuppressGA(suppressGA bool) error
- func (this *Client) SetWriteDeadline(t time.Time) error
- func (this *Client) SkipUtil(delim byte) error
- func (this *Client) SkipUtil2(delims ...string) (int, error)
- func (this *Client) Welcome() string
- func (this *Client) Write(buf []byte) (n int, err error)
- type ClientConfig
Constants ¶
View Source
const ( CR = byte('\r') LF = byte('\n') )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
func (*Client) FirstPrompt ¶
FirstPrompt 获取登录后(跳过用户名、密码提示符)的第一个提示符
func (*Client) RemoteAddr ¶
func (*Client) ScrollToNewLine ¶
ScrollToNewLine 滚动到新的一行
func (*Client) SetSuppressGA ¶
type ClientConfig ¶
type ClientConfig struct { Addr string User string Password string UserRegex *regexp.Regexp // 匹配用户名提示符的正则 PassRegex *regexp.Regexp // 匹配密码提示符的正则 PromptRegex *regexp.Regexp // 匹配提示符的正则 Timeout time.Duration // 连接超时时间, 默认15秒 WriteTimeout time.Duration // 写超时时间, 默认5秒 UnixWriteMode bool // 如果设置,Write 将任何 '\n' (LF) 转换为 '\r\n' (CR LF) Echo bool // 如果设置,将允许回显(取决于服务端是否支持),部分网络设备上无效(总是回显) SuppressGA bool // 如果设置,将抑制 "go ahead" 命令 TLS *tls.Config }
Click to show internal directories.
Click to hide internal directories.