├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── license.md ├── readme.md └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "aho-corasick" 5 | version = "0.7.10" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | dependencies = [ 8 | "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 9 | ] 10 | 11 | [[package]] 12 | name = "autocfg" 13 | version = "0.1.7" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | 16 | [[package]] 17 | name = "base64" 18 | version = "0.9.3" 19 | source = "registry+https://github.com/rust-lang/crates.io-index" 20 | dependencies = [ 21 | "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 22 | "safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 23 | ] 24 | 25 | [[package]] 26 | name = "bitflags" 27 | version = "1.2.1" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | 30 | [[package]] 31 | name = "byteorder" 32 | version = "1.3.4" 33 | source = "registry+https://github.com/rust-lang/crates.io-index" 34 | 35 | [[package]] 36 | name = "cfg-if" 37 | version = "0.1.10" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | 40 | [[package]] 41 | name = "cloudabi" 42 | version = "0.0.3" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | dependencies = [ 45 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 46 | ] 47 | 48 | [[package]] 49 | name = "docopt" 50 | version = "1.1.0" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | dependencies = [ 53 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 54 | "regex 1.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 55 | "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", 56 | "strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", 57 | ] 58 | 59 | [[package]] 60 | name = "fuchsia-cprng" 61 | version = "0.1.1" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | 64 | [[package]] 65 | name = "hermit-abi" 66 | version = "0.1.8" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | dependencies = [ 69 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 70 | ] 71 | 72 | [[package]] 73 | name = "httparse" 74 | version = "1.3.4" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | 77 | [[package]] 78 | name = "hyper" 79 | version = "0.10.16" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | dependencies = [ 82 | "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", 83 | "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 84 | "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 85 | "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 86 | "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 87 | "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 89 | "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 90 | "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 91 | "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 92 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 93 | ] 94 | 95 | [[package]] 96 | name = "idna" 97 | version = "0.1.5" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | dependencies = [ 100 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 101 | "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 102 | "unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 103 | ] 104 | 105 | [[package]] 106 | name = "iron" 107 | version = "0.6.1" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | dependencies = [ 110 | "hyper 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", 111 | "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 112 | "mime_guess 1.8.8 (registry+https://github.com/rust-lang/crates.io-index)", 113 | "modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 114 | "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 115 | "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 116 | "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 117 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 118 | ] 119 | 120 | [[package]] 121 | name = "language-tags" 122 | version = "0.2.2" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | 125 | [[package]] 126 | name = "lazy_static" 127 | version = "1.4.0" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | 130 | [[package]] 131 | name = "libc" 132 | version = "0.2.68" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | 135 | [[package]] 136 | name = "log" 137 | version = "0.3.9" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | dependencies = [ 140 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 141 | ] 142 | 143 | [[package]] 144 | name = "log" 145 | version = "0.4.8" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | dependencies = [ 148 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 149 | ] 150 | 151 | [[package]] 152 | name = "matches" 153 | version = "0.1.8" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | 156 | [[package]] 157 | name = "memchr" 158 | version = "2.3.3" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | 161 | [[package]] 162 | name = "mime" 163 | version = "0.2.6" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | dependencies = [ 166 | "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 167 | ] 168 | 169 | [[package]] 170 | name = "mime_guess" 171 | version = "1.8.8" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | dependencies = [ 174 | "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 175 | "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 176 | "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 177 | "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 178 | ] 179 | 180 | [[package]] 181 | name = "modifier" 182 | version = "0.1.0" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | 185 | [[package]] 186 | name = "mount" 187 | version = "0.4.0" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | dependencies = [ 190 | "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 191 | "sequence_trie 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 192 | ] 193 | 194 | [[package]] 195 | name = "num_cpus" 196 | version = "1.12.0" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | dependencies = [ 199 | "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 200 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 201 | ] 202 | 203 | [[package]] 204 | name = "percent-encoding" 205 | version = "1.0.1" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | 208 | [[package]] 209 | name = "phf" 210 | version = "0.7.24" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | dependencies = [ 213 | "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 214 | ] 215 | 216 | [[package]] 217 | name = "phf_codegen" 218 | version = "0.7.24" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | dependencies = [ 221 | "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 222 | "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 223 | ] 224 | 225 | [[package]] 226 | name = "phf_generator" 227 | version = "0.7.24" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | dependencies = [ 230 | "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", 231 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 232 | ] 233 | 234 | [[package]] 235 | name = "phf_shared" 236 | version = "0.7.24" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | dependencies = [ 239 | "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 240 | "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 241 | ] 242 | 243 | [[package]] 244 | name = "plugin" 245 | version = "0.2.6" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | dependencies = [ 248 | "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 249 | ] 250 | 251 | [[package]] 252 | name = "proc-macro2" 253 | version = "1.0.9" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | dependencies = [ 256 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 257 | ] 258 | 259 | [[package]] 260 | name = "quote" 261 | version = "1.0.3" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | dependencies = [ 264 | "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", 265 | ] 266 | 267 | [[package]] 268 | name = "rand" 269 | version = "0.6.5" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | dependencies = [ 272 | "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 273 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 274 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 275 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 276 | "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 277 | "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 278 | "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 279 | "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 280 | "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 281 | "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 283 | ] 284 | 285 | [[package]] 286 | name = "rand_chacha" 287 | version = "0.1.1" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | dependencies = [ 290 | "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 291 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 292 | ] 293 | 294 | [[package]] 295 | name = "rand_core" 296 | version = "0.3.1" 297 | source = "registry+https://github.com/rust-lang/crates.io-index" 298 | dependencies = [ 299 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 300 | ] 301 | 302 | [[package]] 303 | name = "rand_core" 304 | version = "0.4.2" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | 307 | [[package]] 308 | name = "rand_hc" 309 | version = "0.1.0" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | dependencies = [ 312 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 313 | ] 314 | 315 | [[package]] 316 | name = "rand_isaac" 317 | version = "0.1.1" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | dependencies = [ 320 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 321 | ] 322 | 323 | [[package]] 324 | name = "rand_jitter" 325 | version = "0.1.4" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | dependencies = [ 328 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 330 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 331 | ] 332 | 333 | [[package]] 334 | name = "rand_os" 335 | version = "0.1.3" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | dependencies = [ 338 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 339 | "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 340 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 341 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 342 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 343 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 344 | ] 345 | 346 | [[package]] 347 | name = "rand_pcg" 348 | version = "0.1.2" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | dependencies = [ 351 | "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 352 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 353 | ] 354 | 355 | [[package]] 356 | name = "rand_xorshift" 357 | version = "0.1.1" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | dependencies = [ 360 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 361 | ] 362 | 363 | [[package]] 364 | name = "rdrand" 365 | version = "0.4.0" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | dependencies = [ 368 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 369 | ] 370 | 371 | [[package]] 372 | name = "redox_syscall" 373 | version = "0.1.56" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | 376 | [[package]] 377 | name = "regex" 378 | version = "1.3.5" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | dependencies = [ 381 | "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", 382 | "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 383 | "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", 384 | "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 385 | ] 386 | 387 | [[package]] 388 | name = "regex-syntax" 389 | version = "0.6.17" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | 392 | [[package]] 393 | name = "safemem" 394 | version = "0.3.3" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | 397 | [[package]] 398 | name = "sequence_trie" 399 | version = "0.3.6" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | 402 | [[package]] 403 | name = "serde" 404 | version = "1.0.105" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | dependencies = [ 407 | "serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", 408 | ] 409 | 410 | [[package]] 411 | name = "serde_derive" 412 | version = "1.0.105" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | dependencies = [ 415 | "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", 416 | "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 417 | "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", 418 | ] 419 | 420 | [[package]] 421 | name = "serve" 422 | version = "0.1.0" 423 | dependencies = [ 424 | "docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 425 | "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 426 | "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", 427 | "staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 428 | ] 429 | 430 | [[package]] 431 | name = "siphasher" 432 | version = "0.2.3" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | 435 | [[package]] 436 | name = "smallvec" 437 | version = "1.2.0" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | 440 | [[package]] 441 | name = "staticfile" 442 | version = "0.5.0" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | dependencies = [ 445 | "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 446 | "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 447 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 448 | "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 449 | ] 450 | 451 | [[package]] 452 | name = "strsim" 453 | version = "0.9.3" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | 456 | [[package]] 457 | name = "syn" 458 | version = "1.0.17" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | dependencies = [ 461 | "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", 462 | "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 463 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 464 | ] 465 | 466 | [[package]] 467 | name = "thread_local" 468 | version = "1.0.1" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | dependencies = [ 471 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 472 | ] 473 | 474 | [[package]] 475 | name = "time" 476 | version = "0.1.42" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | dependencies = [ 479 | "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", 480 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 481 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 482 | ] 483 | 484 | [[package]] 485 | name = "traitobject" 486 | version = "0.1.0" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | 489 | [[package]] 490 | name = "typeable" 491 | version = "0.1.2" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | 494 | [[package]] 495 | name = "typemap" 496 | version = "0.3.3" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | dependencies = [ 499 | "unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 500 | ] 501 | 502 | [[package]] 503 | name = "unicase" 504 | version = "1.4.2" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | dependencies = [ 507 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 508 | ] 509 | 510 | [[package]] 511 | name = "unicode-bidi" 512 | version = "0.3.4" 513 | source = "registry+https://github.com/rust-lang/crates.io-index" 514 | dependencies = [ 515 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 516 | ] 517 | 518 | [[package]] 519 | name = "unicode-normalization" 520 | version = "0.1.12" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | dependencies = [ 523 | "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 524 | ] 525 | 526 | [[package]] 527 | name = "unicode-xid" 528 | version = "0.2.0" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | 531 | [[package]] 532 | name = "unsafe-any" 533 | version = "0.4.2" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | dependencies = [ 536 | "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 537 | ] 538 | 539 | [[package]] 540 | name = "url" 541 | version = "1.7.2" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | dependencies = [ 544 | "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 545 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 546 | "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 547 | ] 548 | 549 | [[package]] 550 | name = "version_check" 551 | version = "0.1.5" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | 554 | [[package]] 555 | name = "winapi" 556 | version = "0.3.8" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | dependencies = [ 559 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 560 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 561 | ] 562 | 563 | [[package]] 564 | name = "winapi-i686-pc-windows-gnu" 565 | version = "0.4.0" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | 568 | [[package]] 569 | name = "winapi-x86_64-pc-windows-gnu" 570 | version = "0.4.0" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | 573 | [metadata] 574 | "checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" 575 | "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" 576 | "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" 577 | "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 578 | "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 579 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 580 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 581 | "checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969" 582 | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" 583 | "checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" 584 | "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" 585 | "checksum hyper 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" 586 | "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" 587 | "checksum iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" 588 | "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" 589 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 590 | "checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" 591 | "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" 592 | "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 593 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 594 | "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 595 | "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" 596 | "checksum mime_guess 1.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" 597 | "checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" 598 | "checksum mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e25c06012941aaf8c75f2eaf7ec5c48cf69f9fc489ab3eb3589edc107e386f0b" 599 | "checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" 600 | "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 601 | "checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" 602 | "checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" 603 | "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" 604 | "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" 605 | "checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" 606 | "checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" 607 | "checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" 608 | "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" 609 | "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 610 | "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" 611 | "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" 612 | "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 613 | "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 614 | "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" 615 | "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" 616 | "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" 617 | "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 618 | "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 619 | "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 620 | "checksum regex 1.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048" 621 | "checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" 622 | "checksum safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 623 | "checksum sequence_trie 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee22067b7ccd072eeb64454b9c6e1b33b61cd0d49e895fd48676a184580e0c3" 624 | "checksum serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" 625 | "checksum serde_derive 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)" = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" 626 | "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" 627 | "checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" 628 | "checksum staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "babd3fa68bb7e3994ce181c5f21ff3ff5fffef7b18b8a10163b45e4dafc6fb86" 629 | "checksum strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" 630 | "checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" 631 | "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" 632 | "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 633 | "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" 634 | "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" 635 | "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" 636 | "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" 637 | "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 638 | "checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" 639 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" 640 | "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" 641 | "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 642 | "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 643 | "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 644 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 645 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 646 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "serve" 3 | version = "0.1.0" 4 | authors = ["Adolfo Ochagavía "] 5 | 6 | [dependencies] 7 | iron = "0.6.1" 8 | staticfile = "0.5.0" 9 | serde = { version = "1", features = ["derive"] } 10 | docopt = "1.1.0" 11 | 12 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aochagavia/Serve/71df99367622e5e13d21e257576720fb2039ac8c/license.md -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Serve 2 | ===== 3 | 4 | Serve is a simple command line utility to serve the files in the current 5 | directory via http. 6 | 7 | Note: Serve will not show the list of files in the current directory. It 8 | will only serve files (i.e. `localhost` won't show anything, but 9 | `localhost/index.html` will) 10 | 11 | ### Usage 12 | 13 | ``` 14 | > serve 15 | Listening on port 8080 16 | ``` 17 | 18 | By default serve listens on port 8080, but you can override this by providing 19 | a port number explicitly: 20 | 21 | ``` 22 | > serve 3000 23 | Listening on port 3000 24 | ``` 25 | 26 | ### Building it with Cargo 27 | 28 | As always, Cargo does its job pretty well: 29 | 30 | ``` 31 | cargo build --release 32 | ``` 33 | 34 | **Caveat**: Serve depends on Iron, which in turn depends on OpenSSL. Therefore, 35 | the build will fail in case Cargo can't find OpenSSL in your system. If you are 36 | unsure about what you have to do, please follow the instructions given in the 37 | [rust-openssl repo](https://github.com/sfackler/rust-openssl). 38 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate docopt; 2 | extern crate iron; 3 | extern crate serde; 4 | extern crate staticfile; 5 | 6 | use docopt::Docopt; 7 | use iron::Iron; 8 | use serde::Deserialize; 9 | use staticfile::Static; 10 | 11 | const DEFAULT_PORT: u16 = 8080; 12 | const USAGE: &'static str = " 13 | Serve files in the current directory via HTTP. 14 | 15 | Usage: 16 | serve [] 17 | serve (-h | --help) 18 | 19 | Options: 20 | -h, --help Show this screen 21 | "; 22 | 23 | #[derive(Deserialize)] 24 | struct Args { 25 | arg_port: Option, 26 | } 27 | 28 | fn main() { 29 | let args: Args = Docopt::new(USAGE) 30 | .and_then(|dopt| dopt.deserialize()) 31 | .unwrap_or_else(|e| e.exit()); 32 | 33 | let port = args.arg_port.unwrap_or(DEFAULT_PORT); 34 | 35 | let addr = format!("localhost:{}", port); 36 | 37 | match Iron::new(Static::new(".")).http(&*addr) { 38 | Ok(_) => { 39 | println!("Listening on port {}", port); 40 | } 41 | Err(_) => { 42 | println!( 43 | "Could not start server on port {}. \ 44 | Make sure that you have the required permissions \ 45 | and that the port is not already in use.", 46 | port 47 | ); 48 | } 49 | } 50 | } 51 | --------------------------------------------------------------------------------