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§
Source§impl<'de> Deserialize<'de> for Auth
impl<'de> Deserialize<'de> for Auth
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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.
Auto Trait Implementations§
impl Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin 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