]> gitweb.michael.orlitzky.com - hath.git/blob - doc/README
Bump cabal version, add homepage, and use sh-compatible examples.
[hath.git] / doc / README
1
2 Overview
3 --------
4
5 Hath is a Haskell program for working with network blocks in CIDR[1]
6 notation. When dealing with blocks of network addresses, there are a
7 few things that you (i.e. I) want to do with them:
8
9 * Create a regular expression matching the CIDR block(s). This is
10 because grep will throw up if you feed it CIDR.
11
12 * Combine small blocks into larger ones. For example, if you have two
13 consecutive /24s, they might combine into a larger /23.
14
15 * View the result of block combination in a useful way.
16
17 Hath does just that. It takes as its input (via stdin, or a file with
18 the -i parameter) a list of CIDR blocks. From now on, assume we have
19 the following in cidrs.txt:
20
21 10.0.0.0/24
22 10.0.1.0/24
23
24
25 Modes
26 -----
27
28 Hath has the following modes:
29
30 * Regexed
31
32 This computes a (Perl-compatible) regular expression matching
33 the input CIDR blocks. It's the default mode of operation.
34
35 $ hath -i cidrs.txt
36 ([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1)
37 \.(0)[^\.0-9])
38
39 * Reduced
40
41 This combines small blocks into larger ones where possible, and
42 eliminates redundant blocks. The output should be equivalent to
43 the input, though.
44
45 $ hath reduced -i cidrs.txt
46 10.0.0.0/23
47
48 * Duped
49
50 Shows only the blocks that would be removed by reduce; that is, it
51 shows the ones that would get combined into larger blocks or are
52 simply redundant.
53
54 $ hath duped -i cidrs.txt
55 10.0.0.0/24
56 10.0.1.0/24
57
58 * Diffed
59
60 Shows what would change if you used reduce. Uses diff-like
61 notation.
62
63 $ hath diffed -i cidrs.txt
64 -10.0.0.0/24
65 -10.0.1.0/24
66 +10.0.0.0/23
67
68 Each of the modes also supports a present-tense flavor; the following
69 are equivalent to their counterparts: regex, reduce, dupe, diff.
70
71
72 Bugs
73 ----
74
75 Send bugs to the moon[2].
76
77
78
79 [1] http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
80
81 [2] michael@orlitzky.com