]> gitweb.michael.orlitzky.com - hath.git/blob - hath.cabal
Switch from test-framework to tasty.
[hath.git] / hath.cabal
1 name: hath
2 version: 0.1.3
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 test/shell/*.test
13 test/shell-net/*.test
14 synopsis:
15 Hath manipulates network blocks in CIDR notation.
16 description:
17 Hath is a Haskell program for working with network blocks in CIDR
18 notation. When dealing with blocks of network addresses, there are a
19 few things that one usually wants to do with them:
20 .
21 * Create a regular expression matching the CIDR block(s). This is
22 because grep will throw up if you feed it CIDR.
23 .
24 * Combine small blocks into larger ones. For example, if you have two
25 consecutive \/24s, they might combine into a larger \/23.
26 .
27 * View the result of block combination in a useful way.
28 .
29 * List them.
30 .
31 * Find their associated PTR records.
32 .
33 Hath has several modes to perform these functions:
34 .
35 [@Regexed@]
36 This computes a (Perl-compatible) regular expression matching
37 the input CIDR blocks. It's the default mode of operation.
38 .
39 [@Reduced@]
40 This combines small blocks into larger ones where possible, and
41 eliminates redundant blocks. The output should be equivalent to
42 the input, though.
43 .
44 [@Duped@]
45 Shows only the blocks that would be removed by reduce; that is, it
46 shows the ones that would get combined into larger blocks or are
47 simply redundant.
48 .
49 [@Diffed@]
50 Shows what would change if you used reduce. Uses diff-like
51 notation.
52 .
53 [@Listed@]
54 List the IP addresses contained within the given CIDRs.
55 .
56 [@Reversed@]
57 Perform reverse DNS (PTR) lookups on the IP addresses contained
58 within the given CIDRs.
59 .
60 /Examples/:
61 .
62 Compute a (Perl-compatible) regular expression matching
63 the input CIDR blocks. It's the default mode of operation.
64 .
65 @
66 $ hath <<< \"10.0.0.0\/29 10.0.0.8\/29\"
67 ((10)\.(0)\.(0)\.(15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0))
68 @
69 .
70 Combine two \/24s into a \/23:
71 .
72 @
73 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
74 10.0.0.0/23
75 @
76 .
77 List the addresses in 192.168.0.240\/29:
78 .
79 @
80 $ hath listed <<< 192.168.0.240\/29
81 192.168.0.240
82 192.168.0.241
83 192.168.0.242
84 192.168.0.243
85 192.168.0.244
86 192.168.0.245
87 192.168.0.246
88 192.168.0.247
89 @
90 .
91 Perform PTR lookups on all of 198.41.0.4\/30:
92 .
93 @
94 $ hath reversed <<< 198.41.0.4\/30
95 198.41.0.4: a.root-servers.net.
96 198.41.0.5:
97 198.41.0.6: rs.internic.net.
98 198.41.0.7:
99 @
100 .
101 The DNS lookups are usually the bottleneck for this mode, but we can
102 perform them in parallel. Simply pass the number of threads to the
103 GHC runtime on the command line; for example, the following will
104 perform 25 lookups in parallel:
105 .
106 @
107 $ hath reversed +RTS -N25 <<< 198.41.0.4\/24
108 198.41.0.4: a.root-servers.net.
109 198.41.0.5:
110 198.41.0.6: rs.internic.net.
111 ...
112 @
113 .
114 The command-line syntax and complete set of options are documented in
115 the man page.
116
117
118 executable hath
119
120 main-is:
121 Main.hs
122
123 hs-source-dirs:
124 src/
125
126 other-modules:
127 Bit
128 Cidr
129 CommandLine
130 DNS
131 ExitCodes
132 IPv4Address
133 Maskable
134 Maskbits
135 Octet
136
137 build-depends:
138 base >= 4.6 && < 4.7,
139 bytestring == 0.10.*,
140 cmdargs == 0.10.*,
141 dns >= 1.2,
142 MissingH == 1.2.*,
143 parallel-io == 0.3.*,
144 QuickCheck == 2.7.*,
145 split == 0.2.*,
146 tasty == 0.8.*,
147 tasty-hunit == 0.8.*,
148 tasty-quickcheck == 0.8.*
149
150 ghc-options:
151 -Wall
152 -fwarn-hi-shadowing
153 -fwarn-missing-signatures
154 -fwarn-name-shadowing
155 -fwarn-orphans
156 -fwarn-type-defaults
157 -fwarn-tabs
158 -fwarn-incomplete-record-updates
159 -fwarn-monomorphism-restriction
160 -fwarn-unused-do-bind
161 -rtsopts
162 -threaded
163 -optc-O3
164 -optc-march=native
165 -O2
166
167 ghc-prof-options:
168 -prof
169 -auto-all
170 -caf-all
171
172
173 test-suite testsuite
174 type: exitcode-stdio-1.0
175 hs-source-dirs: src test
176 main-is: TestSuite.hs
177
178 build-depends:
179 base >= 4.6 && < 4.7,
180 bytestring == 0.10.*,
181 cmdargs == 0.10.*,
182 dns >= 1.2,
183 MissingH == 1.2.*,
184 parallel-io == 0.3.*,
185 QuickCheck == 2.7.*,
186 split == 0.2.*,
187 tasty == 0.8.*,
188 tasty-hunit == 0.8.*,
189 tasty-quickcheck == 0.8.*
190
191
192 -- It's not entirely clear to me why I have to reproduce all of this.
193 ghc-options:
194 -Wall
195 -fwarn-hi-shadowing
196 -fwarn-missing-signatures
197 -fwarn-name-shadowing
198 -fwarn-orphans
199 -fwarn-type-defaults
200 -fwarn-tabs
201 -fwarn-incomplete-record-updates
202 -fwarn-monomorphism-restriction
203 -fwarn-unused-do-bind
204 -rtsopts
205 -threaded
206 -optc-O3
207 -optc-march=native
208 -O2
209
210
211 -- These won't work without shelltestrunner installed in your
212 -- $PATH. Maybe there is some way to tell Cabal that.
213 test-suite shelltests
214 type: exitcode-stdio-1.0
215 hs-source-dirs: test
216 main-is: ShellTests.hs
217
218 build-depends:
219 base >= 4.6 && < 4.7,
220 bytestring == 0.10.*,
221 cmdargs == 0.10.*,
222 dns >= 1.2,
223 MissingH == 1.2.*,
224 parallel-io == 0.3.*,
225 process == 1.1.*,
226 QuickCheck == 2.7.*,
227 split == 0.2.*,
228 tasty == 0.8.*,
229 tasty-hunit == 0.8.*,
230 tasty-quickcheck == 0.8.*
231
232 -- It's not entirely clear to me why I have to reproduce all of this.
233 ghc-options:
234 -Wall
235 -fwarn-hi-shadowing
236 -fwarn-missing-signatures
237 -fwarn-name-shadowing
238 -fwarn-orphans
239 -fwarn-type-defaults
240 -fwarn-tabs
241 -fwarn-incomplete-record-updates
242 -fwarn-monomorphism-restriction
243 -fwarn-unused-do-bind
244 -rtsopts
245 -threaded
246 -optc-O3
247 -optc-march=native
248 -O2
249
250
251 test-suite shelltests-net
252 type: exitcode-stdio-1.0
253 hs-source-dirs: test
254 main-is: ShellTestsNet.hs
255
256 build-depends:
257 base >= 4.6 && < 4.7,
258 bytestring == 0.10.*,
259 cmdargs == 0.10.*,
260 dns >= 1.2,
261 MissingH == 1.2.*,
262 parallel-io == 0.3.*,
263 process == 1.1.*,
264 QuickCheck == 2.7.*,
265 split == 0.2.*,
266 tasty == 0.8.*,
267 tasty-hunit == 0.8.*,
268 tasty-quickcheck == 0.8.*
269
270 -- It's not entirely clear to me why I have to reproduce all of this.
271 ghc-options:
272 -Wall
273 -fwarn-hi-shadowing
274 -fwarn-missing-signatures
275 -fwarn-name-shadowing
276 -fwarn-orphans
277 -fwarn-type-defaults
278 -fwarn-tabs
279 -fwarn-incomplete-record-updates
280 -fwarn-monomorphism-restriction
281 -fwarn-unused-do-bind
282 -rtsopts
283 -threaded
284 -optc-O3
285 -optc-march=native
286 -O2
287
288
289 source-repository head
290 type: git
291 location: http://michael.orlitzky.com/git/hath.git
292 branch: master