IPv6Addr 0.6.2.0 → 0.6.3
raw patch · 3 files changed
+18/−14 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- IPv6Addr.cabal +7/−7
- Text/IPv6Addr/Internal.hs +3/−2
- Text/IPv6Addr/Manip.hs +8/−5
IPv6Addr.cabal view
@@ -1,5 +1,5 @@ name: IPv6Addr-version: 0.6.2.0+version: 0.6.3 synopsis: Library to deal with IPv6 address text representations. description: Library to deal with IPv6 address text representations, canonization and manipulations. homepage: https://github.com/MichelBoucey/IPv6Addr@@ -21,12 +21,12 @@ exposed-modules: Text.IPv6Addr, Text.IPv6Addr.Types, Text.IPv6Addr.Manip, Text.IPv6Addr.Internal other-extensions: OverloadedStrings build-depends: base >=4.6 && <5- , text >=1.1- , iproute >=1.3- , network >=2.5- , random >=1.0- , attoparsec >=0.12- , network-info >=0.2+ , text >=1.1 && <1.3+ , iproute >=1.3 && <1.8+ , network >=2.5 && <2.7+ , random >=1.0 && <=1.1+ , attoparsec >=0.12 && <0.14+ , network-info >=0.2 && <=0.3 default-language: Haskell2010 GHC-Options: -Wall
Text/IPv6Addr/Internal.hs view
@@ -10,9 +10,9 @@ , isIPv6Addr , maybeTokIPv6Addr , maybeTokPureIPv6Addr+ , toDoubleColon , fromDoubleColon , fromIPv6Addr- , toDoubleColon , networkInterfacesIPv6AddrList ) where @@ -66,7 +66,8 @@ AllZeros -> lenconst _ -> False 1 -> case lasttk of- IPv4Addr _ -> (lentks == 13 && cdctks == 0) || (lentks < 12 && cdctks == 1)+ IPv4Addr _ ->+ (lentks == 13 && cdctks == 0) || (lentks < 12 && cdctks == 1) _ -> False _ -> False)) where
Text/IPv6Addr/Manip.hs view
@@ -30,10 +30,11 @@ | c == '_' = intToDigit <$> randomRIO (0,15) | otherwise = return c --- | Generates a random partial 'IPv6Addr' with n 'SixteenBit'+-- | Generates a random partial 'IPv6Addr' with n 'SixteenBit'. randPartialIPv6Addr :: Int -> IO [IPv6AddrToken] randPartialIPv6Addr n- | n > 0 && n < 9 = intersperse Colon <$> replicateM n (randIPv6AddrChunk "____")+ | n > 0 && n < 9 =+ intersperse Colon <$> replicateM n (randIPv6AddrChunk "____") | otherwise = return [] -- | Given a MAC address, returns 'Just' the corresponding 'IPv6AddrToken' list, or 'Nothing'.@@ -58,8 +59,9 @@ -- > getTokIPv6AddrOf "eth0" == Just [SixteenBit "fe80",DoubleColon,SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"] -- getTokIPv6AddrOf :: String -> IO (Maybe [IPv6AddrToken])-getTokIPv6AddrOf s = maybe Nothing (maybeTokIPv6Addr. T.pack . show) <$>- (lookup s <$> networkInterfacesIPv6AddrList)+getTokIPv6AddrOf s =+ maybe Nothing (maybeTokIPv6Addr. T.pack . show) <$>+ (lookup s <$> networkInterfacesIPv6AddrList) -- | Given a valid name of a local network interface, -- returns 'Just' the corresponding list of 'IPv6AddrToken' of the interface's MAC Address,@@ -72,6 +74,7 @@ maybe Nothing (macAddrToIPv6AddrTokens . T.pack . show) <$> (lookup s <$> networkInterfacesMacAddrList) where- networkInterfacesMacAddrList = getNetworkInterfaces >>= \n -> return $ map networkInterfacesMac n+ networkInterfacesMacAddrList = getNetworkInterfaces >>=+ \n -> return $ map networkInterfacesMac n where networkInterfacesMac (NetworkInterface n _ _ m) = (n,m)