File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,11 @@ module Text.IPv6Addr
16
16
, maybeIPv6Addr
17
17
, maybePureIPv6Addr
18
18
, maybeFullIPv6Addr
19
+ , sameIPv6Addr
19
20
, fromIPv6Addr
20
- , toIP6ARPA
21
- , toHostName
22
21
, toIPv6
22
+ , toHostName
23
+ , toIP6ARPA
23
24
, getIPv6AddrOf
24
25
, randIPv6Addr
25
26
) where
@@ -60,6 +61,15 @@ maybePureIPv6Addr t = maybeTokPureIPv6Addr t >>= ipv6TokensToIPv6Addr
60
61
maybeFullIPv6Addr :: T. Text -> Maybe IPv6Addr
61
62
maybeFullIPv6Addr t = maybeTokPureIPv6Addr t >>= (ipv6TokensToIPv6Addr . expandTokens . fromDoubleColon)
62
63
64
+ -- | Returns 'True' if arguments are two textual representations of the same IPv6 address.
65
+ sameIPv6Addr :: T. Text -> T. Text -> Bool
66
+ sameIPv6Addr a b =
67
+ case maybePureIPv6Addr a of
68
+ Nothing -> False
69
+ Just a' -> case maybePureIPv6Addr b of
70
+ Nothing -> False
71
+ Just b' -> a' == b'
72
+
63
73
-- | Returns the reverse lookup domain name corresponding of the given IPv6 address (RFC 3596 Section 2.5).
64
74
--
65
75
-- > toIP6ARPA (IPv6Addr "4321:0:1:2:3:4:567:89ab") == "b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.2.3.4.IP6.ARPA."
You can’t perform that action at this time.
0 commit comments