Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInstructionMissDot = errors.New("instruction without dot") ErrInstructionMissComma = errors.New("instruction without comma") ErrInstructionBadDigit = errors.New("instruction with bad digit") ErrInstructionBadRune = errors.New("instruction with bad rune") )
Possible errors returned by the ParseInstruction function
View Source
var ErrNotConnected = errors.New("not connected")
Functions ¶
This section is empty.
Types ¶
type InetSocketTunnel ¶
type InetSocketTunnel struct {
// contains filtered or unexported fields
}
Simple tunnel implementation over TCP sockets. This allows to connect directly to guacd, without the need of any middleware
func NewInetSocketTunnel ¶
func NewInetSocketTunnel(address string) (*InetSocketTunnel, error)
func (*InetSocketTunnel) Connect ¶
func (t *InetSocketTunnel) Connect(data string) error
func (*InetSocketTunnel) Disconnect ¶
func (t *InetSocketTunnel) Disconnect()
func (*InetSocketTunnel) ReceiveInstruction ¶
func (t *InetSocketTunnel) ReceiveInstruction() (*Instruction, error)
TODO Implement timeout
func (*InetSocketTunnel) SendInstruction ¶
func (t *InetSocketTunnel) SendInstruction(ins ...*Instruction) error
type Instruction ¶
func NewInstruction ¶
func NewInstruction(opcode string, args ...string) *Instruction
func ParseInstruction ¶
func ParseInstruction(raw []byte) (ins *Instruction, err error)
ParseInstruction parses an instruction: 1.a,2.bc,3.def,10.abcdefghij; Copied from Occamy project: https://github.com/changkun/occamy/blob/master/protocol/instruction.go#L38
func (*Instruction) String ¶
func (i *Instruction) String() string
type InstructionIO ¶
type InstructionIO struct {
// contains filtered or unexported fields
}
InstructionIO ...
func NewInstructionIO ¶
func NewInstructionIO(sock io.ReadWriteCloser) *InstructionIO
NewInstructionIO ...
func (*InstructionIO) Read ¶
func (io *InstructionIO) Read() (*Instruction, error)
Read reads and parses the instruction from io input
func (*InstructionIO) ReadRaw ¶
func (io *InstructionIO) ReadRaw() ([]byte, error)
ReadRaw reads raw data from io input
func (*InstructionIO) Write ¶
func (io *InstructionIO) Write(ins *Instruction) (int, error)
Write writes and decodes an instruction to io output
type Tunnel ¶
type Tunnel interface { // Connect to the tunnel with the given optional data. This data is // typically used for authentication. The format of data accepted is // up to the tunnel implementation. Connect(data string) error // Disconnect from the tunnel. Disconnect() // Send the given message through the tunnel to the service on the other // side. All messages are guaranteed to be received in the order sent. SendInstruction(ins ...*Instruction) error // Receive a instruction from the service on the other side. This is a // blocking call ReceiveInstruction() (*Instruction, error) }
type TunnelState ¶
type TunnelState int
const ( TunnelClosed TunnelState = iota TunnelOpen )
All possible tunnel states.
Click to show internal directories.
Click to hide internal directories.