]> gitweb.michael.orlitzky.com - hath.git/blob - hath.cabal
Add an example of using multiple threads for DNS lookups.
[hath.git] / hath.cabal
1 name: hath
2 version: 0.0.5
3 cabal-version: >= 1.8
4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
6 category: Utils
7 license: GPL-3
8 license-file: doc/LICENSE
9 build-type: Simple
10 extra-source-files:
11 doc/man1/hath.1
12 synopsis:
13 Hath manipulates network blocks in CIDR notation.
14 description:
15 Hath is a Haskell program for working with network blocks in CIDR
16 notation. When dealing with blocks of network addresses, there are a
17 few things that one usually wants to do with them:
18 .
19 * Create a regular expression matching the CIDR block(s). This is
20 because grep will throw up if you feed it CIDR.
21 .
22 * Combine small blocks into larger ones. For example, if you have two
23 consecutive \/24s, they might combine into a larger \/23.
24 .
25 * View the result of block combination in a useful way.
26 .
27 * List them.
28 .
29 * Find their associated PTR records.
30 .
31 Hath has several modes to perform these functions:
32 .
33 [@Regexed@]
34 This computes a (Perl-compatible) regular expression matching
35 the input CIDR blocks. It's the default mode of operation.
36 .
37 [@Reduced@]
38 This combines small blocks into larger ones where possible, and
39 eliminates redundant blocks. The output should be equivalent to
40 the input, though.
41 .
42 [@Duped@]
43 Shows only the blocks that would be removed by reduce; that is, it
44 shows the ones that would get combined into larger blocks or are
45 simply redundant.
46 .
47 [@Diffed@]
48 Shows what would change if you used reduce. Uses diff-like
49 notation.
50 .
51 [@Listed@]
52 List the IP addresses contained within the given CIDRs.
53 .
54 [@Reversed@]
55 Perform reverse DNS (PTR) lookups on the IP addresses contained
56 within the given CIDRs.
57 .
58 /Examples/:
59 .
60 Combine two \/24s into a \/23:
61 .
62 @
63 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
64 10.0.0.0/23
65 @
66 .
67 Create a perl-compatible regex to be fed to grep:
68 .
69 @
70 $ grep -P `hath regexed -i cidrs.txt` mail.log
71 @
72 .
73 List the addresses in 192.168.0.240\/29:
74 .
75 @
76 $ hath listed <<< \"192.168.0.240\/29\"
77 192.168.0.240
78 192.168.0.241
79 192.168.0.242
80 192.168.0.243
81 192.168.0.244
82 192.168.0.245
83 192.168.0.246
84 192.168.0.247
85 @
86 .
87 Perform PTR lookups on all of 198.41.0.4\/30:
88 .
89 @
90 hath reversed <<< \"198.41.0.4\/30\"
91 198.41.0.4: a.root-servers.net.
92 198.41.0.5:
93 198.41.0.6: rs.internic.net.
94 198.41.0.7:
95 @
96 .
97 The DNS lookups are usually the bottleneck for this mode, but we can
98 perform them in parallel. Simply pass the number of threads to the
99 GHC runtime on the command line; for example, the following will
100 perform 25 lookups in parallel:
101 .
102 @
103 hath reversed +RTS -N25 <<< \"198.41.0.4\/24\"
104 198.41.0.4: a.root-servers.net.
105 198.41.0.5:
106 198.41.0.6: rs.internic.net.
107 ...
108 @
109
110 executable hath
111 build-depends:
112 base >= 4.6 && < 4.7,
113 bytestring == 0.10.*,
114 dns == 1.*,
115 HUnit == 1.2.*,
116 QuickCheck == 2.6.*,
117 MissingH == 1.2.*,
118 parallel-io == 0.3.*,
119 split == 0.2.*,
120 test-framework == 0.8.*,
121 test-framework-hunit == 0.3.*,
122 test-framework-quickcheck2 == 0.3.*
123
124 main-is:
125 Main.hs
126
127 hs-source-dirs:
128 src/
129
130 other-modules:
131 Bit
132 Cidr
133 CommandLine
134 DNS
135 ExitCodes
136 IPv4Address
137 Maskable
138 Maskbits
139 Octet
140
141 ghc-options:
142 -Wall
143 -fwarn-hi-shadowing
144 -fwarn-missing-signatures
145 -fwarn-name-shadowing
146 -fwarn-orphans
147 -fwarn-type-defaults
148 -fwarn-tabs
149 -fwarn-incomplete-record-updates
150 -fwarn-monomorphism-restriction
151 -fwarn-unused-do-bind
152 -rtsopts
153 -threaded
154 -optc-O3
155 -optc-march=native
156 -O2
157
158 ghc-prof-options:
159 -prof
160 -auto-all
161 -caf-all
162
163
164 test-suite testsuite
165 type: exitcode-stdio-1.0
166 hs-source-dirs: src test
167 main-is: TestSuite.hs
168 build-depends:
169 base >= 4.6 && < 4.7,
170 bytestring == 0.10.*,
171 dns == 1.*,
172 HUnit == 1.2.*,
173 QuickCheck == 2.6.*,
174 MissingH == 1.2.*,
175 parallel-io == 0.3.*,
176 split == 0.2.*,
177 test-framework == 0.8.*,
178 test-framework-hunit == 0.3.*,
179 test-framework-quickcheck2 == 0.3.*
180
181 -- It's not entirely clear to me why I have to reproduce all of this.
182 ghc-options:
183 -Wall
184 -fwarn-hi-shadowing
185 -fwarn-missing-signatures
186 -fwarn-name-shadowing
187 -fwarn-orphans
188 -fwarn-type-defaults
189 -fwarn-tabs
190 -fwarn-incomplete-record-updates
191 -fwarn-monomorphism-restriction
192 -fwarn-unused-do-bind
193 -rtsopts
194 -threaded
195 -optc-O3
196 -optc-march=native
197 -O2
198
199 source-repository head
200 type: git
201 location: http://michael.orlitzky.com/git/hath.git
202 branch: master