pub struct SshConfig { /* private fields */ }Expand description
Describes the ssh configuration. Configuration is described in this document: http://man.openbsd.org/OpenBSD-current/man5/ssh_config.5
Implementations§
Source§impl SshConfig
impl SshConfig
Sourcepub fn from_hosts(hosts: Vec<Host>) -> Self
pub fn from_hosts(hosts: Vec<Host>) -> Self
Constructs a new SshConfig from a list of Hosts.
You can later also set the DefaultAlgorithms using SshConfig::default_algorithms.
Sourcepub fn query<S: AsRef<str>>(&self, pattern: S) -> HostParams
pub fn query<S: AsRef<str>>(&self, pattern: S) -> HostParams
Query params for a certain host. Returns HostParams for the host.
Sourcepub fn intersecting_hosts(&self, pattern: &str) -> impl Iterator<Item = &Host>
pub fn intersecting_hosts(&self, pattern: &str) -> impl Iterator<Item = &Host>
Get an iterator over the Hosts which intersect with the given host pattern
Sourcepub fn default_algorithms(self, algos: DefaultAlgorithms) -> Self
pub fn default_algorithms(self, algos: DefaultAlgorithms) -> Self
Set default algorithms for ssh.
If you want to use the default algorithms from the system, you can use the Default::default() method.
Sourcepub fn parse(
self,
reader: &mut impl BufRead,
rules: ParseRule,
) -> SshParserResult<Self>
pub fn parse( self, reader: &mut impl BufRead, rules: ParseRule, ) -> SshParserResult<Self>
Parse SshConfig from stream which implements BufRead and return parsed configuration or parser error
§Example
ⓘ
let mut reader = BufReader::new(
File::open(Path::new("./assets/ssh.config"))
.expect("Could not open configuration file")
);
let config = SshConfig::default().parse(&mut reader, ParseRule::STRICT).expect("Failed to parse configuration");Sourcepub fn parse_default_file(rules: ParseRule) -> SshParserResult<Self>
pub fn parse_default_file(rules: ParseRule) -> SshParserResult<Self>
Parse ~/.ssh/config`` file and return parsed configuration [SshConfig`] or parser error
Trait Implementations§
impl Eq for SshConfig
impl StructuralPartialEq for SshConfig
Auto Trait Implementations§
impl Freeze for SshConfig
impl RefUnwindSafe for SshConfig
impl Send for SshConfig
impl Sync for SshConfig
impl Unpin for SshConfig
impl UnwindSafe for SshConfig
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
Mutably borrows from an owned value. Read more