pub struct HostBlock {
pub host_pattern: String,
pub raw_host_line: String,
pub directives: Vec<Directive>,
}Expand description
A parsed Host block with its directives.
Fields§
§host_pattern: StringThe host alias/pattern (the value after “Host”).
raw_host_line: StringThe original raw “Host …” line for faithful reproduction.
directives: Vec<Directive>Parsed directives inside this block.
Implementations§
Source§impl HostBlock
impl HostBlock
Extract tags from purple:tags comment in directives.
Sourcepub fn provider(&self) -> Option<(String, String)>
pub fn provider(&self) -> Option<(String, String)>
Extract provider info from purple:provider comment in directives. Returns (provider_name, server_id), e.g. (“digitalocean”, “412345678”).
Sourcepub fn set_provider(&mut self, provider_name: &str, server_id: &str)
pub fn set_provider(&mut self, provider_name: &str, server_id: &str)
Set provider on a host block. Replaces existing purple:provider comment or adds one.
Sourcepub fn askpass(&self) -> Option<String>
pub fn askpass(&self) -> Option<String>
Extract askpass source from purple:askpass comment in directives.
Sourcepub fn set_askpass(&mut self, source: &str)
pub fn set_askpass(&mut self, source: &str)
Set askpass source on a host block. Replaces existing purple:askpass comment or adds one. Pass an empty string to remove the comment.
Set tags on a host block. Replaces existing purple:tags comment or adds one.
Sourcepub fn to_host_entry(&self) -> HostEntry
pub fn to_host_entry(&self) -> HostEntry
Extract a convenience HostEntry view from this block.
Sourcepub fn tunnel_count(&self) -> u16
pub fn tunnel_count(&self) -> u16
Count forwarding directives (LocalForward, RemoteForward, DynamicForward).
Sourcepub fn has_tunnels(&self) -> bool
pub fn has_tunnels(&self) -> bool
Check if this block has any tunnel forwarding directives.
Sourcepub fn tunnel_directives(&self) -> Vec<TunnelRule>
pub fn tunnel_directives(&self) -> Vec<TunnelRule>
Extract tunnel rules from forwarding directives.