4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
8 license-file: doc/LICENSE
13 Hath manipulates network blocks in CIDR notation.
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:
19 * Create a regular expression matching the CIDR block(s). This is
20 because grep will throw up if you feed it CIDR.
22 * Combine small blocks into larger ones. For example, if you have two
23 consecutive \/24s, they might combine into a larger \/23.
25 * View the result of block combination in a useful way.
29 * Find their associated PTR records.
31 Hath has several modes to perform these functions:
34 This computes a (Perl-compatible) regular expression matching
35 the input CIDR blocks. It's the default mode of operation.
38 This combines small blocks into larger ones where possible, and
39 eliminates redundant blocks. The output should be equivalent to
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
48 Shows what would change if you used reduce. Uses diff-like
52 List the IP addresses contained within the given CIDRs.
55 Perform reverse DNS (PTR) lookups on the IP addresses contained
56 within the given CIDRs.
60 Compute a (Perl-compatible) regular expression matching
61 the input CIDR blocks. It's the default mode of operation.
64 $ hath <<< \"10.0.0.0\/29 10.0.0.8\/29\"
65 ((10)\.(0)\.(0)\.(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15))
68 Combine two \/24s into a \/23:
71 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
75 List the addresses in 192.168.0.240\/29:
78 $ hath listed <<< \"192.168.0.240\/29\"
89 Perform PTR lookups on all of 198.41.0.4\/30:
92 hath reversed <<< \"198.41.0.4\/30\"
93 198.41.0.4: a.root-servers.net.
95 198.41.0.6: rs.internic.net.
99 The DNS lookups are usually the bottleneck for this mode, but we can
100 perform them in parallel. Simply pass the number of threads to the
101 GHC runtime on the command line; for example, the following will
102 perform 25 lookups in parallel:
105 hath reversed +RTS -N25 <<< \"198.41.0.4\/24\"
106 198.41.0.4: a.root-servers.net.
108 198.41.0.6: rs.internic.net.
112 The command-line syntax and complete set of options are documented in
136 base >= 4.6 && < 4.7,
137 bytestring == 0.10.*,
143 parallel-io == 0.3.*,
145 test-framework == 0.8.*,
146 test-framework-hunit == 0.3.*,
147 test-framework-quickcheck2 == 0.3.*
152 -fwarn-missing-signatures
153 -fwarn-name-shadowing
157 -fwarn-incomplete-record-updates
158 -fwarn-monomorphism-restriction
159 -fwarn-unused-do-bind
173 type: exitcode-stdio-1.0
174 hs-source-dirs: src test
175 main-is: TestSuite.hs
178 base >= 4.6 && < 4.7,
179 bytestring == 0.10.*,
185 parallel-io == 0.3.*,
187 test-framework == 0.8.*,
188 test-framework-hunit == 0.3.*,
189 test-framework-quickcheck2 == 0.3.*
191 -- It's not entirely clear to me why I have to reproduce all of this.
195 -fwarn-missing-signatures
196 -fwarn-name-shadowing
200 -fwarn-incomplete-record-updates
201 -fwarn-monomorphism-restriction
202 -fwarn-unused-do-bind
210 -- These won't work without shelltestrunner installed in your
211 -- $PATH. Maybe there is some way to tell Cabal that.
212 test-suite shelltests
213 type: exitcode-stdio-1.0
215 main-is: ShellTests.hs
218 base >= 4.6 && < 4.7,
219 bytestring == 0.10.*,
225 parallel-io == 0.3.*,
228 test-framework == 0.8.*,
229 test-framework-hunit == 0.3.*,
230 test-framework-quickcheck2 == 0.3.*
232 -- It's not entirely clear to me why I have to reproduce all of this.
236 -fwarn-missing-signatures
237 -fwarn-name-shadowing
241 -fwarn-incomplete-record-updates
242 -fwarn-monomorphism-restriction
243 -fwarn-unused-do-bind
251 test-suite shelltests-net
252 type: exitcode-stdio-1.0
254 main-is: ShellTestsNet.hs
257 base >= 4.6 && < 4.7,
258 bytestring == 0.10.*,
264 parallel-io == 0.3.*,
267 test-framework == 0.8.*,
268 test-framework-hunit == 0.3.*,
269 test-framework-quickcheck2 == 0.3.*
271 -- It's not entirely clear to me why I have to reproduce all of this.
275 -fwarn-missing-signatures
276 -fwarn-name-shadowing
280 -fwarn-incomplete-record-updates
281 -fwarn-monomorphism-restriction
282 -fwarn-unused-do-bind
290 source-repository head
292 location: http://michael.orlitzky.com/git/hath.git