Tunnel

Struct Tunnel 

pub struct Tunnel {
    pub(crate) client_mode: ClientMode,
    pub(crate) web_socket: WebSocketStream<MaybeTlsStream<TcpStream>>,
}

Fields§

§client_mode: ClientMode§web_socket: WebSocketStream<MaybeTlsStream<TcpStream>>

Implementations§

§

impl Tunnel

pub async fn new(notify: &Notify) -> Result<Self>

Creates a new Tunnel instance from the provided payload.

The payload contains the necessary information to establish a secure tunnel connection with AWS IoT Secure Tunneling.

The function performs the following checks:

  • Ensures the client_mode is “destination”
  • Ensures the services list contains the “SSH” service

If the checks pass, the function creates a new WebSocket connection to the AWS IoT Secure Tunneling endpoint and returns a Tunnel instance.

pub async fn start<S>(self, service: S) -> Result<()>
where S: Service,

Starts the Tunnel service, handling incoming and outgoing messages.

This function is responsible for managing the WebSocket connection, processing received data, and forwarding messages to the underlying service.

The function takes a Service instance as a parameter, which is responsible for handling the actual processing of the messages. The Service trait defines the interface for this processing, including methods for connecting to the service, handling incoming messages, and closing the connection.

Auto Trait Implementations§

§

impl !Freeze for Tunnel

§

impl !RefUnwindSafe for Tunnel

§

impl Send for Tunnel

§

impl Sync for Tunnel

§

impl Unpin for Tunnel

§

impl !UnwindSafe for Tunnel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more