Function brane_prx::manage::new_outgoing_path

source ·
pub async fn new_outgoing_path(
    body: Bytes,
    context: Arc<Context>,
) -> Result<impl Reply, Rejection>
Expand description

Creates a new path outgoing from the proxy service.

This will allocate a new port that an internal service can connect to. Any traffic that then occurs on this port is forwarded and trafficked back to the specified domain.

§Arguments

  • body: The body of the given request, which we will attempt to parse as JSON.
  • context: The Context struct that contains things we might need.

§Returns

A reponse with the following codes:

  • 200 OK if the new path was successfully created. In the body, there is the (serialized) port number of the path to store.
  • 400 BAD REQUEST if the given request body was not parseable as the desired JSON.
  • 507 INSUFFICIENT STORAGE if the server is out of port ranges to allocate.

§Errors

This function errors if we failed to start a new task that listens for the given port. If so, a 500 INTERNAL ERROR is returned.