pub struct NotificationReceiverBuilder { /* private fields */ }Expand description
Builder for NotificationReceiver.
Allows configuration of bind address and USM credentials for V3 support.
Implementations§
Source§impl NotificationReceiverBuilder
impl NotificationReceiverBuilder
Sourcepub fn bind(self, addr: impl Into<String>) -> Self
pub fn bind(self, addr: impl Into<String>) -> Self
Set the bind address.
Default is “0.0.0.0:162” (standard trap port).
Sourcepub fn usm_user<F>(self, username: impl Into<Bytes>, configure: F) -> Self
pub fn usm_user<F>(self, username: impl Into<Bytes>, configure: F) -> Self
Add a USM user for V3 authentication.
§Example
use async_snmp::notification::NotificationReceiver;
use async_snmp::{AuthProtocol, PrivProtocol};
let receiver = NotificationReceiver::builder()
.bind("0.0.0.0:162")
.usm_user("trapuser", |u| {
u.auth(AuthProtocol::Sha1, b"authpassword")
.privacy(PrivProtocol::Aes128, b"privpassword")
})
.build()
.await?;Sourcepub async fn build(self) -> Result<NotificationReceiver>
pub async fn build(self) -> Result<NotificationReceiver>
Build the notification receiver.
For IPv6 bind addresses, the socket has IPV6_V6ONLY set to true.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NotificationReceiverBuilder
impl RefUnwindSafe for NotificationReceiverBuilder
impl Send for NotificationReceiverBuilder
impl Sync for NotificationReceiverBuilder
impl Unpin for NotificationReceiverBuilder
impl UnwindSafe for NotificationReceiverBuilder
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