Skip to main content

ProbeTarget

Enum ProbeTarget 

Source
pub enum ProbeTarget {
    Http {
        host: String,
        port: u16,
        path: String,
    },
    Tcp {
        host: String,
        port: u16,
    },
    Exec {
        command: String,
    },
}
Expand description

A probe’s target after validation — the form the prober consumes.

Parsing here rather than in the daemon means a malformed target fails the Flockfile, not the first poll ten seconds after the sheep is online.

Variants§

§

Http

http://host[:port]/path — port defaults to 80, path to /.

Fields

§host: String

The host or IP literal. A bracketed IPv6 literal ([::1]) has its brackets stripped.

Carried for the prober: connect with (host.as_str(), port), not by formatting "{host}:{port}" into a SocketAddr parse — a stripped IPv6 literal has no brackets to make that string parseable. For the RFC 7230 Host: header, re-bracket an IPv6 host (format!("[{host}]")) before writing it.

§port: u16

The port; defaults to 80 when the authority carries none.

§path: String

The path; defaults to / when the URL carries none.

Free of whitespace and control characters whenever it came from ProbeTarget::parse — see ProbeTargetError::InvalidPath. The prober writes this verbatim into a request line, so that is a security property, not a tidiness one; a caller that builds this variant by hand rather than parsing takes it on itself.

§

Tcp

host:port.

Fields

§host: String

The host or IP literal. A bracketed IPv6 literal ([::1]) has its brackets stripped.

Carried for the prober: connect with (host.as_str(), port), not by formatting "{host}:{port}" into a SocketAddr parse — a stripped IPv6 literal has no brackets to make that string parseable.

§port: u16

The port.

§

Exec

A command line, run through the platform shell.

Fields

§command: String

The command line exactly as written in the Flockfile.

Implementations§

Source§

impl ProbeTarget

Source

pub fn parse(config: &ProbeConfig) -> Result<Self, ProbeTargetError>

Parses config.target according to config.kind.

§Errors

Trait Implementations§

Source§

impl Clone for ProbeTarget

Source§

fn clone(&self) -> ProbeTarget

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProbeTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ProbeTarget

Source§

impl PartialEq for ProbeTarget

Source§

fn eq(&self, other: &ProbeTarget) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProbeTarget

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.