mirror of
https://git.proxmox.com/git/proxmox
synced 2025-07-04 10:46:09 +00:00
api: RPC environment: add client IP getter/setter to trait
This is similar to what we have in PVE and PMG now. Will be used to set the real client IP for proxied connections. with a dummy implementation, which avoids the need to implement it for the CLI or Backup environments, which do not have or care for a client IP Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e5456f873d
commit
88586e9343
@ -19,6 +19,16 @@ pub trait RpcEnvironment: std::any::Any + AsAny + Send {
|
|||||||
|
|
||||||
/// Get user name
|
/// Get user name
|
||||||
fn get_user(&self) -> Option<String>;
|
fn get_user(&self) -> Option<String>;
|
||||||
|
|
||||||
|
/// Set the client IP, should be re-set if a proxied connection was detected
|
||||||
|
fn set_client_ip(&mut self, _client_ip: Option<std::net::SocketAddr>) {
|
||||||
|
// dummy no-op implementation, as most environments don't need this
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the (real) client IP
|
||||||
|
fn get_client_ip(&self) -> Option<std::net::SocketAddr> {
|
||||||
|
None // dummy no-op implementation, as most environments don't need this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Environment Type
|
/// Environment Type
|
||||||
|
Loading…
Reference in New Issue
Block a user