service

Function service 

pub(crate) async fn service(
    packet: Publish,
    cancel: CancellationToken,
) -> Result<(), Error>
Expand description

Runs the SSH service for a new tunnel.

This function is spawned as a new task when a tunnel notification is received. It creates a new Service instance and starts the tunnel using the payload from the received MQTT packet.

The function will run until the cancel token is triggered, indicating that the tunnel should be shut down.

§Arguments

  • packet - The MQTT [Publish] packet containing the tunnel payload.
  • cancel - A [CancellationToken] that can be used to cancel the service.

§Returns

A Result indicating whether the service ran successfully.