gnet

package
v0.0.0-...-a05fb78 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/*InstructionQueueLimit *
	 * The maximum number of characters of Guacamole instruction data to store
	 * within the instruction queue while searching for errors. Once this limit
	 * is exceeded, the connection is assumed to be successful.
	 */
	InstructionQueueLimit int = 2048
)
View Source
const InternalDataOpcode = ""

InternalDataOpcode const Globle value

  • The Guacamole protocol instruction opcode reserved for arbitrary
  • internal use by tunnel implementations. The value of this opcode is
  • guaranteed to be the empty string (""). Tunnel implementations may use
  • this opcode for any purpose. It is currently used by the HTTP tunnel to
  • mark the end of the HTTP response, and by the WebSocket tunnel to
  • transmit the tunnel UUID.
View Source
const SocketTimeout = 15 * time.Second

SocketTimeout socket timeout setting

  • The number of milliseconds to wait for data on the TCP socket before
  • timing out.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractGuacamoleTunnel

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

AbstractGuacamoleTunnel ==> GuacamoleTunnel

  • Base GuacamoleTunnel implementation which synchronizes access to the
  • underlying reader and writer with reentrant locks. Implementations need only
  • provide the tunnel's UUID and socket.

func NewAbstractGuacamoleTunnel

func NewAbstractGuacamoleTunnel(core GetSocketInterface) (ret AbstractGuacamoleTunnel)

NewAbstractGuacamoleTunnel Construct function

func (*AbstractGuacamoleTunnel) AcquireReader

func (opt *AbstractGuacamoleTunnel) AcquireReader() gio.GuacamoleReader

AcquireReader override GuacamoleTunnel.AcquireReader

func (*AbstractGuacamoleTunnel) AcquireWriter

func (opt *AbstractGuacamoleTunnel) AcquireWriter() gio.GuacamoleWriter

AcquireWriter override GuacamoleTunnel.AcquireWriter

func (*AbstractGuacamoleTunnel) Close

func (opt *AbstractGuacamoleTunnel) Close() (err exp.ExceptionInterface)

Close override GuacamoleTunnel.Close

func (*AbstractGuacamoleTunnel) HasQueuedReaderThreads

func (opt *AbstractGuacamoleTunnel) HasQueuedReaderThreads() bool

HasQueuedReaderThreads override GuacamoleTunnel.HasQueuedReaderThreads

func (*AbstractGuacamoleTunnel) HasQueuedWriterThreads

func (opt *AbstractGuacamoleTunnel) HasQueuedWriterThreads() bool

HasQueuedWriterThreads override GuacamoleTunnel.HasQueuedWriterThreads

func (*AbstractGuacamoleTunnel) IsOpen

func (opt *AbstractGuacamoleTunnel) IsOpen() bool

IsOpen override GuacamoleTunnel.IsOpen

func (*AbstractGuacamoleTunnel) ReleaseReader

func (opt *AbstractGuacamoleTunnel) ReleaseReader()

ReleaseReader override GuacamoleTunnel.ReleaseReader

func (*AbstractGuacamoleTunnel) ReleaseWriter

func (opt *AbstractGuacamoleTunnel) ReleaseWriter()

ReleaseWriter override GuacamoleTunnel.ReleaseWriter

type ConfiguredGuacamoleSocket

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

ConfiguredGuacamoleSocket ==> GuacamoleSocket

func NewConfiguredGuacamoleSocket2

func NewConfiguredGuacamoleSocket2(socket GuacamoleSocket,
	config gprotocol.GuacamoleConfiguration) (ret ConfiguredGuacamoleSocket,
	err exp.ExceptionInterface)

NewConfiguredGuacamoleSocket2 * * Creates a new ConfiguredGuacamoleSocket which uses the given * GuacamoleConfiguration to complete the initial protocol handshake over * the given GuacamoleSocket. A default GuacamoleClientInformation object * is used to provide basic client information. * * @param socket The GuacamoleSocket to wrap. * @param config The GuacamoleConfiguration to use to complete the initial * protocol handshake. * @throws GuacamoleException If an error occurs while completing the * initial protocol handshake.

func NewConfiguredGuacamoleSocket3

NewConfiguredGuacamoleSocket3 * * Creates a new ConfiguredGuacamoleSocket which uses the given * GuacamoleConfiguration and GuacamoleClientInformation to complete the * initial protocol handshake over the given GuacamoleSocket. * * @param socket The GuacamoleSocket to wrap. * @param config The GuacamoleConfiguration to use to complete the initial * protocol handshake. * @param info The GuacamoleClientInformation to use to complete the initial * protocol handshake. * @throws GuacamoleException If an error occurs while completing the * initial protocol handshake.

func (*ConfiguredGuacamoleSocket) Close

Close override GuacamoleSocket.Close

func (*ConfiguredGuacamoleSocket) GetConfiguration

GetConfiguration * * Returns the GuacamoleConfiguration used to configure this * ConfiguredGuacamoleSocket. * * @return The GuacamoleConfiguration used to configure this * ConfiguredGuacamoleSocket.

func (*ConfiguredGuacamoleSocket) GetConnectionID

func (opt *ConfiguredGuacamoleSocket) GetConnectionID() string

GetConnectionID * * Returns the unique ID associated with the Guacamole connection * negotiated by this ConfiguredGuacamoleSocket. The ID is provided by * the "ready" instruction returned by the Guacamole proxy. * * @return The ID of the negotiated Guacamole connection.

func (*ConfiguredGuacamoleSocket) GetReader

GetReader override GuacamoleSocket.GetReader

func (*ConfiguredGuacamoleSocket) GetWriter

GetWriter override GuacamoleSocket.GetWriter

func (*ConfiguredGuacamoleSocket) IsOpen

func (opt *ConfiguredGuacamoleSocket) IsOpen() bool

IsOpen override GuacamoleSocket.IsOpen

type DelegatingGuacamoleTunnel

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

DelegatingGuacamoleTunnel ==> GuacamoleTunnel

  • GuacamoleTunnel implementation which simply delegates all function calls to
  • an underlying GuacamoleTunnel.

func NewDelegatingGuacamoleTunnel

func NewDelegatingGuacamoleTunnel(tunnel GuacamoleTunnel) (ret DelegatingGuacamoleTunnel)

NewDelegatingGuacamoleTunnel Construct

func (*DelegatingGuacamoleTunnel) AcquireReader

func (opt *DelegatingGuacamoleTunnel) AcquireReader() gio.GuacamoleReader

AcquireReader override GuacamoleTunnel.AcquireReader

func (*DelegatingGuacamoleTunnel) AcquireWriter

func (opt *DelegatingGuacamoleTunnel) AcquireWriter() gio.GuacamoleWriter

AcquireWriter override GuacamoleTunnel.AcquireWriter

func (*DelegatingGuacamoleTunnel) Close

Close override GuacamoleTunnel.Close

func (*DelegatingGuacamoleTunnel) GetSocket

func (opt *DelegatingGuacamoleTunnel) GetSocket() GuacamoleSocket

GetSocket override GuacamoleTunnel.GetSocket

func (*DelegatingGuacamoleTunnel) GetUUID

func (opt *DelegatingGuacamoleTunnel) GetUUID() guid.UUID

GetUUID override GuacamoleTunnel.GetUUID

func (*DelegatingGuacamoleTunnel) HasQueuedReaderThreads

func (opt *DelegatingGuacamoleTunnel) HasQueuedReaderThreads() bool

HasQueuedReaderThreads override GuacamoleTunnel.HasQueuedReaderThreads

func (*DelegatingGuacamoleTunnel) HasQueuedWriterThreads

func (opt *DelegatingGuacamoleTunnel) HasQueuedWriterThreads() bool

HasQueuedWriterThreads override GuacamoleTunnel.HasQueuedWriterThreads

func (*DelegatingGuacamoleTunnel) IsOpen

func (opt *DelegatingGuacamoleTunnel) IsOpen() bool

IsOpen override GuacamoleTunnel.IsOpen

func (*DelegatingGuacamoleTunnel) ReleaseReader

func (opt *DelegatingGuacamoleTunnel) ReleaseReader()

ReleaseReader override GuacamoleTunnel.ReleaseReader

func (*DelegatingGuacamoleTunnel) ReleaseWriter

func (opt *DelegatingGuacamoleTunnel) ReleaseWriter()

ReleaseWriter override GuacamoleTunnel.ReleaseWriter

type FailoverGuacamoleSocket

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

FailoverGuacamoleSocket ==> GuacamoleSocket

  • GuacamoleSocket which intercepts errors received early in the Guacamole
  • session. Upstream errors which are intercepted early enough result in
  • exceptions thrown immediately within the FailoverGuacamoleSocket's
  • constructor, allowing a different socket to be substituted prior to
  • fulfilling the connection.

func NewFailoverGuacamoleSocket

func NewFailoverGuacamoleSocket(socket GuacamoleSocket) (ret FailoverGuacamoleSocket, err exp.ExceptionInterface)

NewFailoverGuacamoleSocket * * Creates a new FailoverGuacamoleSocket which reads Guacamole instructions * from the given socket, searching for errors from the upstream remote * desktop. If an upstream error is encountered, it is thrown as a * GuacamoleUpstreamException. This constructor will block until an error * is encountered, or until the connection appears to have been successful. * Once the FailoverGuacamoleSocket has been created, all reads, writes, * etc. will be delegated to the provided socket. * * @param socket * The GuacamoleSocket of the Guacamole connection this * FailoverGuacamoleSocket should handle. * * @throws GuacamoleException * If an error occurs while reading data from the provided socket. * * @throws GuacamoleUpstreamException * If the connection to guacd succeeded, but an error occurred while * connecting to the remote desktop.

func (*FailoverGuacamoleSocket) Close

func (opt *FailoverGuacamoleSocket) Close() (err exp.ExceptionInterface)

Close override GuacamoleSocket.Close

func (*FailoverGuacamoleSocket) GetReader

func (opt *FailoverGuacamoleSocket) GetReader() gio.GuacamoleReader

GetReader override GuacamoleSocket.GetReader

func (*FailoverGuacamoleSocket) GetWriter

func (opt *FailoverGuacamoleSocket) GetWriter() gio.GuacamoleWriter

GetWriter override GuacamoleSocket.GetWriter

func (*FailoverGuacamoleSocket) IsOpen

func (opt *FailoverGuacamoleSocket) IsOpen() bool

IsOpen override GuacamoleSocket.IsOpen

type FilteredGuacamoleSocket

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

FilteredGuacamoleSocket ==> GuacamoleSocket * Implementation of GuacamoleSocket which allows individual instructions to be * intercepted, overridden, etc.

func NewFilteredGuacamoleSocket

func NewFilteredGuacamoleSocket(
	socket GuacamoleSocket,
	readFilter gprotocol.GuacamoleFilter,
	writeFilter gprotocol.GuacamoleFilter,
) (ret FilteredGuacamoleSocket)

NewFilteredGuacamoleSocket * * Creates a new FilteredGuacamoleSocket which uses the given filters to * determine whether instructions read/written are allowed through, * modified, etc. If reads or writes should be unfiltered, simply specify * null rather than a particular filter. * * @param socket The GuacamoleSocket to wrap. * @param readFilter The GuacamoleFilter to apply to all read instructions, * if any. * @param writeFilter The GuacamoleFilter to apply to all written * instructions, if any.

func (*FilteredGuacamoleSocket) Close

Close override GuacamoleSocket.Close

func (*FilteredGuacamoleSocket) GetReader

func (opt *FilteredGuacamoleSocket) GetReader() gio.GuacamoleReader

GetReader override GuacamoleSocket.GetReader

func (*FilteredGuacamoleSocket) GetWriter

func (opt *FilteredGuacamoleSocket) GetWriter() gio.GuacamoleWriter

GetWriter override GuacamoleSocket.GetWriter

func (*FilteredGuacamoleSocket) IsOpen

func (opt *FilteredGuacamoleSocket) IsOpen() bool

IsOpen override GuacamoleSocket.IsOpen

type GetSocketInterface

type GetSocketInterface interface {
	GetSocket() GuacamoleSocket
}

GetSocketInterface Tool interface for AbstractGuacamoleTunnel

type GuacamoleSocket

type GuacamoleSocket interface {
	/**
	 * Returns a GuacamoleReader which can be used to read from the
	 * Guacamole instruction stream associated with the connection
	 * represented by this GuacamoleSocket.
	 *
	 * @return A GuacamoleReader which can be used to read from the
	 *         Guacamole instruction stream.
	 */
	GetReader() gio.GuacamoleReader

	/**
	 * Returns a GuacamoleWriter which can be used to write to the
	 * Guacamole instruction stream associated with the connection
	 * represented by this GuacamoleSocket.
	 *
	 * @return A GuacamoleWriter which can be used to write to the
	 *         Guacamole instruction stream.
	 */
	GetWriter() gio.GuacamoleWriter

	/**
	 * Releases all resources in use by the connection represented by this
	 * GuacamoleSocket.
	 *
	 * @throws GuacamoleException If an error occurs while releasing resources.
	 */
	Close() exp.ExceptionInterface

	/**
	 * Returns whether this GuacamoleSocket is open and can be used for reading
	 * and writing.
	 *
	 * @return true if this GuacamoleSocket is open, false otherwise.
	 */
	IsOpen() bool
}

GuacamoleSocket Provides abstract socket-like access to a Guacamole connection.

type GuacamoleTunnel

type GuacamoleTunnel interface {

	/**
	 * Acquires exclusive read access to the Guacamole instruction stream
	 * and returns a GuacamoleReader for reading from that stream.
	 *
	 * @return A GuacamoleReader for reading from the Guacamole instruction
	 *         stream.
	 */
	AcquireReader() gio.GuacamoleReader

	/**
	 * Relinquishes exclusive read access to the Guacamole instruction
	 * stream. This function should be called whenever a thread finishes using
	 * a GuacamoleTunnel's GuacamoleReader.
	 */
	ReleaseReader()

	/**
	 * Returns whether there are threads waiting for read access to the
	 * Guacamole instruction stream.
	 *
	 * @return true if threads are waiting for read access the Guacamole
	 *         instruction stream, false otherwise.
	 */
	HasQueuedReaderThreads() bool

	/**
	 * Acquires exclusive write access to the Guacamole instruction stream
	 * and returns a GuacamoleWriter for writing to that stream.
	 *
	 * @return A GuacamoleWriter for writing to the Guacamole instruction
	 *         stream.
	 */
	AcquireWriter() gio.GuacamoleWriter

	/**
	 * Relinquishes exclusive write access to the Guacamole instruction
	 * stream. This function should be called whenever a thread finishes using
	 * a GuacamoleTunnel's GuacamoleWriter.
	 */
	ReleaseWriter()

	/**
	 * Returns whether there are threads waiting for write access to the
	 * Guacamole instruction stream.
	 *
	 * @return true if threads are waiting for write access the Guacamole
	 *         instruction stream, false otherwise.
	 */
	HasQueuedWriterThreads() bool

	/**
	 * Returns the unique identifier associated with this GuacamoleTunnel.
	 *
	 * @return The unique identifier associated with this GuacamoleTunnel.
	 */
	GetUUID() guid.UUID

	/**
	 * Returns the GuacamoleSocket used by this GuacamoleTunnel for reading
	 * and writing.
	 *
	 * @return The GuacamoleSocket used by this GuacamoleTunnel.
	 */
	GetSocket() GuacamoleSocket

	/**
	 * Release all resources allocated to this GuacamoleTunnel.
	 *
	 * @throws GuacamoleException if an error occurs while releasing
	 *                            resources.
	 */
	Close() exp.ExceptionInterface

	/**
	 * Returns whether this GuacamoleTunnel is open, or has been closed.
	 *
	 * @return true if this GuacamoleTunnel is open, false if it is closed.
	 */
	IsOpen() bool
}

GuacamoleTunnel Provides a unique identifier and synchronized access to the GuacamoleReader and GuacamoleWriter associated with a GuacamoleSocket.

func NewSimpleGuacamoleTunnel

func NewSimpleGuacamoleTunnel(socket GuacamoleSocket) (ret GuacamoleTunnel)

NewSimpleGuacamoleTunnel Construct function

type InetGuacamoleSocket

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

InetGuacamoleSocket ==> GuacamoleSocket * Provides abstract socket-like access to a Guacamole connection over a given * hostname and port.

func NewInetGuacamoleSocket

func NewInetGuacamoleSocket(hostname string, port int) (ret InetGuacamoleSocket, err exp.ExceptionInterface)

NewInetGuacamoleSocket Construct & connect

  • Creates a new InetGuacamoleSocket which reads and writes instructions
  • to the Guacamole instruction stream of the Guacamole proxy server
  • running at the given hostname and port. *
  • @param hostname The hostname of the Guacamole proxy server to connect to.
  • @param port The port of the Guacamole proxy server to connect to.
  • @throws GuacamoleException If an error occurs while connecting to the
  • Guacamole proxy server.

func (*InetGuacamoleSocket) Close

func (opt *InetGuacamoleSocket) Close() (err exp.ExceptionInterface)

Close Override GuacamoleSocket.Close

func (*InetGuacamoleSocket) GetReader

func (opt *InetGuacamoleSocket) GetReader() (ret gio.GuacamoleReader)

GetReader Override GuacamoleSocket.GetReader

func (*InetGuacamoleSocket) GetWriter

func (opt *InetGuacamoleSocket) GetWriter() (ret gio.GuacamoleWriter)

GetWriter Override GuacamoleSocket.GetWriter

func (*InetGuacamoleSocket) IsOpen

func (opt *InetGuacamoleSocket) IsOpen() (ok bool)

IsOpen Override GuacamoleSocket.IsOpen

type ReentrantLock

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

ReentrantLock is NOT a re-enterant-lock Just add HasQueuedThreads method

func NewReentrantLock

func NewReentrantLock() (ret ReentrantLock)

NewReentrantLock Construct function

func (*ReentrantLock) HasQueuedThreads

func (opt *ReentrantLock) HasQueuedThreads() bool

HasQueuedThreads override ReentrantLock.HasQueuedThreads

func (*ReentrantLock) Lock

func (opt *ReentrantLock) Lock()

Lock override ReentrantLock.Lock

func (*ReentrantLock) Unlock

func (opt *ReentrantLock) Unlock()

Unlock override ReentrantLock.Unlock

type SSLGuacamoleSocket

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

SSLGuacamoleSocket ==> GuacamoleSocket * Provides abstract socket-like access to a Guacamole connection over a given * hostname and port.

func NewSSLGuacamoleSocket

func NewSSLGuacamoleSocket(hostname string, port int) (ret SSLGuacamoleSocket, err error)

NewSSLGuacamoleSocket Construct & connect

  • Creates a new InetGuacamoleSocket which reads and writes instructions
  • to the Guacamole instruction stream of the Guacamole proxy server
  • running at the given hostname and port. *
  • @param hostname The hostname of the Guacamole proxy server to connect to.
  • @param port The port of the Guacamole proxy server to connect to.
  • @throws GuacamoleException If an error occurs while connecting to the
  • Guacamole proxy server.

func (*SSLGuacamoleSocket) Close

func (opt *SSLGuacamoleSocket) Close() (err exp.ExceptionInterface)

Close Override GuacamoleSocket.Close

func (*SSLGuacamoleSocket) GetReader

func (opt *SSLGuacamoleSocket) GetReader() (ret gio.GuacamoleReader)

GetReader Override GuacamoleSocket.GetReader

func (*SSLGuacamoleSocket) GetWriter

func (opt *SSLGuacamoleSocket) GetWriter() (ret gio.GuacamoleWriter)

GetWriter Override GuacamoleSocket.GetWriter

func (*SSLGuacamoleSocket) IsOpen

func (opt *SSLGuacamoleSocket) IsOpen() (ok bool)

IsOpen Override GuacamoleSocket.IsOpen

type SimpleGuacamoleTunnel

type SimpleGuacamoleTunnel struct {
	AbstractGuacamoleTunnel
	// contains filtered or unexported fields
}

SimpleGuacamoleTunnel ==> AbstractGuacamoleTunnel * GuacamoleTunnel implementation which uses a provided socket. The UUID of * the tunnel will be randomly generated.

func (*SimpleGuacamoleTunnel) GetSocket

func (opt *SimpleGuacamoleTunnel) GetSocket() GuacamoleSocket

GetSocket override GuacamoleTunnel.GetSocket

func (*SimpleGuacamoleTunnel) GetUUID

func (opt *SimpleGuacamoleTunnel) GetUUID() guid.UUID

GetUUID override GuacamoleTunnel.GetUUID

Jump to

Keyboard shortcuts

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