IPv6Addr 1.1.4 → 1.1.5
raw patch · 2 files changed
+18/−18 lines, 2 filesdep ~randomPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: random
API changes (from Hackage documentation)
Files
- IPv6Addr.cabal +3/−3
- Text/IPv6Addr.hs +15/−15
IPv6Addr.cabal view
@@ -1,5 +1,5 @@ name: IPv6Addr-version: 1.1.4+version: 1.1.5 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@@ -13,7 +13,7 @@ extra-source-files: README.md cabal-version: >=1.10 -Tested-With: GHC ==8.4.3 || ==8.6.5 || ==8.8.1+Tested-With: GHC ==8.4.4 || ==8.6.5 || ==8.8.3 || ==8.10.1 Source-Repository head Type: git@@ -26,7 +26,7 @@ , text >=1.1 && < 1.3 , iproute >=1.3 && < 1.8 , network >=2.5 && < 4- , random >=1.0 && <= 1.1+ , random >=1.0 && <= 1.2 , attoparsec >=0.12 && < 0.14 , aeson >= 0.8.0.2 && < 1.6 , network-info >=0.2 && <=0.3
Text/IPv6Addr.hs view
@@ -118,10 +118,10 @@ -- toIP6ARPA :: IPv6Addr -> T.Text toIP6ARPA a =- T.reverse (T.concatMap trans $ fromIPv6Addr $ fromJust $ maybeFullIPv6Addr $ fromIPv6Addr a) <> "IP6.ARPA."+ T.reverse (T.concatMap go $ fromIPv6Addr $ fromJust $ maybeFullIPv6Addr $ fromIPv6Addr a) <> "IP6.ARPA." where- trans ':' = T.empty- trans c = "." <> T.pack [c]+ go ':' = T.empty+ go c = "." <> T.pack [c] -- | Returns the Windows UNC path name of the given IPv6 Address. --@@ -129,10 +129,10 @@ -- toUNC :: IPv6Addr -> T.Text toUNC a =- T.concatMap trans (fromIPv6Addr $ fromJust $ maybePureIPv6Addr $ fromIPv6Addr a) <> ".ipv6-literal.net"+ T.concatMap go (fromIPv6Addr $ fromJust $ maybePureIPv6Addr $ fromIPv6Addr a) <> ".ipv6-literal.net" where- trans ':' = "-"- trans c = T.pack [c]+ go ':' = "-"+ go c = T.pack [c] -- | Given an 'IPv6Addr', returns the corresponding 'HostName'. toHostName :: IPv6Addr -> HostName@@ -194,7 +194,7 @@ _ -> 0 guard (ntks > 0) rtks <- randPartialIPv6Addr ntks- let tks' = addColon tks ++ rtks+ let tks' = addColon tks <> rtks guard (isIPv6Addr tks') return $ ipv6TokensToIPv6Addr $ (toDoubleColon . fromDoubleColon) tks'@@ -210,8 +210,8 @@ _ -> (a,b) addColon ts = case last ts of- SixteenBit _ -> ts ++ [Colon]- AllZeros -> ts ++ [Colon]+ SixteenBit _ -> ts <> [Colon]+ AllZeros -> ts <> [Colon] _ -> ts @@ -299,7 +299,7 @@ ipv6TokenToText (SixteenBit s) = s ipv6TokenToText Colon = ":" ipv6TokenToText DoubleColon = "::"-ipv6TokenToText AllZeros = "0" -- "A single 16-bit 0000 field MUST be represented as 0" (RFC 5952, 4.1)+ipv6TokenToText AllZeros = "0" -- "A single 16-bit 0000 field MUST be represented as 0" (RFC 5952, 4.1) ipv6TokenToText (IPv4Addr a) = a -- | Returns 'True' if a list of 'IPv6AddrToken' constitutes a valid IPv6 Address.@@ -374,7 +374,7 @@ where ipv4AddrReplacement ltks = if ipv4AddrRewrite ltks- then init ltks ++ ipv4AddrToIPv6AddrTokens (last ltks)+ then init ltks <> ipv4AddrToIPv6AddrTokens (last ltks) else ltks -- | Returns 'Just' the list of tokenized pure IPv6 address, always rewriting an@@ -386,7 +386,7 @@ return (toDoubleColon . ipv4AddrReplacement . fromDoubleColon $ ltks) where ipv4AddrReplacement ltks' =- init ltks' ++ ipv4AddrToIPv6AddrTokens (last ltks')+ init ltks' <> ipv4AddrToIPv6AddrTokens (last ltks') -- | Tokenize a 'T.Text' into 'Just' a list of 'IPv6AddrToken', or 'Nothing'. maybeIPv6AddrTokens :: T.Text -> Maybe [IPv6AddrToken]@@ -465,9 +465,9 @@ let s = splitAt (fromJust $ elemIndex DoubleColon tks) tks fsts = fst s snds = if not (null (snd s)) then tail(snd s) else []- fste = if null fsts then [] else fsts ++ [Colon]+ fste = if null fsts then [] else fsts <> [Colon] snde = if null snds then [] else Colon : snds- fste ++ allZerosTokensReplacement(quantityOfAllZerosTokenToReplace tks) ++ snde+ fste <> allZerosTokensReplacement(quantityOfAllZerosTokenToReplace tks) <> snde where allZerosTokensReplacement x = intersperse Colon (replicate x AllZeros) quantityOfAllZerosTokenToReplace _x =@@ -485,7 +485,7 @@ zerosToDoubleColon ls (_,1) = ls zerosToDoubleColon ls (i,l) = let ls' = filter (/= Colon) ls- in intersperse Colon (Prelude.take i ls') ++ [DoubleColon] ++ intersperse Colon (drop (i+l) ls')+ in intersperse Colon (Prelude.take i ls') <> [DoubleColon] <> intersperse Colon (drop (i+l) ls') zerosRunToReplace t = let l = longestLengthZerosRun t in (firstLongestZerosRunIndex t l,l)