pub(crate) struct Host {
workspace: String,
key: VerifyingKey,
live: Mutex<HashMap<String, Weak<WshRpcEngine>>>,
}Expand description
The registered host and the connections it proxied that are open now.
Fields§
§workspace: String§key: VerifyingKey§live: Mutex<HashMap<String, Weak<WshRpcEngine>>>Implementations§
Source§impl Host
impl Host
Sourcepub(crate) fn from_file_text(text: &str) -> Result<Host, String>
pub(crate) fn from_file_text(text: &str) -> Result<Host, String>
A host from its key file’s text: {"v":1,"workspace":"<id>","public_key":"<base64url, 32 bytes>"}.
Sourcepub(crate) fn fingerprint(&self) -> String
pub(crate) fn fingerprint(&self) -> String
A short name for the public key: the first 8 bytes of the SHA-256 of its 32 bytes, as 16 hex characters. The key is public, and this is all a log line says of it.
fn verify(&self, text: &str, signature_b64: &str) -> bool
Sourcepub(crate) fn conn_from_header(&self, value: &str) -> Option<String>
pub(crate) fn conn_from_header(&self, value: &str) -> Option<String>
The connection id in an x-amx-conn header value, if the host signed it for this workspace.
Sourcepub(crate) fn attach(&self, id: &str, engine: &Arc<WshRpcEngine>) -> bool
pub(crate) fn attach(&self, id: &str, engine: &Arc<WshRpcEngine>) -> bool
Note that the connection id (proxied by the host) is engine. False when id is already
held by a connection that is still open: the first holder keeps it.
fn engine_of(&self, id: &str) -> Option<Arc<WshRpcEngine>>
Sourcefn attest(
&self,
req: &AttestRequest,
now: u64,
) -> Result<String, (StatusCode, &'static str)>
fn attest( &self, req: &AttestRequest, now: u64, ) -> Result<String, (StatusCode, &'static str)>
The host attests the connection nonce was issued to. Everything is checked before the nonce is
spent; once it is, it is spent whatever else fails. Returns the person that is now vouched for.
Sourcepub(crate) fn check_call(
&self,
op: &str,
workspace: &str,
issued_at: u64,
args: &str,
sig: &str,
now: u64,
) -> Result<(), (StatusCode, &'static str)>
pub(crate) fn check_call( &self, op: &str, workspace: &str, issued_at: u64, args: &str, sig: &str, now: u64, ) -> Result<(), (StatusCode, &'static str)>
A call of the host’s own (host_control: what srv is doing, a stop notice, a graceful shutdown) is the host’s
and nobody else’s: it is signed over its operation and arguments, for this workspace, and no older than a minute.
The instance key is not enough, because every agent can read it.
Auto Trait Implementations§
impl !Freeze for Host
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnsafeUnpin for Host
impl UnwindSafe for Host
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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