pub enum Auth {
Community {
version: CommunityVersion,
community: String,
},
Usm(UsmAuth),
}Expand description
Authentication configuration for SNMP clients.
Variants§
Community
Community string authentication (SNMPv1 or v2c).
Usm(UsmAuth)
User-based Security Model (SNMPv3).
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn v1(community: impl Into<String>) -> Self
pub fn v1(community: impl Into<String>) -> Self
SNMPv1 community authentication.
Creates authentication configuration for SNMPv1, which only supports
community string authentication without encryption.
§Example
use async_snmp::Auth;
// Create SNMPv1 authentication with "private" community
let auth = Auth::v1("private");Sourcepub fn v2c(community: impl Into<String>) -> Self
pub fn v2c(community: impl Into<String>) -> Self
SNMPv2c community authentication.
Creates authentication configuration for SNMPv2c, which supports
community string authentication without encryption but adds GETBULK
and improved error handling over SNMPv1.
§Example
use async_snmp::Auth;
// Create SNMPv2c authentication with "public" community
let auth = Auth::v2c("public");
// Auth::default() is equivalent to Auth::v2c("public")
let auth = Auth::default();Sourcepub fn usm(username: impl Into<String>) -> UsmBuilder
pub fn usm(username: impl Into<String>) -> UsmBuilder
Start building SNMPv3 USM authentication.
Returns a builder that allows configuring authentication and privacy
protocols. SNMPv3 supports three security levels:
- noAuthNoPriv: username only (no security)
- authNoPriv: username with authentication (integrity)
- authPriv: username with authentication and encryption (confidentiality)
§Example
use async_snmp::{Auth, AuthProtocol, PrivProtocol};
// noAuthNoPriv: username only
let auth: Auth = Auth::usm("readonly").into();
// authNoPriv: with authentication
let auth: Auth = Auth::usm("admin")
.auth(AuthProtocol::Sha256, "authpassword")
.into();
// authPriv: with authentication and encryption
let auth: Auth = Auth::usm("admin")
.auth(AuthProtocol::Sha256, "authpassword")
.privacy(PrivProtocol::Aes128, "privpassword")
.into();Trait Implementations§
impl Eq for Auth
Source§impl From<UsmBuilder> for Auth
impl From<UsmBuilder> for Auth
Source§fn from(b: UsmBuilder) -> Auth
fn from(b: UsmBuilder) -> Auth
Converts to this type from the input type.
Source§impl Ord for Auth
impl Ord for Auth
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Auth
impl PartialOrd for Auth
impl StructuralPartialEq for Auth
Auto Trait Implementations§
impl Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnsafeUnpin for Auth
impl UnwindSafe for Auth
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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>
Converts
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>
Converts
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