Class OpenSSHConfig

  • All Implemented Interfaces:
    ConfigRepository

    public class OpenSSHConfig
    extends java.lang.Object
    implements ConfigRepository
    This class implements ConfigRepository interface, and parses OpenSSH's configuration file. The following keywords will be recognized,
    • Host
    • User
    • Hostname
    • Port
    • PreferredAuthentications
    • IdentityFile
    • NumberOfPasswordPrompts
    • ConnectTimeout
    • HostKeyAlias
    • UserKnownHostsFile
    • KexAlgorithms
    • HostKeyAlgorithms
    • Ciphers
    • Macs
    • Compression
    • CompressionLevel
    • ForwardAgent
    • RequestTTY
    • ServerAliveInterval
    • LocalForward
    • RemoteForward
    • ClearAllForwardings
    See Also:
    ConfigRepository
    • Field Detail

      • config

        private final java.util.Hashtable config
      • hosts

        private final java.util.Vector hosts
      • keymap

        private static final java.util.Hashtable keymap
    • Constructor Detail

      • OpenSSHConfig

        OpenSSHConfig​(java.io.Reader r)
               throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • parse

        public static OpenSSHConfig parse​(java.lang.String conf)
                                   throws java.io.IOException
        Parses the given string, and returns an instance of ConfigRepository.
        Parameters:
        conf - string, which includes OpenSSH's config
        Returns:
        an instanceof OpenSSHConfig
        Throws:
        java.io.IOException
      • parseFile

        public static OpenSSHConfig parseFile​(java.lang.String file)
                                       throws java.io.IOException
        Parses the given file, and returns an instance of ConfigRepository.
        Parameters:
        file - OpenSSH's config file
        Returns:
        an instanceof OpenSSHConfig
        Throws:
        java.io.IOException
      • _parse

        private void _parse​(java.io.Reader r)
                     throws java.io.IOException
        Throws:
        java.io.IOException