Skip to main content

UnixDatagramTransport

Struct UnixDatagramTransport 

Source
pub struct UnixDatagramTransport { /* private fields */ }
Expand description

Write-only Unix datagram transport.

Sends each SyslogMessage as a single datagram to the configured socket path. This matches the framing expected by rsyslog’s imuxsock datagram input and by a logfenced instance configured with listen_transport = "unix_dgram".

The socket is created unbound. On Linux, SHUT_RD is issued immediately to enforce write-only direction at the OS level; macOS rejects that call on unconnected sockets, so write-only is type-enforced only on that platform. There is no framing — the datagram boundary is the message boundary.

Thread-safe: the socket is protected by a tokio::sync::Mutex.

Implementations§

Source§

impl UnixDatagramTransport

Source

pub fn new(path: impl Into<PathBuf>, max_size: usize) -> Self

Create a transport that will send to the Unix datagram socket at path.

max_size is the maximum accepted wire message size in bytes. Use 65536 for the standard datagram limit.

The default retry limit is 4 attempts. Use max_attempts to change it.

Source

pub fn max_attempts(self, n: u32) -> Self

Set the maximum number of datagram send attempts.

0 means unlimited — retry until the send succeeds or a non-retryable error occurs. Attempt 1 is immediate; attempt 2 waits 100 µs, and each subsequent attempt doubles the delay until reaching the 1 s cap.

Trait Implementations§

Source§

impl Transport for UnixDatagramTransport

Source§

async fn send(&self, msg: &SyslogMessage) -> Result<(), ClientError>

Send a single syslog message. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.