4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
8 license-file: doc/LICENSE
15 Hath manipulates network blocks in CIDR notation.
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:
21 * Create a regular expression matching the CIDR block(s). This is
22 because grep will throw up if you feed it CIDR.
24 * Combine small blocks into larger ones. For example, if you have two
25 consecutive \/24s, they might combine into a larger \/23.
27 * View the result of block combination in a useful way.
31 * Find their associated PTR records.
33 Hath has several modes to perform these functions:
36 This computes a (Perl-compatible) regular expression matching
37 the input CIDR blocks. It's the default mode of operation.
40 This combines small blocks into larger ones where possible, and
41 eliminates redundant blocks. The output should be equivalent to
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
50 Shows what would change if you used reduce. Uses diff-like
54 List the IP addresses contained within the given CIDRs.
57 Perform reverse DNS (PTR) lookups on the IP addresses contained
58 within the given CIDRs.
62 Compute a (Perl-compatible) regular expression matching
63 the input CIDR blocks. It's the default mode of operation.
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))
70 Combine two \/24s into a \/23:
73 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
77 List the addresses in 192.168.0.240\/29:
80 $ hath listed <<< 192.168.0.240\/29
91 Perform PTR lookups on all of 198.41.0.4\/30:
94 $ hath reversed <<< 198.41.0.4\/30
95 198.41.0.4: a.root-servers.net.
97 198.41.0.6: rs.internic.net.
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:
107 $ hath reversed +RTS -N25 <<< 198.41.0.4\/24
108 198.41.0.4: a.root-servers.net.
110 198.41.0.6: rs.internic.net.
114 The command-line syntax and complete set of options are documented in
138 base >= 4.6 && < 4.7,
139 bytestring == 0.10.*,
143 parallel-io == 0.3.*,
147 tasty-hunit == 0.8.*,
148 tasty-quickcheck == 0.8.*
153 -fwarn-missing-signatures
154 -fwarn-name-shadowing
158 -fwarn-incomplete-record-updates
159 -fwarn-monomorphism-restriction
160 -fwarn-unused-do-bind
174 type: exitcode-stdio-1.0
175 hs-source-dirs: src test
176 main-is: TestSuite.hs
179 base >= 4.6 && < 4.7,
180 bytestring == 0.10.*,
184 parallel-io == 0.3.*,
188 tasty-hunit == 0.8.*,
189 tasty-quickcheck == 0.8.*
192 -- It's not entirely clear to me why I have to reproduce all of this.
196 -fwarn-missing-signatures
197 -fwarn-name-shadowing
201 -fwarn-incomplete-record-updates
202 -fwarn-monomorphism-restriction
203 -fwarn-unused-do-bind
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
216 main-is: ShellTests.hs
219 base >= 4.6 && < 4.7,
220 bytestring == 0.10.*,
224 parallel-io == 0.3.*,
229 tasty-hunit == 0.8.*,
230 tasty-quickcheck == 0.8.*
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.*,
262 parallel-io == 0.3.*,
267 tasty-hunit == 0.8.*,
268 tasty-quickcheck == 0.8.*
270 -- It's not entirely clear to me why I have to reproduce all of this.
274 -fwarn-missing-signatures
275 -fwarn-name-shadowing
279 -fwarn-incomplete-record-updates
280 -fwarn-monomorphism-restriction
281 -fwarn-unused-do-bind
289 source-repository head
291 location: http://michael.orlitzky.com/git/hath.git