pub struct ResourceValidator;
Expand description
Resource validator for P2M requests.
This validator ensures that incoming Process-to-Middleware requests reference valid, accessible system resources before they are processed by the core services. It performs system-level validation that cannot be done at the type level.
§Validation Rules
- Process IDs: Must correspond to currently running processes
- Socket Addresses: Must be parseable and use compatible address families
- File Descriptors: Accepted without validation (OS handles validity)
§Usage
The validator methods are called by the P2M service when resource validation
is enabled through the with_resource_validation(true)
builder method.
Implementations§
Source§impl ResourceValidator
impl ResourceValidator
Sourcepub fn is_valid_process(&self, pid: i32) -> bool
pub fn is_valid_process(&self, pid: i32) -> bool
Validates that a process ID corresponds to a currently running process.
Queries the system process table to verify that the specified PID is associated with an active process. This prevents operations on stale or invalid process identifiers.
§Arguments
pid
- Process identifier to validate
§Returns
true
if the process exists and is accessible, false
otherwise
Sourcepub fn is_valid_stream(&self, local_socket: &str, peer_socket: &str) -> bool
pub fn is_valid_stream(&self, local_socket: &str, peer_socket: &str) -> bool
Validates that socket addresses are well-formed and compatible.
Ensures that both local and peer socket addresses can be parsed and use compatible address families (both IPv4 or both IPv6). This prevents network operations with mismatched or invalid addresses.
§Arguments
local_socket
- Local socket address stringpeer_socket
- Peer socket address string
§Returns
true
if both addresses are valid and compatible, false
otherwise
Trait Implementations§
Source§impl Clone for ResourceValidator
impl Clone for ResourceValidator
Source§fn clone(&self) -> ResourceValidator
fn clone(&self) -> ResourceValidator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ResourceValidator
impl RefUnwindSafe for ResourceValidator
impl Send for ResourceValidator
impl Sync for ResourceValidator
impl Unpin for ResourceValidator
impl UnwindSafe for ResourceValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered
].