pub struct RawChannel { /* private fields */ }
Expand description

Represents a raw channel between a manager client and server. Underneath, this routes incoming and outgoing data from a proxied server to an inmemory transport.

Implementations

Consumes this channel, returning a typed client wrapping the transport.

Note

This does not perform any additional handshakes or authentication. All authentication was performed during separate connection and this merely wraps an inmemory transport that maps to the primary connection.

Consumes this channel, returning an untyped client wrapping the transport.

Note

This does not perform any additional handshakes or authentication. All authentication was performed during separate connection and this merely wraps an inmemory transport that maps to the primary connection.

Returns reference to the underlying framed transport.

Returns mutable reference to the underlying framed transport.

Consumes the channel, returning the underlying framed transport.

Methods from Deref<Target = FramedTransport<InmemoryTransport>>

Replaces the current codec with the provided codec. Note that any bytes in the incoming or outgoing buffers will remain in the transport, meaning that this can cause corruption if the bytes in the buffers do not match the new codec.

For safety, use clear to wipe the buffers before further use.

Returns a reference to the codec used by the transport.

Note

Be careful when accessing the codec to avoid corrupting it through unexpected modifications as this will place the transport in an undefined state.

Returns a mutable reference to the codec used by the transport.

Note

Be careful when accessing the codec to avoid corrupting it through unexpected modifications as this will place the transport in an undefined state.

Clears the internal transport buffers.

Returns a reference to the inner value this transport wraps.

Returns a mutable reference to the inner value this transport wraps.

Waits for the transport to be ready based on the given interest, returning the ready status

Waits for the transport to be readable to follow up with try_read_frame.

Waits for the transport to be writeable to follow up with try_write_frame.

Waits for the transport to be readable or writeable, returning the Ready status.

Attempts to flush any remaining bytes in the outgoing queue, returning the total bytes written as a result of the flush. Note that a return of 0 bytes does not indicate that the underlying transport has closed, but rather that no bytes were flushed such as when the outgoing queue is empty.

This is accomplished by continually calling the inner transport’s try_write. If 0 is returned from a call to try_write, this will fail with [ErrorKind::WriteZero].

This call may return an error with ErrorKind::WouldBlock in the case that the transport is not ready to write data.

Flushes all buffered, outgoing bytes using repeated calls to try_flush.

Reads a frame of bytes by using the Codec tied to this transport. Returns Ok(Some(frame)) upon reading a frame, or Ok(None) if the underlying transport has closed.

This call may return an error with ErrorKind::WouldBlock in the case that the transport is not ready to read data or has not received a full frame before waiting.

Reads a frame using try_read_frame and then deserializes the bytes into D.

Continues to invoke try_read_frame until a frame is successfully read, an error is encountered that is not ErrorKind::WouldBlock, or the underlying transport has closed.

Reads a frame using read_frame and then deserializes the bytes into D.

Writes a frame of bytes by using the Codec tied to this transport.

This is accomplished by continually calling the inner transport’s try_write. If 0 is returned from a call to try_write, this will fail with ErrorKind::WriteZero.

This call may return an error with ErrorKind::WouldBlock in the case that the transport is not ready to write data or has not written the entire frame before waiting.

Serializes value into bytes and passes them to try_write_frame.

Invokes try_write_frame followed by a continuous calls to try_flush until a frame is successfully written, an error is encountered that is not ErrorKind::WouldBlock, or the underlying transport has closed.

Serializes value into bytes and passes them to write_frame.

Executes the async function while the Backup of this transport is frozen.

Places the transport in synchronize mode where it communicates with the other side how many frames have been sent and received. From there, any frames not received by the other side are sent again and then this transport waits for any missing frames that it did not receive from the other side.

Note

This will clear the internal incoming and outgoing buffers, so any frame that was in transit in either direction will be dropped.

Perform the client-side of a handshake. See handshake for more details.

Perform the server-side of a handshake. See handshake for more details.

Performs a handshake in order to establish a new codec to use between this transport and the other side. The parameter handshake defines how the transport will handle the handshake with Client being used to pick the compression and encryption used while Server defines what the choices are for compression and encryption.

This will reset the framed transport’s codec to PlainCodec in order to communicate which compression and encryption to use. Upon selecting an encryption type, a shared secret key will be derived on both sides and used to establish the EncryptionCodec, which in combination with the CompressionCodec (if any) will replace this transport’s codec.

Client
  1. Wait for options from server
  2. Send to server a compression and encryption choice
  3. Configure framed transport using selected choices
  4. Invoke on_handshake function
Server
  1. Send options to client
  2. Receive choices from client
  3. Configure framed transport using client’s choices
  4. Invoke on_handshake function
Failure

The handshake will fail in several cases:

  • If any frame during the handshake fails to be serialized
  • If any unexpected frame is received during the handshake
  • If using encryption and unable to derive a shared secret key

If a failure happens, the codec will be reset to what it was prior to the handshake request, and all internal buffers will be cleared to avoid corruption.

Places the transport into key-exchange mode where it attempts to derive a shared secret key with the other transport.

Links the underlying transports together using InmemoryTransport::link.

Trait Implementations

The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.