Struct jormungandr::network::p2p::comm::peer_map::ClientAuth
source · pub struct ClientAuth {
in_progress: LruCache<Address, [u8; 32]>,
established: LinkedHashMap<Address, NodeId>,
}
Expand description
Peer authentication is checked during the handshake. For client connections, we simply do not add a peer to the map if the authentication fails. On the server side instead, we need to keep track of in progress handshakes until we have authenticated reliably a node by its id. FIXME: In addition, until a better solution is implemented, a correspondence between addresses and ids is needed to handle subscriptions. However, this is subject to ip spoofing attacks and should not be used in an open network.
Fields§
§in_progress: LruCache<Address, [u8; 32]>
§established: LinkedHashMap<Address, NodeId>
Implementations§
source§impl ClientAuth
impl ClientAuth
const DEFAULT_OPEN_HANDSHAKED_LIMIT: usize = 128usize
pub fn generate_auth_nonce(&mut self, addr: Address) -> [u8; 32]
pub fn complete_handshake<F>( &mut self, addr: Address, id: NodeId, verify: F ) -> Result<(), NetworkError>where F: FnOnce([u8; 32]) -> Result<(), NetworkError>,
pub fn remove(&mut self, addr: Address) -> Option<NodeId>
pub fn client_id(&self, addr: Address) -> Option<&NodeId>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ClientAuth
impl Send for ClientAuth
impl Sync for ClientAuth
impl Unpin for ClientAuth
impl UnwindSafe for ClientAuth
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request