]> gitweb.michael.orlitzky.com - dead/harbl.git/commitdiff
More import/export cleanup.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 7 Jul 2015 05:16:36 +0000 (01:16 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 7 Jul 2015 05:16:36 +0000 (01:16 -0400)
src/DnsblSite.hs
src/Domain.hs
src/IPv4Pattern.hs
test/TestSuite.hs

index 24d8c96e84b72b6368c30abd4c62fa0c076fd246..bf87a89ef34516dc8bd9416f9ce63d9a0f263f8b 100644 (file)
@@ -4,10 +4,11 @@
 --
 --     postscreen_dnsbl_sites = bl.mailspike.net=127.0.0.[2;10;11]*2, ...
 --
---   Here, the 'Domain' is \"bl.mailspike.net\", the return code
---   pattern is \"127.0.0.[2;10;11]\", and the weight is \"2".
+--   Here, the blacklist (a 'UserDomain') is \"bl.mailspike.net\", the
+--   return code pattern is \"127.0.0.[2;10;11]\", and the weight is
+--   \"2".
 --
-module DnsblSite
+module DnsblSite ()
 where
 
 import Text.Parsec (
@@ -25,7 +26,7 @@ import Text.Parsec (
 import Text.Parsec.String ( Parser )
 import Text.Read ( readMaybe )
 
-
+import Domain ( UserDomain )
 import IPv4Pattern ( IPv4Pattern )
 
 newtype Weight = Weight Int deriving (Eq, Show)
@@ -82,7 +83,5 @@ weight = try parse_weight <|> (eof >> return (Weight 1))
         Nothing -> unexpected "weight: readMaybe failed on a sequence of digits!"
         Just k  -> return $ Weight (if sign == '-' then negate k else k)
 
-newtype Domain = Domain String
-
-data DnsblSite = DnsblSite Domain IPv4Pattern Weight
 
+data DnsblSite = DnsblSite UserDomain IPv4Pattern Weight
index 3ef6f26597a89c730dbb5a36fe14e8e1c5147af4..446a8a63409a8ca9a7e6f7dd48877f4de40426ab 100644 (file)
@@ -5,7 +5,9 @@
 --
 --     <https://tools.ietf.org/html/rfc1035#section-2.3.1>
 --
-module Domain
+module Domain (
+  UserDomain,
+  user_domain )
 where
 
 import Data.Char ( toLower )
index dd95b13be37d4563e064428c0b52ea109d6c49b6..8c605ff97cbfb8881301298897da51b88bb8edae 100644 (file)
 --   v4sequence = v4seq_member | v4sequence ";" v4seq_member
 --   v4seq_member = v4octet | v4octet ".." v4octet
 --
-module IPv4Pattern
+module IPv4Pattern (
+  IPv4Pattern,
+  addresses,
+  ipv4pattern_tests,
+  v4pattern)
 where
 
 
@@ -416,6 +420,11 @@ addresses (IPv4Pattern field1 field2 field3 field4) = do
 
 -- * Tests
 
+ipv4pattern_tests :: TestTree
+ipv4pattern_tests =
+  testGroup "IPv4Pattern Tests" [ v4octet_tests ]
+
+
 v4octet_tests :: TestTree
 v4octet_tests =
   testGroup
index 83a4dec70792083a4e366d0c4d01cefd67680cc0..c7d96137a00724ba0bf4b1548a661129aa2353a3 100644 (file)
@@ -1,8 +1,8 @@
 import Test.Tasty ( TestTree, defaultMain, testGroup )
-import IPv4Pattern ( v4octet_tests )
+import IPv4Pattern ( ipv4pattern_tests )
 
 tests :: TestTree
-tests = testGroup "All Tests" [ v4octet_tests ]
+tests = testGroup "All Tests" [ ipv4pattern_tests ]
 
 main :: IO ()
 main = defaultMain tests