Function eval_remote_ip

Source
pub fn eval_remote_ip(req: M2mRequest) -> Result<String, TraceabilityError>
Expand description

Extracts the remote IP address from an M2M request for routing purposes.

This function analyzes the request type and destination resource to determine the appropriate remote IP address that should handle the request. For stream resources, it extracts the IP from the local socket address. For source compliance requests, it uses the provided authority IP.

§Arguments

  • req - The M2M request to analyze

§Returns

The remote IP address as a string, or an error if the IP cannot be determined.

§Errors

Returns TransportFailedToEvaluateRemote if:

  • The destination is not a stream resource
  • The socket address cannot be parsed
  • The request type doesn’t contain routing information