ssh

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

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

Go to latest
Published: Aug 22, 2014 License: MIT Imports: 19 Imported by: 0

README

ssh

Documentation

Index

Constants

View Source
const (

	// RFC4252 (Authentication Protocol)/6
	MsgUserauthRequest = 50
	MsgUserauthFailure = 51
	MsgUserauthSuccess = 52
	MsgUserauthBanner  = 53

	// RFC4253 (Transport Layer Protocol)/12
	MsgDisconnect     = 1
	MsgIgnore         = 2
	MsgUnimplemented  = 3
	MsgDebug          = 4
	MsgServiceRequest = 5
	MsgServiceAccept  = 6
	MsgKexinit        = 20
	MsgNewkeys        = 21
	MsgKexdhInit      = 30
	MsgKexdhReply     = 31

	// RFC4253/6.1
	MaxPacketSize = 32768

	// RFC4254 (Connection Protocol)/9
	MsgGlobalRequest           = 80
	MsgRequestSuccess          = 81
	MsgRequestFailure          = 82
	MsgChannelOpen             = 90
	MsgChannelOpenConfirmation = 91
	MsgChannelOpenFailure      = 92
	MsgChannelWindowAdjust     = 93
	MsgChannelData             = 94
	MsgChannelExtendedData     = 95
	MsgChannelEOF              = 96
	MsgChannelClose            = 97
	MsgChannelRequest          = 98
	MsgChannelSuccess          = 99
	MsgChannelFailure          = 100

	NameListKexAlgorithms           = "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
	NameListServerHostKeyAlgorithms = "ssh-rsa"

	NameListEncryptionAlgorithms1  = "aes128-ctr,aes128-cbc"
	NameListEncryptionAlgorithms2  = "aes128-ctr,aes128-cbc"
	NameListMacAlgorithms1         = "hmac-sha1"
	NameListMacAlgorithms2         = "hmac-sha1"
	NameListCompressionAlgorithms1 = "none"
	NameListCompressionAlgorithms2 = "none"
	NameListLanguages1             = ""
	NameListLanguages2             = ""
)

Variables

View Source
var Log = func(int, string, ...interface{}) {
}

Functions

func Spawn

func Spawn(command string, in io.ReadCloser, out, err io.WriteCloser, noTTY bool) func(ch *Channel)

Types

type Channel

type Channel struct {
	*ChannelSink
	// contains filtered or unexported fields
}

func (*Channel) Client

func (ch *Channel) Client() *Client

func (*Channel) Close

func (ch *Channel) Close() (err error)

func (*Channel) RemoteId

func (ch *Channel) RemoteId() uint32

func (*Channel) Write

func (ch *Channel) Write(data []byte) (n int, err error)

type ChannelSink

type ChannelSink struct {
	OnChannelFailure          func(ch *Channel)
	OnChannelClose            func(ch *Channel)
	OnChannelEOF              func(ch *Channel)
	OnChannelExtendedData     func(ch *Channel, data []byte, dataType uint32)
	OnChannelData             func(ch *Channel, data []byte)
	OnChannelOpenConfirmation func(ch *Channel)
	OnChannelOpenFailure      func(ch *Channel, reason uint32, description, lang string)
}

type Client

type Client struct {
	ClientChannels
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn io.ReadWriteCloser, option *ClientOption) (*Client, error)

func (*Client) ChannelCount

func (c *Client) ChannelCount() int

func (*Client) Close

func (c *Client) Close()

func (*Client) DialTCP

func (c *Client) DialTCP(host string, port int) (conn *TunnelConn, err error)

func (Client) Packet

func (s Client) Packet() *Encoder

func (Client) PacketN

func (s Client) PacketN(n int) *Encoder

type ClientChannels

type ClientChannels struct {
	// contains filtered or unexported fields
}

type ClientOption

type ClientOption struct {
	User         string
	CheckHostKey func([]byte) error
	GetPassword  func() (string, error)
}

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder type.

func NewDecoder

func NewDecoder(b []byte) *Decoder

Create a new parser with the given buffer.

func (*Decoder) Byte

func (p *Decoder) Byte(d *byte) *Decoder

Parse a byte from the buffer.

func (*Decoder) End

func (p *Decoder) End()

Assert that we are at the end of input.

func (*Decoder) IsEnd

func (p *Decoder) IsEnd() bool

Query whether all data have been parsed.

func (*Decoder) NBytes

func (p *Decoder) NBytes(n int, d *[]byte) *Decoder

Parse n bytes from the buffer to a []byte pointer.

func (*Decoder) NString

func (p *Decoder) NString(n int, s *string) *Decoder

Parse n bytes from the buffer to a string pointer.

func (*Decoder) U16

func (p *Decoder) U16(d *uint16) *Decoder

Parse 2 bigendian bytes from the buffer.

func (*Decoder) U16String

func (p *Decoder) U16String(d *string) *Decoder

Parse a string with a 2 byte bigendian length prefix to a string pointer.

func (*Decoder) U32

func (p *Decoder) U32(d *uint32) *Decoder

Parse 4 bigendian bytes from the buffer.

func (*Decoder) U32Bytes

func (p *Decoder) U32Bytes(d *[]byte) *Decoder

Parse a string with a 4 byte bigendian length prefix to a []byte pointer.

func (*Decoder) U32String

func (p *Decoder) U32String(d *string) *Decoder

Parse a string with a 4 byte bigendian length prefix to a string pointer.

func (*Decoder) U64

func (p *Decoder) U64(d *uint64) *Decoder

Parse 8 bigendian bytes from the buffer.

func (*Decoder) U8String

func (p *Decoder) U8String(d *string) *Decoder

Parse a string with a 1 byte length prefix to a string pointer.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder type. Don't touch the internals.

func NewEncoder

func NewEncoder() *Encoder

Create a new printer with empty output.

func NewEncoderWith

func NewEncoderWith(data []byte) *Encoder

Create a new printer with output prefixed with the given byte slice.

func NewEncoderWithCommit

func NewEncoderWithCommit(data []byte, commit func([]byte) (int, error)) *Encoder

func (*Encoder) Byte

func (p *Encoder) Byte(d byte) *Encoder

Output a byte.

func (*Encoder) Bytes

func (p *Encoder) Bytes(d []byte) *Encoder

Output a raw byte slice with no length prefix.

func (*Encoder) Commit

func (p *Encoder) Commit() (int, error)

func (*Encoder) Out

func (p *Encoder) Out() []byte

Get the output as a byte slice.

func (*Encoder) String

func (p *Encoder) String(d string) *Encoder

Output a raw string with no length prefix.

func (*Encoder) String0

func (p *Encoder) String0(d string) *Encoder

Output a string terminated by a null-byte

func (*Encoder) U16

func (p *Encoder) U16(d uint16) *Encoder

Output 2 bigendian bytes.

func (*Encoder) U16String

func (p *Encoder) U16String(d string) *Encoder

Output a string with a 2 byte bigendian length prefix and no trailing null.

func (*Encoder) U32

func (p *Encoder) U32(d uint32) *Encoder

Output 4 bigendian bytes.

func (*Encoder) U32Bytes

func (p *Encoder) U32Bytes(d []byte) *Encoder

Output bytes with a 4 byte bigendian length prefix and no trailing null.

func (*Encoder) U32String

func (p *Encoder) U32String(d string) *Encoder

Output a string with a 4 byte bigendian length prefix and no trailing null.

func (*Encoder) U64

func (p *Encoder) U64(d uint64) *Encoder

Output 4 bigendian bytes.

func (*Encoder) U8String

func (p *Encoder) U8String(d string) *Encoder

Output a string with a 1 byte bigendian length prefix and no trailing null.

type NullCrypto

type NullCrypto struct {
}

func (NullCrypto) BlockSize

func (NullCrypto) BlockSize() int

func (NullCrypto) CryptBlocks

func (NullCrypto) CryptBlocks(dst, src []byte)

type NullHash

type NullHash struct {
}

func (NullHash) BlockSize

func (NullHash) BlockSize() int

func (NullHash) Reset

func (NullHash) Reset()

func (NullHash) Size

func (NullHash) Size() int

func (NullHash) Sum

func (NullHash) Sum(b []byte) []byte

func (NullHash) Write

func (NullHash) Write(b []byte) (int, error)

type TunnelConn

type TunnelConn struct {
	*Channel
	// contains filtered or unexported fields
}

func (*TunnelConn) Read

func (s *TunnelConn) Read(buf []byte) (n int, err error)

func (*TunnelConn) Read2

func (s *TunnelConn) Read2(buf []byte) (data []byte, err error)

Jump to

Keyboard shortcuts

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