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: StringThe 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.
path: StringThe 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
Exec
A command line, run through the platform shell.
Implementations§
Source§impl ProbeTarget
impl ProbeTarget
Sourcepub fn parse(config: &ProbeConfig) -> Result<Self, ProbeTargetError>
pub fn parse(config: &ProbeConfig) -> Result<Self, ProbeTargetError>
Parses config.target according to config.kind.
§Errors
ProbeTargetError::Empty: the target is empty or all whitespace.ProbeTargetError::HttpsUnsupported: anhttps://URL.ProbeTargetError::NotHttpUrl: nohttp://scheme.ProbeTargetError::MissingHost: the authority has no host.ProbeTargetError::InvalidHost: the host contains@, whitespace, or an embedded:.ProbeTargetError::InvalidPath: the path contains whitespace or a control character.ProbeTargetError::MissingPort: a TCP target with no:port.ProbeTargetError::BadPort: the port is not au16.
Trait Implementations§
Source§impl Clone for ProbeTarget
impl Clone for ProbeTarget
Source§fn clone(&self) -> ProbeTarget
fn clone(&self) -> ProbeTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProbeTarget
impl Debug for ProbeTarget
impl Eq for ProbeTarget
Source§impl PartialEq for ProbeTarget
impl PartialEq for ProbeTarget
impl StructuralPartialEq for ProbeTarget
Auto Trait Implementations§
impl Freeze for ProbeTarget
impl RefUnwindSafe for ProbeTarget
impl Send for ProbeTarget
impl Sync for ProbeTarget
impl Unpin for ProbeTarget
impl UnsafeUnpin for ProbeTarget
impl UnwindSafe for ProbeTarget
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.