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