[−][src]Struct mqttest::Conf
Specify server behavior.
Many methods take a Vec
of values, where the Nth mod len()
value is used for the Nth
connection. For example, .max_pkt(vec![None,Some(3)])
applies the limit to every second
connection.
Methods
impl Conf
[src]
pub fn new() -> Self
[src]
Initialize a default config
pub fn ports(self, ports: RangeInclusive<u16>) -> Self
[src]
Range of ports to try to listen on, stopping at the first successful one) (defaults to
1883..=2000
)
pub fn dump_files(self, vs: Vec<impl Into<String>>) -> Self
[src]
Dump packets to files.
The filename can contain a {c}
placeholder that will be replaced by the connection
number. The dump format is json-serialized DumpMeta
struct.
pub fn dump_prefix(self, s: impl Into<String>) -> Self
[src]
pub fn dump_decode(self, s: impl Into<Option<String>>) -> Self
[src]
Decode command for publish payload.
The argument should be a command that reads raw payload from stdin, and writes the corresponding utf8/json to stdout. If decoding fails, it should output diagnostics to stderr and exit with a non-zero value.
pub fn ack_timeouts(
self,
mqtt3: impl Into<OptMsDuration>,
mqtt5: impl Into<OptMsDuration>
) -> Self
[src]
self,
mqtt3: impl Into<OptMsDuration>,
mqtt5: impl Into<OptMsDuration>
) -> Self
Resend packet during connection if ack takes longer than this (defaults to 5s).
This only concerns resending during a live connection: resending at connection start (if session was restored) always happens immediately.
The second value is for MQTT5 clients. MQTT5 forbids resending during connection, only set an MQTT5 value for testing purposes. MQTT3 doesn't specify a behaviour, but many client/servers do resend non-acked packets during connection.
pub fn ack_delay(self, d: impl Into<OptMsDuration>) -> Self
[src]
Delay before sending publish and subscribe acks.
pub fn strict(self, strict: bool) -> Self
[src]
Be stricter about optional MQTT behaviours.
- MQTT-3.1.3-5: Reject client_ids longer than 23 chars or not matching [0-9a-zA-Z].
- MQTT-3.1.3-6: Reject empty client_ids.
pub fn idprefix(self, s: impl Into<String>) -> Self
[src]
Reject clients whose client_id does not start with this prefix.
pub fn userpass(self, s: impl Into<Option<String>>) -> Self
[src]
Reject clients who didn't suppliy this username:password
Note that MQTT allows passwords to be binary but we only accept UTF-8.
pub fn max_connect(self, c: impl Into<Option<usize>>) -> Self
[src]
Only accept up to N connections, and stop the server afterwards.
pub fn max_pkt(self, vou: Vec<impl Into<Option<usize>>>) -> Self
[src]
Disconnect the Nth client after receiving that many packets.
This just closes the TCP stream, without sending an mqtt disconnect packet.
pub fn max_pkt_delay(self, d: impl Into<OptMsDuration>) -> Self
[src]
Delay before max-pkt disconnection.
Useful if you want to receive the server response before disconnection.
pub fn max_time(self, vod: Vec<impl Into<OptMsDuration>>) -> Self
[src]
Disconnect the Nth client after a certain time.
This just closes the TCP stream, without sending an mqtt disconnect packet.
pub fn sess_expire(self, vod: Vec<impl Into<OptMsDuration>>) -> Self
[src]
How long is the Nth session retained after disconnection.
If None, use client-specified behaviour (clean_session in MQTT3, session expiry in MQTT5).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Conf
impl Send for Conf
impl Sync for Conf
impl Unpin for Conf
impl UnwindSafe for Conf
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,