ssh-known-hosts 0.1.1.0 → 0.2.0.0
raw patch · 3 files changed
+37/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.SSH.KnownHosts: isDNSAddr :: SSHRemoteAddr -> Bool
+ Network.SSH.KnownHosts: isDNSRemote :: SSHRemote -> Bool
+ Network.SSH.KnownHosts: isIPv4Addr :: SSHRemoteAddr -> Bool
+ Network.SSH.KnownHosts: isIPv4Remote :: SSHRemote -> Bool
+ Network.SSH.KnownHosts: isIPv6Addr :: SSHRemoteAddr -> Bool
+ Network.SSH.KnownHosts: isIPv6Remote :: SSHRemote -> Bool
+ Network.SSH.KnownHosts: onAddrPart :: (SSHRemoteAddr -> t) -> SSHRemote -> [t]
Files
- CHANGELOG.md +3/−0
- src/Network/SSH/KnownHosts.hs +33/−0
- ssh-known-hosts.cabal +1/−1
CHANGELOG.md view
@@ -1,6 +1,9 @@ Series 0 --------- + * 0.2.0.0+ * Added `onAddrPart` and Addr and Remote type indication predicates.+ * 0.1.1.0 * Fix test to not require existing user .ssh/known_hosts file. * Added separate changelog
src/Network/SSH/KnownHosts.hs view
@@ -42,6 +42,9 @@ , SSHRemoteAddr(..), SSHRemoteAddrs(..) , KeyAlgorithm, SSHKey, DNSName, SSHRemote(..) , IPv4, IPv6+ , onAddrPart+ , isIPv4Remote, isIPv6Remote, isDNSRemote+ , isIPv4Addr, isIPv6Addr, isDNSAddr , targetAddr ) where @@ -178,3 +181,33 @@ -- representing the contents of that file (by calling 'parseRemotes'). readKnownHostsFile :: String -> IO [SSHRemote] readKnownHostsFile f = parseRemotes <$> TIO.readFile f+++-- | The onAddrPart can be used to apply the specified function to the+-- SSHRemoteAddr portion of an SSHRemote specification.+onAddrPart f (SSHRemote addrs _ _) =+ let oAP (SSH1Addr a) = [f a]+ oAP (SSHAddrs l) = map f l+ in oAP addrs+++-- | The isIPv4Remote, isIPv6Remote, and isDNSRemote predicate tests+-- indicate if the specified SSHRemote is of the indicated type.+isIPv4Remote, isIPv6Remote, isDNSRemote :: SSHRemote -> Bool+isIPv4Remote = or . onAddrPart isIPv4Addr+isIPv6Remote = or . onAddrPart isIPv6Addr+isDNSRemote = or . onAddrPart isDNSAddr+++-- | The isIPv4Addr, isIPv6Addr, and isDNSAddr predicate tests+-- indicate if the specified SSHRemoteAddr is of the indicated type.+isIPv4Addr, isIPv6Addr, isDNSAddr :: SSHRemoteAddr -> Bool+isIPv4Addr (RemoteV4 _) = True+isIPv4Addr (RemoteV4Port _ _) = True+isIPv4Addr _ = False+isIPv6Addr (RemoteV6 _) = True+isIPv6Addr (RemoteV6Port _ _) = True+isIPv6Addr _ = False+isDNSAddr (RemoteDNS _) = True+isDNSAddr (RemoteDNSPort _ _) = True+isDNSAddr _ = False
ssh-known-hosts.cabal view
@@ -1,5 +1,5 @@ name: ssh-known-hosts-version: 0.1.1.0+version: 0.2.0.0 synopsis: Read and interpret the SSH known-hosts file description: