#[non_exhaustive]pub struct Peer {
pub ip: String,
pub port: i64,
pub labels: HashMap<String, String>,
pub principal: String,
pub region_code: String,
/* private fields */
}Expand description
This message defines attributes for a node that handles a network request.
The node can be either a service or an application that sends, forwards,
or receives the request. Service peers should fill in
principal and labels as appropriate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ip: StringThe IP address of the peer.
port: i64The network port of the peer.
labels: HashMap<String, String>The labels associated with the peer.
principal: StringThe identity of this peer. Similar to Request.auth.principal, but
relative to the peer instead of the request. For example, the
identity associated with a load balancer that forwarded the request.
region_code: StringThe CLDR country/region code associated with the above IP address.
If the IP address is private, the region_code should reflect the
physical location where this peer is running.
Implementations§
Source§impl Peer
impl Peer
pub fn new() -> Self
Sourcepub fn set_labels<T, K, V>(self, v: T) -> Self
pub fn set_labels<T, K, V>(self, v: T) -> Self
Sourcepub fn set_principal<T: Into<String>>(self, v: T) -> Self
pub fn set_principal<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_region_code<T: Into<String>>(self, v: T) -> Self
pub fn set_region_code<T: Into<String>>(self, v: T) -> Self
Trait Implementations§
impl StructuralPartialEq for Peer
Auto Trait Implementations§
impl Freeze for Peer
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnwindSafe for Peer
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
Mutably borrows from an owned value. Read more