]> gitweb.michael.orlitzky.com - hath.git/blob - hath.cabal
1bdc6d6fce05f45a051a876cf35276acc83f2637
[hath.git] / hath.cabal
1 name: hath
2 version: 0.1.2
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.*,
142 HUnit == 1.2.*,
143 QuickCheck == 2.6.*,
144 MissingH == 1.2.*,
145 parallel-io == 0.3.*,
146 split == 0.2.*,
147 test-framework == 0.8.*,
148 test-framework-hunit == 0.3.*,
149 test-framework-quickcheck2 == 0.3.*
150
151 ghc-options:
152 -Wall
153 -fwarn-hi-shadowing
154 -fwarn-missing-signatures
155 -fwarn-name-shadowing
156 -fwarn-orphans
157 -fwarn-type-defaults
158 -fwarn-tabs
159 -fwarn-incomplete-record-updates
160 -fwarn-monomorphism-restriction
161 -fwarn-unused-do-bind
162 -rtsopts
163 -threaded
164 -optc-O3
165 -optc-march=native
166 -O2
167
168 ghc-prof-options:
169 -prof
170 -auto-all
171 -caf-all
172
173
174 test-suite testsuite
175 type: exitcode-stdio-1.0
176 hs-source-dirs: src test
177 main-is: TestSuite.hs
178
179 build-depends:
180 base >= 4.6 && < 4.7,
181 bytestring == 0.10.*,
182 cmdargs == 0.10.*,
183 dns == 1.*,
184 HUnit == 1.2.*,
185 QuickCheck == 2.6.*,
186 MissingH == 1.2.*,
187 parallel-io == 0.3.*,
188 split == 0.2.*,
189 test-framework == 0.8.*,
190 test-framework-hunit == 0.3.*,
191 test-framework-quickcheck2 == 0.3.*
192
193 -- It's not entirely clear to me why I have to reproduce all of this.
194 ghc-options:
195 -Wall
196 -fwarn-hi-shadowing
197 -fwarn-missing-signatures
198 -fwarn-name-shadowing
199 -fwarn-orphans
200 -fwarn-type-defaults
201 -fwarn-tabs
202 -fwarn-incomplete-record-updates
203 -fwarn-monomorphism-restriction
204 -fwarn-unused-do-bind
205 -rtsopts
206 -threaded
207 -optc-O3
208 -optc-march=native
209 -O2
210
211
212 -- These won't work without shelltestrunner installed in your
213 -- $PATH. Maybe there is some way to tell Cabal that.
214 test-suite shelltests
215 type: exitcode-stdio-1.0
216 hs-source-dirs: test
217 main-is: ShellTests.hs
218
219 build-depends:
220 base >= 4.6 && < 4.7,
221 bytestring == 0.10.*,
222 cmdargs == 0.10.*,
223 dns == 1.*,
224 HUnit == 1.2.*,
225 QuickCheck == 2.6.*,
226 MissingH == 1.2.*,
227 parallel-io == 0.3.*,
228 process == 1.1.*,
229 split == 0.2.*,
230 test-framework == 0.8.*,
231 test-framework-hunit == 0.3.*,
232 test-framework-quickcheck2 == 0.3.*
233
234 -- It's not entirely clear to me why I have to reproduce all of this.
235 ghc-options:
236 -Wall
237 -fwarn-hi-shadowing
238 -fwarn-missing-signatures
239 -fwarn-name-shadowing
240 -fwarn-orphans
241 -fwarn-type-defaults
242 -fwarn-tabs
243 -fwarn-incomplete-record-updates
244 -fwarn-monomorphism-restriction
245 -fwarn-unused-do-bind
246 -rtsopts
247 -threaded
248 -optc-O3
249 -optc-march=native
250 -O2
251
252
253 test-suite shelltests-net
254 type: exitcode-stdio-1.0
255 hs-source-dirs: test
256 main-is: ShellTestsNet.hs
257
258 build-depends:
259 base >= 4.6 && < 4.7,
260 bytestring == 0.10.*,
261 cmdargs == 0.10.*,
262 dns == 1.*,
263 HUnit == 1.2.*,
264 QuickCheck == 2.6.*,
265 MissingH == 1.2.*,
266 parallel-io == 0.3.*,
267 process == 1.1.*,
268 split == 0.2.*,
269 test-framework == 0.8.*,
270 test-framework-hunit == 0.3.*,
271 test-framework-quickcheck2 == 0.3.*
272
273 -- It's not entirely clear to me why I have to reproduce all of this.
274 ghc-options:
275 -Wall
276 -fwarn-hi-shadowing
277 -fwarn-missing-signatures
278 -fwarn-name-shadowing
279 -fwarn-orphans
280 -fwarn-type-defaults
281 -fwarn-tabs
282 -fwarn-incomplete-record-updates
283 -fwarn-monomorphism-restriction
284 -fwarn-unused-do-bind
285 -rtsopts
286 -threaded
287 -optc-O3
288 -optc-march=native
289 -O2
290
291
292 source-repository head
293 type: git
294 location: http://michael.orlitzky.com/git/hath.git
295 branch: master