Documentation ¶
Index ¶
Constants ¶
const ( MaxInteger = 0x3fff MaxIntegerBytes = 2 )
Consts
const ( SSHServerRemoteStdOut = 0x00 SSHServerRemoteStdErr = 0x01 SSHServerConnectFailed = 0x02 SSHServerConnectSucceed = 0x03 SSHServerConnectVerifyFingerprint = 0x04 SSHServerConnectRequestCredential = 0x05 )
Server -> client signal Consts
const ( SSHClientStdIn = 0x00 SSHClientResize = 0x01 SSHClientRespondFingerprint = 0x02 SSHClientRespondCredential = 0x03 )
Client -> server signal consts
const ( SSHRequestErrorBadUserName = command.StreamError(0x01) SSHRequestErrorBadRemoteAddress = command.StreamError(0x02) SSHRequestErrorBadAuthMethod = command.StreamError(0x03) )
Error codes
const ( SSHAuthMethodNone byte = 0x00 SSHAuthMethodPassphrase byte = 0x01 SSHAuthMethodPrivateKey byte = 0x02 )
Auth methods
const ( TelnetServerRemoteBand = 0x00 TelnetServerDialFailed = 0x01 TelnetServerDialConnected = 0x02 )
Server signal codes
const (
TelnetRequestErrorBadRemoteAddress = command.StreamError(0x01)
)
Error codes
Variables ¶
var ( ErrAddressParseBufferTooSmallForHeader = errors.New( "buffer space was too small to parse the address header") ErrAddressParseBufferTooSmallForIPv4 = errors.New( "buffer space was too small to parse the IPv4 address") ErrAddressParseBufferTooSmallForIPv6 = errors.New( "buffer space was too small to parse the IPv6 address") ErrAddressParseBufferTooSmallForHostName = errors.New( "buffer space was too small to parse the hostname address") ErrAddressMarshalBufferTooSmall = errors.New( "buffer space was too small to marshal the address") ErrAddressInvalidAddressType = errors.New( "invalid address type") )
Errors
var ( ErrIntegerMarshalNotEnoughBuffer = errors.New( "not enough buffer to marshal the integer") ErrIntegerMarshalTooLarge = errors.New( "integer cannot be marshalled, because the vaule was too large") )
Errors
var ( ErrSSHAuthCancelled = errors.New( "authentication has been cancelled") ErrSSHInvalidAuthMethod = errors.New( "invalid auth method") ErrSSHInvalidAddress = errors.New( "invalid address") ErrSSHRemoteFingerprintVerificationCancelled = errors.New( "server Fingerprint verification process has been cancelled") ErrSSHRemoteFingerprintRefused = errors.New( "server Fingerprint has been refused") "remote SSH connection is unavailable") ErrSSHUnexpectedFingerprintVerificationRespond = errors.New( "unexpected fingerprint verification respond") ErrSSHUnexpectedCredentialDataRespond = errors.New( "unexpected credential data respond") ErrSSHCredentialDataTooLarge = errors.New( "credential was too large") ErrSSHUnknownClientSignal = errors.New( "unknown client signal") )
Errors
var ( ErrStringParseBufferTooSmall = errors.New( "not enough buffer space to parse given string") ErrStringMarshalBufferTooSmall = errors.New( "not enough buffer space to marshal given string") )
Errors
var (
ErrTelnetUnableToReceiveRemoteConn = errors.New(
"unable to acquire remote connection handle")
)
Errors
Functions ¶
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address data
func NewAddress ¶
func NewAddress(addrType AddressType, data []byte, port uint16) Address
NewAddress creates a new Address
func ParseAddress ¶
func ParseAddress(reader rw.ReaderFunc, buf []byte) (Address, error)
ParseAddress parses the reader and return an Address
Address data format: +-------------+--------------+---------------+ | 2 bytes | 1 byte | n bytes | +-------------+--------------+---------------+ | Port number | Address type | Address data | +-------------+--------------+---------------+
Address types:
- LoopbackAddr: 00 Localhost, don't carry Address data
- IPv4Addr: 01 IPv4 Address, carries 4 bytes of Address data
- IPv6Addr: 10 IPv6 Address, carries 16 bytes Address data
- HostnameAddr: 11 Host name string, length of Address data is indicated by the remainer of the byte (11-- ----). maxlen = 63
type AddressType ¶
type AddressType byte
AddressType Type of the address
const ( LoopbackAddr AddressType = 0x00 IPv4Addr AddressType = 0x01 IPv6Addr AddressType = 0x02 HostNameAddr AddressType = 0x03 )
Address types
type Integer ¶
type Integer uint16
Integer is a 16bit unsigned integer data
Format: +-------------------------------------+--------------+ | 1 bit | 7 bits | +-------------------------------------+--------------+ | 1 when current byte is the end byte | Integer data | +-------------------------------------+--------------+
Example:
- 00000000 00000000: 0
- 01111111: 127
- 11111111 01000000: 255
type String ¶
type String struct {
// contains filtered or unexported fields
}
String data
func ParseString ¶
func ParseString(reader rw.ReaderFunc, b []byte) (String, error)
ParseString build the String according to readed data