Class KnownHostEntry
- java.lang.Object
-
- org.apache.sshd.client.config.hosts.HostPatternsHolder
-
- org.apache.sshd.client.config.hosts.KnownHostEntry
-
public class KnownHostEntry extends HostPatternsHolder
Contains a representation of an entry in theknown_hosts
file- Author:
- Apache MINA SSHD Project
- See Also:
- sshd(8) man page
-
-
Field Summary
Fields Modifier and Type Field Description static char
MARKER_INDICATOR
Character that denotes that start of a markerstatic String
STD_HOSTS_FILENAME
Standard OpenSSH config file name-
Fields inherited from class org.apache.sshd.client.config.hosts.HostPatternsHolder
ALL_HOSTS_PATTERN, NEGATION_CHAR_PATTERN, NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM, NON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM, PATTERN_CHARS, PORT_VALUE_DELIMITER, SINGLE_CHAR_PATTERN, WILDCARD_PATTERN
-
-
Constructor Summary
Constructors Constructor Description KnownHostEntry()
KnownHostEntry(String line)
-
Method Summary
-
Methods inherited from class org.apache.sshd.client.config.hosts.HostPatternsHolder
findMatchingEntries, findMatchingEntries, getPatterns, isHostMatch, isHostMatch, isSpecificHostPattern, isValidPatternChar, parsePatterns, parsePatterns, setPatterns, toPattern
-
-
-
-
Field Detail
-
MARKER_INDICATOR
public static final char MARKER_INDICATOR
Character that denotes that start of a marker- See Also:
- Constant Field Values
-
STD_HOSTS_FILENAME
public static final String STD_HOSTS_FILENAME
Standard OpenSSH config file name- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KnownHostEntry
public KnownHostEntry()
-
KnownHostEntry
public KnownHostEntry(String line)
- Parameters:
line
- The original line from which this entry was created
-
-
Method Detail
-
getConfigLine
public String getConfigLine()
- Returns:
- The original line from which this entry was created
-
setConfigLine
public void setConfigLine(String line)
-
getMarker
public String getMarker()
-
setMarker
public void setMarker(String marker)
-
getKeyEntry
public AuthorizedKeyEntry getKeyEntry()
-
setKeyEntry
public void setKeyEntry(AuthorizedKeyEntry keyEntry)
-
getHashedEntry
public KnownHostHashValue getHashedEntry()
-
setHashedEntry
public void setHashedEntry(KnownHostHashValue hashedEntry)
-
isHostMatch
public boolean isHostMatch(String host, int port)
Description copied from class:HostPatternsHolder
Checks if a given host name / address matches the entry's host pattern(s)- Overrides:
isHostMatch
in classHostPatternsHolder
- Parameters:
host
- The host name / address - ignored ifnull
/emptyport
- The connection port- Returns:
true
if the name / address matches the pattern(s)- See Also:
HostPatternsHolder.isHostMatch(String, Pattern)
-
getDefaultKnownHostsFile
public static Path getDefaultKnownHostsFile()
- Returns:
- The default
Path
location of the OpenSSH known hosts file
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(Path path, OpenOption... options) throws IOException
- Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(URL url) throws IOException
- Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(InputStream inStream, boolean okToClose) throws IOException
- Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(Reader rdr, boolean okToClose) throws IOException
- Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(BufferedReader rdr) throws IOException
Reads configuration entries- Parameters:
rdr
- TheBufferedReader
to use- Returns:
- The
List
of readKnownHostEntry
-ies - Throws:
IOException
- If failed to parse the read configuration
-
parseKnownHostEntry
public static KnownHostEntry parseKnownHostEntry(String line)
-
parseKnownHostEntry
public static <E extends KnownHostEntry> E parseKnownHostEntry(E entry, String data)
-
-