From 6b024633081ef7e0c8610991a19a1d91a70820f4 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 2 Nov 2020 19:56:57 -0600 Subject: [PATCH] zzz --- Cargo.lock | 1131 ++++++++++++++++++---------------------- Cargo.toml | 49 +- src/builtins/github.rs | 13 + src/builtins/mod.rs | 10 + src/config.rs | 25 +- src/github.rs | 14 +- src/handler.rs | 149 +++--- src/hook.rs | 43 +- src/lib.rs | 47 +- src/main.rs | 9 +- src/service.rs | 107 ++-- 11 files changed, 725 insertions(+), 872 deletions(-) create mode 100644 src/builtins/github.rs create mode 100644 src/builtins/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 667d12c..eb6da9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,20 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - [[package]] name = "aho-corasick" version = "0.7.14" @@ -34,10 +19,10 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" +name = "anyhow" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7" [[package]] name = "atty" @@ -50,26 +35,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" + [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "backtrace" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2baad346b2d4e94a24347adeee9c7a93f412ee94b9cc26e5b59dea23848e9f28" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "bitflags" version = "1.2.1" @@ -78,36 +55,24 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "block-buffer" -version = "0.3.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "arrayref", - "byte-tools", + "generic-array", ] -[[package]] -name = "byte-tools" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - [[package]] name = "bytes" -version = "0.4.12" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "either", - "iovec", -] +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" [[package]] name = "cfg-if" @@ -146,102 +111,44 @@ dependencies = [ ] [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "cloudabi" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils 0.7.2", - "maybe-uninit", + "bitflags", ] [[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" +name = "cpuid-bool" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -dependencies = [ - "crossbeam-utils 0.6.6", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" -dependencies = [ - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] name = "crypto-mac" -version = "0.6.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" +checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" dependencies = [ - "constant_time_eq", "generic-array", + "subtle", ] [[package]] name = "digest" -version = "0.7.6" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] [[package]] name = "dip" -version = "0.1.4" +version = "0.2.0" dependencies = [ - "failure", + "anyhow", "futures", "generic-array", "hmac", @@ -250,6 +157,7 @@ dependencies = [ "mktemp", "notify", "owning_ref", + "parking_lot", "regex", "secstr", "serde", @@ -257,46 +165,11 @@ dependencies = [ "serde_json", "sha-1", "structopt", - "tokio", - "tokio-process", + "tokio 0.3.3", "toml", "walkdir", ] -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.48", - "synstructure", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "filetime" version = "0.2.12" @@ -358,51 +231,127 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.1.30" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" +checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] [[package]] -name = "futures-cpupool" -version = "0.1.8" +name = "futures-channel" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" dependencies = [ - "futures", - "num_cpus", + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" + +[[package]] +name = "futures-executor" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" + +[[package]] +name = "futures-macro" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" + +[[package]] +name = "futures-task" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project 1.0.1", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", ] [[package]] name = "generic-array" -version = "0.9.0" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", + "version_check", ] -[[package]] -name = "gimli" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" - [[package]] name = "h2" -version = "0.1.26" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" dependencies = [ - "byteorder", - "bytes", + "bytes 0.5.6", "fnv", - "futures", + "futures-core", + "futures-sink", + "futures-util", "http", "indexmap", - "log", "slab", - "string", - "tokio-io", + "tokio 0.2.22", + "tokio-util", + "tracing", + "tracing-futures", ] [[package]] @@ -431,9 +380,9 @@ dependencies = [ [[package]] name = "hmac" -version = "0.6.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac", "digest", @@ -441,25 +390,23 @@ dependencies = [ [[package]] name = "http" -version = "0.1.21" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ - "bytes", - "futures", + "bytes 0.5.6", "http", - "tokio-buf", ] [[package]] @@ -469,32 +416,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] -name = "hyper" -version = "0.12.35" +name = "httpdate" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.13.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" dependencies = [ - "bytes", - "futures", - "futures-cpupool", + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", "h2", "http", "http-body", "httparse", - "iovec", + "httpdate", "itoa", - "log", - "net2", - "rustc_version", - "time", - "tokio", - "tokio-buf", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", + "pin-project 1.0.1", + "socket2", + "tokio 0.2.22", + "tower-service", + "tracing", "want", ] @@ -504,7 +451,7 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ - "autocfg", + "autocfg 1.0.1", "hashbrown", ] @@ -528,6 +475,15 @@ dependencies = [ "libc", ] +[[package]] +name = "instant" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "iovec" version = "0.1.4" @@ -573,9 +529,9 @@ checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" dependencies = [ "scopeguard", ] @@ -589,37 +545,12 @@ dependencies = [ "cfg-if 0.1.10", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" -dependencies = [ - "adler", - "autocfg", -] - [[package]] name = "mio" version = "0.6.22" @@ -639,6 +570,19 @@ dependencies = [ "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8962c171f57fcfffa53f4df1bb15ec4c8cf26a7569459c9ceb62d94aab0d9584" +dependencies = [ + "libc", + "log", + "miow 0.3.5", + "ntapi", + "winapi 0.3.9", +] + [[package]] name = "mio-extras" version = "2.0.6" @@ -647,33 +591,10 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", "log", - "mio", + "mio 0.6.22", "slab", ] -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio", - "miow 0.3.5", - "winapi 0.3.9", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - [[package]] name = "miow" version = "0.2.1" @@ -698,9 +619,9 @@ dependencies = [ [[package]] name = "mktemp" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77001ceb9eed65439f3dc2a2543f9ba1417d912686bf224a7738d0966e6dcd69" +checksum = "edf4fc746c5c977923b802d86fc9a95ca79a27d8c487613f68830d68d07c7b27" dependencies = [ "uuid", ] @@ -728,12 +649,21 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.6.22", "mio-extras", "walkdir", "winapi 0.3.9", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num_cpus" version = "1.13.0" @@ -745,71 +675,147 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.22.0" +name = "once_cell" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "owning_ref" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" dependencies = [ "stable_deref_trait", ] [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" dependencies = [ + "instant", "lock_api", "parking_lot_core", - "rustc_version", ] [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ "cfg-if 0.1.10", - "cloudabi", + "cloudabi 0.1.0", + "instant", "libc", "redox_syscall", - "rustc_version", "smallvec", "winapi 0.3.9", ] [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "pin-project" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" dependencies = [ - "unicode-xid 0.1.0", + "pin-project-internal 0.4.27", ] +[[package]] +name = "pin-project" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841" +dependencies = [ + "pin-project-internal 1.0.1", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", + "unicode-xid", ] [[package]] @@ -818,32 +824,38 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2", ] [[package]] name = "rand" -version = "0.3.23" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ + "autocfg 0.1.7", "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", + "rand_chacha", + "rand_core 0.4.2", + "rand_hc", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", "winapi 0.3.9", ] +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.3.1", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -859,6 +871,68 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi 0.0.3", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi 0.3.9", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -892,27 +966,6 @@ version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" -[[package]] -name = "rustc-demangle" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.5" @@ -936,28 +989,13 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "secstr" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb003d53cef244a97516226b01155057c7fa6eb52914933c32f6c98a84182188" +checksum = "cce2c726741c320e5b8f1edd9a21b3c2c292ae94514afd001d41d81ba143dafc" dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.117" @@ -970,9 +1008,9 @@ version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -988,14 +1026,15 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" +checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" dependencies = [ "block-buffer", - "byte-tools", + "cfg-if 0.1.10", + "cpuid-bool", "digest", - "fake-simd", + "opaque-debug", ] [[package]] @@ -1015,12 +1054,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "0.6.13" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -dependencies = [ - "maybe-uninit", -] +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "socket2" @@ -1040,15 +1076,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "string" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" -dependencies = [ - "bytes", -] - [[package]] name = "strsim" version = "0.8.0" @@ -1057,36 +1084,33 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.2.18" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7" +checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8" dependencies = [ "clap", + "lazy_static", "structopt-derive", ] [[package]] name = "structopt-derive" -version = "0.2.18" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107" +checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8" dependencies = [ "heck", - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "syn" -version = "0.15.44" +name = "subtle" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" @@ -1094,21 +1118,9 @@ version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "unicode-xid 0.2.1", -] - -[[package]] -name = "synstructure" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" -dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.48", - "unicode-xid 0.2.1", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] @@ -1130,254 +1142,115 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.1.44" +name = "tokio" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ - "libc", - "wasi", - "winapi 0.3.9", + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "memchr", + "mio 0.6.22", + "pin-project-lite", + "slab", ] [[package]] name = "tokio" -version = "0.1.22" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +checksum = "e5ca08accbcb46f11fd8d2d1c6158c348b7888009a1f39260bcad66f6a454250" dependencies = [ - "bytes", - "futures", - "mio", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "tokio-udp", - "tokio-uds", -] - -[[package]] -name = "tokio-buf" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" -dependencies = [ - "bytes", - "either", - "futures", -] - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes", - "futures", - "tokio-io", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures", -] - -[[package]] -name = "tokio-fs" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" -dependencies = [ - "futures", - "tokio-io", - "tokio-threadpool", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes", - "futures", - "log", -] - -[[package]] -name = "tokio-process" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382d90f43fa31caebe5d3bc6cfd854963394fff3b8cb59d5146607aaae7e7e43" -dependencies = [ - "crossbeam-queue 0.1.2", - "futures", + "autocfg 1.0.1", + "bytes 0.6.0", + "futures-core", "lazy_static", "libc", - "log", - "mio", - "mio-named-pipes", - "tokio-io", - "tokio-reactor", - "tokio-signal", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures", - "lazy_static", - "log", - "mio", + "memchr", + "mio 0.7.5", "num_cpus", "parking_lot", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-signal" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" -dependencies = [ - "futures", - "libc", - "mio", - "mio-uds", + "pin-project-lite", "signal-hook-registry", - "tokio-executor", - "tokio-io", - "tokio-reactor", + "slab", + "tokio-macros", "winapi 0.3.9", ] [[package]] -name = "tokio-sync" -version = "0.1.8" +name = "tokio-macros" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45" dependencies = [ - "fnv", - "futures", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "tokio-tcp" -version = "0.1.4" +name = "tokio-util" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "bytes", - "futures", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue 0.2.3", - "crossbeam-utils 0.7.2", - "futures", - "lazy_static", + "bytes 0.5.6", + "futures-core", + "futures-sink", "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-udp" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" -dependencies = [ - "bytes", - "futures", - "log", - "mio", - "tokio-codec", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-uds" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" -dependencies = [ - "bytes", - "futures", - "iovec", - "libc", - "log", - "mio", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "pin-project-lite", + "tokio 0.2.22", ] [[package]] name = "toml" -version = "0.4.10" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" +dependencies = [ + "cfg-if 0.1.10", + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project 0.4.27", + "tracing", +] + [[package]] name = "try-lock" version = "0.2.3" @@ -1402,12 +1275,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.1" @@ -1416,12 +1283,11 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "uuid" -version = "0.1.18" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c590b5bd79ed10aad8fb75f078a59d8db445af6c743e55c4a53227fc01c13f" +checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" dependencies = [ - "rand 0.3.23", - "rustc-serialize", + "rand", ] [[package]] @@ -1430,6 +1296,12 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + [[package]] name = "walkdir" version = "2.3.1" @@ -1443,21 +1315,14 @@ dependencies = [ [[package]] name = "want" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "futures", "log", "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "winapi" version = "0.2.8" diff --git a/Cargo.toml b/Cargo.toml index 55ce650..c155784 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,28 +1,33 @@ [package] name = "dip" description = "Configurable webhook server." -version = "0.1.4" -authors = ["Michael Zhang "] +version = "0.2.0" +authors = ["Michael Zhang "] +edition = "2018" + +[features] +github = [] +default = ["github"] [dependencies] -failure = "0.1" -futures = "0.1" -generic-array = "0.9" -hmac = "0.6" -hyper = "0.12" -mktemp = "0.3" -lazy_static = "1.1" -notify = "4.0" -owning_ref = "0.3" -regex = "1.0" -secstr = "0.3" -serde = "1.0" -serde_derive = "1.0" -serde_json = "1.0" -sha-1 = "0.7" -structopt = "0.2" -tokio = "0.1" -tokio-process = "0.2" -toml = "0.4" -walkdir = "2.2" +anyhow = "1.0.34" +futures = "0.3.7" +generic-array = "0.14.4" +hmac = "0.10.1" +hyper = { version = "0.13", features = ["stream"] } +lazy_static = "1.4.0" +mktemp = "0.4.0" +notify = "4.0.15" +owning_ref = "0.4.1" +parking_lot = "0.11.0" +regex = "1.4.2" +secstr = "0.4.0" +serde = "1.0.117" +serde_derive = "1.0.117" +serde_json = "1.0.59" +sha-1 = "0.9.1" +structopt = "0.3.20" +tokio = { version = "0.3", features = ["full"] } +toml = "0.5.7" +walkdir = "2.3.1" diff --git a/src/builtins/github.rs b/src/builtins/github.rs new file mode 100644 index 0000000..b0e9bcb --- /dev/null +++ b/src/builtins/github.rs @@ -0,0 +1,13 @@ +use serde_json::Value; +use anyhow::Result; + +use super::Builtin; + +#[derive(Default)] +pub struct Github; + +impl Builtin for Github { + fn handle(&self, env: (), config: (), input: ()) -> Result { + todo!() + } +} diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs new file mode 100644 index 0000000..a1d7e40 --- /dev/null +++ b/src/builtins/mod.rs @@ -0,0 +1,10 @@ +mod github; + +use serde_json::Value; +use anyhow::Result; + +pub use self::github::Github; + +pub trait Builtin { + fn handle(&self, env: (), config: (), input: ()) -> Result; +} diff --git a/src/config.rs b/src/config.rs index 6f40447..52e80a1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; use std::sync::mpsc; use std::time::Duration; -use failure::{err_msg, Error}; +use anyhow::Result; use notify::{self, RecommendedWatcher, RecursiveMode, Watcher}; use walkdir::WalkDir; @@ -19,10 +19,12 @@ pub struct Config { /// The root configuration directory for dip. This argument is required. #[structopt(short = "d", long = "root", parse(from_os_str))] pub root: PathBuf, + /// A string containing the address to bind to. This defaults to /// "0.0.0.0:5000". #[structopt(short = "b", long = "bind", default_value = "0.0.0.0:5000")] pub bind: String, + /// If a hook is specified here, it will be triggered manually exactly once /// and then the program will exit rather than running as a server. #[structopt(short = "h", long = "hook")] @@ -69,13 +71,7 @@ where println!("Reloading config..."); // hold on to the lock while config is being reloaded { - let mut programs = match PROGRAMS.lock() { - Ok(programs) => programs, - Err(err) => { - eprintln!("Could not acquire programs lock: {}", err); - return; - } - }; + let mut programs = PROGRAMS.lock(); // TODO: some kind of smart diff programs.clear(); @@ -96,7 +92,7 @@ where match path .file_name() .and_then(|s| s.to_str()) - .ok_or(err_msg("???")) + .ok_or(anyhow!("???")) .map(|s| { let filename = s.to_owned(); programs.insert(filename, path.to_path_buf()) @@ -106,14 +102,9 @@ where } } } + { - let mut hooks = match HOOKS.lock() { - Ok(hooks) => hooks, - Err(err) => { - eprintln!("Could not acquire hooks lock: {}", err); - return; - } - }; + let mut hooks = HOOKS.lock(); hooks.clear(); let hooks_dir = { let mut p = root.as_ref().to_path_buf(); @@ -129,7 +120,7 @@ where if !path.is_file() { continue; } - match (|path: &Path| -> Result<(), Error> { + match (|path: &Path| -> Result<()> { let hook = Hook::from_file(path)?; let name = hook.get_name(); hooks.insert(name, hook); diff --git a/src/github.rs b/src/github.rs index d1fd074..65c43e6 100644 --- a/src/github.rs +++ b/src/github.rs @@ -3,9 +3,9 @@ use std::iter::FromIterator; use std::path::PathBuf; use std::process::Command; -use failure::{err_msg, Error}; +use anyhow::Result; use generic_array::GenericArray; -use hmac::{Hmac, Mac}; +use hmac::{Hmac, Mac, NewMac}; use secstr::*; use serde::Serialize; use serde_json::{self, Serializer as JsonSerializer, Value as JsonValue}; @@ -55,7 +55,7 @@ pub(crate) fn main( env: &Environment, config: &TomlValue, input: &JsonValue, -) -> Result { +) -> Result { let config_str = { let mut buf: Vec = Vec::new(); { @@ -72,10 +72,10 @@ pub(crate) fn main( if !config.disable_hmac_verify { let secret = GenericArray::from_iter(config.secret.bytes()); let mut mac = Hmac::::new(&secret); - mac.input(payload.body.as_bytes()); + mac.update(payload.body.as_bytes()); let signature = mac - .result() - .code() + .finalize() + .into_bytes() .into_iter() .map(|b| format!("{:02x}", b)) .collect::>() @@ -84,7 +84,7 @@ pub(crate) fn main( let auth = payload .headers .get("x-hub-signature") - .ok_or(err_msg("Missing auth header")) + .ok_or(anyhow!("Missing auth header")) .expect("Missing auth header"); let left = SecStr::from(format!("sha1={}", signature)); diff --git a/src/handler.rs b/src/handler.rs index 37ecd38..b5c4b24 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -1,36 +1,31 @@ use std::fmt; use std::path::PathBuf; -use std::process::{Command, Stdio}; +use std::sync::Arc; +use std::process::Stdio; -use failure::{err_msg, Error}; -use futures::{ - future::{self, Either}, - Future, -}; +use anyhow::Result; use serde::Serialize; use serde_json::{Serializer as JsonSerializer, Value as JsonValue}; -use tokio::io::write_all; -use tokio_process::CommandExt; +use tokio::{io::AsyncWriteExt, process::Command}; use toml::Value as TomlValue; -use crate::github; +use crate::builtins::{Builtin, Github}; /// A single instance of handler as defined by the config. -#[derive(Clone, Debug)] pub struct Handler { pub(crate) config: TomlValue, pub(crate) action: Action, } /// Describes an action that a hook can take. -#[derive(Clone)] pub enum Action { /// A builtin function (for example, the Github handler). - Builtin( - fn(&Environment, &TomlValue, &JsonValue) -> Result, - ), + Builtin(Box), + // Fn(&Environment, &TomlValue, &JsonValue) -> Result>), + /// A command represents a string to be executed by `bash -c`. Command(String), + /// A program represents one of the handlers specified in the `handlers` /// directory. Program(String), @@ -53,22 +48,23 @@ impl fmt::Debug for Action { } impl Handler { - pub(crate) fn from(config: &TomlValue) -> Result { + pub(crate) fn from(config: &TomlValue) -> Result { let handler = config .get("type") - .ok_or(err_msg("No 'type' found."))? + .ok_or(anyhow!("No 'type' found."))? .as_str() - .ok_or(err_msg("'type' is not a string."))?; + .ok_or(anyhow!("'type' is not a string."))?; + let action = match handler { "command" => { let command = config .get("command") - .ok_or(err_msg("No 'command' found"))? + .ok_or(anyhow!("No 'command' found"))? .as_str() - .ok_or(err_msg("'command' is not a string."))?; + .ok_or(anyhow!("'command' is not a string."))?; Action::Command(command.to_owned()) } - "github" => Action::Builtin(github::main), + "github" => Action::Builtin(Box::new(Github::default())), handler => Action::Program(handler.to_owned()), }; let config = config.clone(); @@ -76,12 +72,12 @@ impl Handler { } /// Runs the given [action](Action) and produces a [Future](Future). - pub fn run( + pub async fn run( config: TomlValue, action: Action, temp_path: PathBuf, input: JsonValue, - ) -> impl Future { + ) -> Result<(PathBuf, JsonValue)> { let temp_path_cp = temp_path.clone(); let config_str = { let mut buf: Vec = Vec::new(); @@ -102,72 +98,57 @@ impl Handler { .stderr(Stdio::piped()); }; - let output: Box + Send> = - match action { - Action::Builtin(ref func) => { - let workdir = temp_path_cp.clone(); - let env = Environment { workdir }; - let result = func(&env, &config, &input); - Box::new(future::result(result)) - } - Action::Command(ref cmd) => { - // TODO: allow some kind of simple variable replacement - let mut command = Command::new("/bin/bash"); - command_helper(&mut command); - let child = command.arg("-c").arg(cmd); - let result = child - .output_async() - .map_err(|err| { - err_msg(format!("failed to spawn child: {}", err)) - }) - .and_then(|output| { - let stdout = String::from_utf8(output.stdout) - .unwrap_or_else(|_| String::new()); - let stderr = String::from_utf8(output.stderr) - .unwrap_or_else(|_| String::new()); - future::ok(json!({ - "stdout": stdout, - "stderr": stderr, - })) - }); - Box::new(result) - } - Action::Program(ref path) => { - let mut command = Command::new(&path); - command_helper(&mut command); - let mut child = command - .arg("--config") - .arg(config_str) - .spawn_async() - .expect("could not spawn child"); + let output = match action { + Action::Builtin(ref builtin) => { + let workdir = temp_path_cp.clone(); + let env = Environment { workdir }; + builtin.handle(&env, &config, &input) + } + Action::Command(ref cmd) => { + // TODO: allow some kind of simple variable replacement + let mut command = Command::new("/bin/bash"); + command_helper(&mut command); + let child = command.arg("-c").arg(cmd); + let output = child.output().await?; - let stdin = child.stdin().take().unwrap(); + let stdout = String::from_utf8(output.stdout)?; + let stderr = String::from_utf8(output.stderr)?; - let input = format!("{}", input); - let result = write_all(stdin, input) - .and_then(|_| child.wait_with_output()) - .map_err(|err| err_msg(format!("error: {}", err))) - .and_then(|output| { - let stdout = String::from_utf8(output.stdout) - .unwrap_or_else(|_| String::new()); - let stderr = String::from_utf8(output.stderr) - .unwrap_or_else(|_| String::new()); - if output.status.success() { - Either::A(future::ok(json!({ - "stdout": stdout, - "stderr": stderr, - }))) - } else { - Either::B(future::err(err_msg(format!( - "Failed, stdout: '{}', stderr: '{}'", - stdout, stderr - )))) - } - }); + Ok(json!({ + "stdout": stdout, + "stderr": stderr, + })) + } + Action::Program(ref path) => { + let mut command = Command::new(&path); + command_helper(&mut command); + let mut child = + command.arg("--config").arg(config_str).spawn()?; + let mut stdin = child.stdin.take().unwrap(); - Box::new(result) + let input = format!("{}", input); + stdin.write_all(input.as_bytes()).await?; + + let output = child.wait_with_output().await?; + + let stdout = String::from_utf8(output.stdout)?; + let stderr = String::from_utf8(output.stderr)?; + + if output.status.success() { + Ok(json!({ + "stdout": stdout, + "stderr": stderr, + })) + } else { + Err(anyhow!( + "Failed, stdout: '{}', stderr: '{}'", + stdout, + stderr + )) } - }; + } + }; + output.map(|x| (temp_path_cp, x)) } } diff --git a/src/hook.rs b/src/hook.rs index e68c06b..0d3404a 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -4,10 +4,8 @@ use std::fs::File; use std::io::Read; use std::path::{Path, PathBuf}; -use failure::{err_msg, Error}; -use futures::{stream, Future}; +use anyhow::Result; use serde_json::Value as JsonValue; -use tokio::{self, prelude::*}; use toml::Value; use crate::Handler; @@ -20,16 +18,13 @@ pub struct Hook { impl Hook { /// Creates a hook from a (name, config) pair. - pub fn from( - name: impl Into, - config: &Value, - ) -> Result { + pub fn from(name: impl Into, config: &Value) -> Result { let name = name.into(); let handlers = config .get("handlers") - .ok_or(err_msg("No 'handlers' found."))? + .ok_or(anyhow!("No 'handlers' found."))? .as_array() - .ok_or(err_msg("'handlers' is not an array."))? + .ok_or(anyhow!("'handlers' is not an array."))? .iter() .map(|value: &Value| Handler::from(value)) .collect::, _>>()?; @@ -37,16 +32,16 @@ impl Hook { } /// Creates a hook from a configuration file. - pub fn from_file

(path: P) -> Result + pub fn from_file

(path: P) -> Result where P: AsRef, { let filename = path .as_ref() .file_name() - .ok_or(err_msg("what the fuck bro"))? + .ok_or(anyhow!("what the fuck bro"))? .to_str() - .ok_or(err_msg("???"))? + .ok_or(anyhow!("???"))? .to_owned(); let mut file = File::open(path)?; let mut contents = String::new(); @@ -62,25 +57,25 @@ impl Hook { self.name.clone() } - pub(crate) fn handle( + pub(crate) async fn handle( &self, req: JsonValue, temp_path: PathBuf, - ) -> Result { + ) -> Result { let handlers = self .handlers .iter() - .map(|handler| (handler.config.clone(), handler.action.clone())) + .map(|handler| (handler.config, handler.action)) .collect::>(); - let st = stream::iter_ok::<_, Error>(handlers.into_iter()) - .fold((temp_path, req), |(path, prev), (config, action)| { - Handler::run(config, action, path, prev) - }) - .map(|_| ()) - .map_err(|err: Error| { - println!("Error from stream: {}", err); - }); - tokio::executor::spawn(st); + + let mut path = temp_path; + let mut prev = req; + for (config, action) in handlers { + let result = Handler::run(config, action, path, prev).await?; + path = result.0; + prev = result.1; + } + Ok("success".to_owned()) } } diff --git a/src/lib.rs b/src/lib.rs index 32a16ac..75a2cd6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,31 +6,18 @@ The configurable webhook server. Latest stable binary releases for Linux are ava #![deny(missing_docs)] -extern crate hmac; -extern crate secstr; -extern crate sha1; +#[macro_use] +extern crate anyhow; #[macro_use] extern crate serde_derive; -extern crate failure; -extern crate futures; -extern crate generic_array; -extern crate hyper; -extern crate mktemp; -extern crate owning_ref; -extern crate serde; -extern crate tokio; -extern crate tokio_process; #[macro_use] extern crate serde_json; #[macro_use] extern crate lazy_static; -extern crate notify; #[macro_use] extern crate structopt; -extern crate regex; -extern crate toml; -extern crate walkdir; +mod builtins; pub mod config; mod github; mod handler; @@ -41,13 +28,15 @@ use std::collections::HashMap; use std::net::SocketAddrV4; use std::path::PathBuf; use std::str::FromStr; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; use std::thread; -use failure::Error; -use hyper::rt::Future; -use hyper::service::service_fn; -use hyper::Server; +use anyhow::{Error, Result}; +use hyper::{ + service::{make_service_fn, service_fn}, + Server, +}; +use parking_lot::Mutex; use regex::Regex; pub use crate::config::Config; @@ -67,17 +56,23 @@ lazy_static! { } /// Main entry point of the entire application. -pub fn run(config: &Config) -> Result<(), Error> { +pub async fn run(config: &Config) -> Result<()> { config::load_config(&config.root); let v = config.root.clone(); thread::spawn(|| config::watch(v)); let addr: SocketAddrV4 = SocketAddrV4::from_str(config.bind.as_ref())?; - let server = Server::bind(&addr.into()) - .serve(|| service_fn(dip_service)) - .map_err(|e| eprintln!("server error: {}", e)); + let make_svc = make_service_fn(|conn| async { + Ok::<_, Error>(service_fn(dip_service)) + }); + + let server = Server::bind(&addr.into()).serve(make_svc); println!("Listening on {:?}", addr); - hyper::rt::run(server); + + if let Err(e) = server.await { + eprintln!("server error: {}", e); + } + Ok(()) } diff --git a/src/main.rs b/src/main.rs index 88a3586..8fc8876 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,9 @@ -extern crate dip; -extern crate failure; -extern crate structopt; - +use anyhow::Result; use dip::Config; -use failure::Error; use structopt::StructOpt; -fn main() -> Result<(), Error> { +#[tokio::main] +async fn main() -> Result<()> { let config = Config::from_args(); dip::run(&config) } diff --git a/src/service.rs b/src/service.rs index ceb10f0..2a9a9a5 100644 --- a/src/service.rs +++ b/src/service.rs @@ -1,35 +1,34 @@ use std::collections::HashMap; -use futures::{future, Future, Stream}; -use hyper::{Body, Error, Request, Response, StatusCode}; +use anyhow::Result; +use futures::stream::TryStreamExt; +use hyper::{ + body::{to_bytes, Body}, + Request, Response, StatusCode, +}; use mktemp::Temp; use crate::{HOOKS, URIPATTERN}; -pub(crate) fn dip_service( - req: Request, -) -> Box, Error = Error> + Send> { +pub(crate) async fn dip_service(req: Request) -> Result> { let path = req.uri().path().to_owned(); let captures = match URIPATTERN.captures(path.as_ref()) { Some(value) => value, None => { - return Box::new(future::ok( - Response::builder() - .status(StatusCode::NOT_FOUND) - .body(Body::from("not found")) - .unwrap(), - )) + return Ok(Response::builder() + .status(StatusCode::NOT_FOUND) + .body(Body::from("not found")) + .unwrap()); } }; + let name = match captures.name("name") { Some(value) => value.as_str().to_owned(), None => { - return Box::new(future::ok( - Response::builder() - .status(StatusCode::NOT_FOUND) - .body(Body::from("not found")) - .unwrap(), - )) + return Ok(Response::builder() + .status(StatusCode::NOT_FOUND) + .body(Body::from("not found")) + .unwrap()); } }; @@ -47,43 +46,45 @@ pub(crate) fn dip_service( let method = req.method().as_str().to_owned(); // spawn job - Box::new(req.into_body().concat2().map(move |body| { - let body = String::from_utf8(body.to_vec()).unwrap(); - let req_obj = json!({ - "body": body, - "headers": headers, - "method": method, - }); - let hooks = HOOKS.lock().unwrap(); - { - let mut temp_dir = Temp::new_dir().unwrap(); - let temp_path = temp_dir.to_path_buf(); - assert!(temp_path.exists()); + let body = to_bytes(req.into_body()).await?; - let hook = match hooks.get(&name) { - Some(hook) => hook, - None => { - temp_dir.release(); - return Response::builder() - .status(StatusCode::NOT_FOUND) - .body(Body::from("not found")) - .unwrap_or_else(|_| { - Response::new(Body::from("not found")) - }); - } - }; - let (code, msg) = match hook.handle(req_obj, temp_path) { - Ok(msg) => (StatusCode::ACCEPTED, msg), - Err(msg) => (StatusCode::BAD_REQUEST, msg), - }; + let body = String::from_utf8(body.to_vec()).unwrap(); + let req_obj = json!({ + "body": body, + "headers": headers, + "method": method, + }); - temp_dir.release(); - Response::builder() - .status(code) - .body(Body::from(msg)) - .unwrap_or_else(|err| { - Response::new(Body::from(format!("{}", err))) - }) + let mut temp_dir = Temp::new_dir().unwrap(); + let temp_path = temp_dir.to_path_buf(); + assert!(temp_path.exists()); + + let (code, msg) = { + let hooks = HOOKS.lock(); + + let hook = match hooks.get(&name) { + Some(hook) => hook, + None => { + temp_dir.release(); + return Ok(Response::builder() + .status(StatusCode::NOT_FOUND) + .body(Body::from("not found")) + .unwrap_or_else(|_| { + Response::new(Body::from("not found")) + })); + } + }; + + match hook.handle(req_obj, temp_path).await { + Ok(msg) => (StatusCode::ACCEPTED, msg), + Err(msg) => (StatusCode::BAD_REQUEST, msg.to_string()), } - })) + }; + + temp_dir.release(); + + Ok(Response::builder() + .status(code) + .body(Body::from(msg)) + .unwrap_or_else(|err| Response::new(Body::from(format!("{}", err))))) }