Documentation
¶
Index ¶
- Constants
- func LoadAuthorizedKeysFromFile(path string) ([]ssh.PublicKey, error)
- func ParseAuthorizedKeys(data []byte, pathHint string) ([]ssh.PublicKey, error)
- func ServeSSH(ctx context.Context, ln net.Listener, opts SSHServerOptions) error
- func ServeTelnet(ctx context.Context, ln net.Listener, opts SSHServerOptions) error
- type CLIMode
- type CLISession
- type CLIState
- type SSHServerOptions
- type TelnetConnection
- func (t *TelnetConnection) Close() error
- func (t *TelnetConnection) CloseWrite() error
- func (t *TelnetConnection) Read(data []byte) (n int, err error)
- func (t *TelnetConnection) SendRequest(name string, wantReply bool, payload []byte) (bool, error)
- func (t *TelnetConnection) Stderr() io.ReadWriter
- func (t *TelnetConnection) Write(data []byte) (n int, err error)
Constants ¶
View Source
const ( TelnetIAC = 255 // Interpret As Command TelnetDONT = 254 // Don't TelnetDO = 253 // Do TelnetWONT = 252 // Won't TelnetWILL = 251 // Will TelnetSB = 250 // Subnegotiation Begin TelnetSE = 240 // Subnegotiation End // Telnet options TelnetEcho = 1 // Echo TelnetSuppressGoAhead = 3 // Suppress Go Ahead TelnetStatus = 5 // Status TelnetTimingMark = 6 // Timing Mark TelnetTerminalType = 24 // Terminal Type TelnetWindowSize = 31 // Window Size TelnetTerminalSpeed = 32 // Terminal Speed TelnetRemoteFlowControl = 33 // Remote Flow Control TelnetLinemode = 34 // Linemode TelnetEnvironment = 36 // Environment )
Telnet commands and options
Variables ¶
This section is empty.
Functions ¶
func LoadAuthorizedKeysFromFile ¶
LoadAuthorizedKeysFromFile parses an OpenSSH authorized_keys file.
func ParseAuthorizedKeys ¶
ParseAuthorizedKeys parses authorized_keys file contents (path is only for errors).
func ServeTelnet ¶
ServeTelnet accepts Telnet connections on ln until ln is closed or ctx is cancelled.
Types ¶
type CLISession ¶
type CLISession struct {
// contains filtered or unexported fields
}
func NewCLISession ¶
func NewCLISession(conn ssh.Channel, username, password string, logger *zap.Logger, vendor vendor) *CLISession
NewCLISession creates new CLI session
func NewCLISessionWithAuth ¶
type CLIState ¶
type CLIState struct {
// contains filtered or unexported fields
}
CLIState stores CLI session state
func NewCLIState ¶
func NewCLIStateWithAuth ¶
func (*CLIState) NewSubMode ¶
type SSHServerOptions ¶
type SSHServerOptions struct {
Logger *zap.Logger
// Username and Password are used for password-based client auth.
Username string
Password string
// ConnectionErrorProb is the probability (0–1) to drop a connection right after accept.
ConnectionErrorProb float64
// AuthorizedKeys, when non-empty, enables public-key client auth for Username.
AuthorizedKeys []ssh.PublicKey
}
SSHServerOptions configures the mock SSH switch listener.
type TelnetConnection ¶
type TelnetConnection struct {
// contains filtered or unexported fields
}
TelnetConnection implements ssh.Channel over a Telnet TCP connection.
func (*TelnetConnection) Close ¶
func (t *TelnetConnection) Close() error
func (*TelnetConnection) CloseWrite ¶
func (t *TelnetConnection) CloseWrite() error
func (*TelnetConnection) SendRequest ¶
func (*TelnetConnection) Stderr ¶
func (t *TelnetConnection) Stderr() io.ReadWriter
Click to show internal directories.
Click to hide internal directories.