diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6696398 --- /dev/null +++ b/.gitignore @@ -0,0 +1,156 @@ +target +.k +OLD +tries +tmp +# enviroment to load on bin/build +.env + +# where souce code is clone with git +clone + +# where tools command are found +tools + +# where pipeline templates are found +templates + +# OSX leaves these everywhere on SMB shares +._* + +# OSX trash +.DS_Store + +# Eclipse files +.classpath +.project +.settings/** + +# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA +.idea/ +*.iml + +# Vscode files +.vscode + +# This is where the result of the go build goes +/output*/ +/_output*/ +/_output + +# Emacs save files +*~ +\#*\# +.\#* + +# Vim-related files +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist + +# cscope-related files +cscope.* + +# Go test binaries +*.test +/hack/.test-cmd-auth + +# JUnit test output from ginkgo e2e tests +/junit*.xml + +# Mercurial files +**/.hg +**/.hg* + +# Vagrant +.vagrant +network_closure.sh + +# Local cluster env variables +/cluster/env.sh + +# Compiled binaries in third_party +/third_party/pkg + +# Also ignore etcd installed by hack/install-etcd.sh +/third_party/etcd* +/default.etcd + +# User cluster configs +.kubeconfig + +.tags* + +# Version file for dockerized build +.dockerized-kube-version-defs + +# Web UI +/www/master/node_modules/ +/www/master/npm-debug.log +/www/master/shared/config/development.json + +# Karma output +/www/test_out + +# precommit temporary directories created by ./hack/verify-generated-docs.sh and ./hack/lib/util.sh +/_tmp/ +/doc_tmp/ + +# Test artifacts produced by Jenkins jobs +/_artifacts/ + +# Go dependencies installed on Jenkins +/_gopath/ + +# Config directories created by gcloud and gsutil on Jenkins +/.config/gcloud*/ +/.gsutil/ + +# CoreOS stuff +/cluster/libvirt-coreos/coreos_*.img + +# Juju Stuff +/cluster/juju/charms/* +/cluster/juju/bundles/local.yaml + +# Downloaded Kubernetes binary release +/kubernetes/ + +# direnv .envrc files +.envrc + +# Downloaded kubernetes binary release tar ball +kubernetes.tar.gz + +# generated files in any directory +# TODO(thockin): uncomment this when we stop committing the generated files. +#zz_generated.* +zz_generated.openapi.go +zz_generated_*_test.go + +# TODO(roycaihw): remove this when we stop committing the generated definition +!staging/src/k8s.io/apiextensions-apiserver/pkg/generated/openapi/zz_generated.openapi.go +# low-change blueprint in code-generator to notice changes +!staging/src/k8s.io/code-generator/_examples/apiserver/openapi/zz_generated.openapi.go +# low-change sample-apiserver spec to be compilable when published +!staging/src/k8s.io/sample-apiserver/pkg/generated/openapi/zz_generated.openapi.go + +# make-related metadata +/.make/ + +# Just in time generated data in the source, should never be committed +/test/e2e/generated/bindata.go + +# This file used by some vendor repos (e.g. github.com/go-openapi/...) to store secret variables and should not be ignored +!\.drone\.sec + +# Godeps workspace +/Godeps/_workspace + +/bazel-* +*.pyc + +# generated by verify-vendor.sh +vendordiff.patch diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a7ab3d6 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4082 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "abnf" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47feb9fbcef700639ef28e04ca2a87eab8161a01a075ee227b15c90143805462" +dependencies = [ + "nom", +] + +[[package]] +name = "abnf_to_pest" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "372baaa5d3a422d8816b513bcdb2c120078c8614f7ecbcc3baf34a1634bbbe2e" +dependencies = [ + "abnf", + "indexmap", + "itertools", + "pretty", +] + +[[package]] +name = "addr2line" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + +[[package]] +name = "aead" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "922b33332f54fc0ad13fa3e514601e8d30fb54e1f3eadc36643f6526db645621" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "aes" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "495ee669413bfbe9e8cace80f4d3d78e6d8c8d99579f97fb93bde351b185f2d4" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfde8146762f3c5f3c5cd41aa17a71f3188df09d5857192b658510d850e16068" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "polyval", + "subtle", + "zeroize", +] + +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "ahash" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" +dependencies = [ + "getrandom 0.2.3", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192ec435945d87bc2f70992b4d818154b5feede43c09fb7592146374eac90a6" + +[[package]] +name = "alloc-stdlib" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "annotate-snippets" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c96c3d1062ea7101741480185a6a1275eab01cbe8b20e378d1311bc056d2e08" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61" + +[[package]] +name = "app_auth" +version = "0.1.0" +dependencies = [ + "anyhow", + "app_env", + "app_tools", + "base64", + "casbin", + "chrono", + "dotenv", + "envmnt 0.9.0", + "error-chain", + "glob", + "json", + "once_cell", + "parking_lot", + "rand 0.8.4", + "regex", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "slab", + "tempfile", + "tera", + "thiserror", + "tokio", + "toml", + "url", + "uuid", + "warp", + "yaml-rust", +] + +[[package]] +name = "app_env" +version = "0.1.0" +dependencies = [ + "anyhow", + "app_tools", + "base64", + "dotenv", + "envmnt 0.9.0", + "json", + "once_cell", + "parking_lot", + "rand 0.8.4", + "regex", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tera", + "toml", + "uuid", +] + +[[package]] +name = "app_errors" +version = "0.1.0" +dependencies = [ + "error-chain", + "failure", + "serde", + "serde_derive", +] + +[[package]] +name = "app_tools" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "envmnt 0.9.0", + "json", + "rand 0.8.4", + "regex", + "reqwest", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "slab", + "sthash", + "tempfile", + "tera", + "thiserror", + "toml", + "uuid", + "yaml-rust", +] + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "async-channel" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-compression" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-executor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-mutex", + "blocking", + "futures-lite", + "num_cpus", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +dependencies = [ + "concurrent-queue", + "futures-lite", + "libc", + "log", + "once_cell", + "parking", + "polling", + "slab", + "socket2", + "waker-fn", + "winapi", +] + +[[package]] +name = "async-lock" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-std" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "num_cpus", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[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.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide 0.4.4", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "base64-stream" +version = "1.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af4a999230761e0e7c8d48e5687e868cc30b07d92f8d48a019f736ed8d95c78" +dependencies = [ + "base64", + "educe", + "generic-array 0.14.4", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "blake3" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 0.1.10", + "constant_time_eq", + "crypto-mac", + "digest 0.9.0", + "rayon", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "blocking" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] + +[[package]] +name = "brotli" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f29919120f08613aadcd4383764e00526fc9f18b6c0895814faeed0dd78613e" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1052e1c3b8d4d80eb84a8b94f0a1498797b5fb96314c001156a1c761940ef4ec" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +dependencies = [ + "memchr", +] + +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +dependencies = [ + "memchr", + "safemem", +] + +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "bytemuck" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9966d2ab714d0f785dbac0a0396251a35280aeb42413281617d0209ab4898435" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "captcha" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29256038744434f6d0e1328d7c9050f14aa5fc8562ff065b9e9481ac293ba5bc" +dependencies = [ + "base64", + "hound", + "image", + "lodepng", + "rand 0.7.3", + "serde_json", +] + +[[package]] +name = "casbin" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf280d468b50ee781d1fd6537bbaba44b35f3e2dc466269c36404b3a1eead25" +dependencies = [ + "async-std", + "async-trait", + "indexmap", + "lazy_static", + "regex", + "rhai", + "serde", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chacha20" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee7ad89dc1128635074c268ee661f90c3f7e83d9fd12910608c36b47d6c3412" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1580317203210c517b6d44794abfbe600698276db18127e37ad3e69bf5e848e5" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "chrono-tz" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2554a3155fec064362507487171dcc4edc3df60cb10f3a1fb10ed8094822b120" +dependencies = [ + "chrono", + "parse-zoneinfo", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term 0.11.0", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "clds" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "envmnt 0.9.0", + "flate2", + "openssh", + "regex", + "reqenv", + "rfm", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tar", + "tempfile", + "tera", + "tokio", +] + +[[package]] +name = "cloudmandala" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "base64-stream", + "blake3", + "captcha", + "chrono", + "clds", + "debug_stub_derive", + "dotenv", + "env_logger 0.8.4", + "envmnt 0.9.0", + "error-chain", + "faccess", + "failure", + "futures 0.3.15", + "futures-cpupool", + "git2", + "glob", + "hyper", + "json", + "key_of_life", + "lazy_static", + "log", + "once_cell", + "openssh", + "openssl", + "openssl-sys", + "pretty_env_logger", + "qstring", + "rand 0.8.4", + "regex", + "reqwest", + "rfm", + "sanitize-filename", + "serde", + "serde_derive", + "serde_dhall", + "serde_json", + "serde_yaml", + "slab", + "stderrlog", + "sthash", + "structopt", + "tempfile", + "tera", + "thiserror", + "tkdr", + "tokio", + "tokio-util", + "toml", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "cpufeatures" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "ctor" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +dependencies = [ + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "ctr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" +dependencies = [ + "cipher", +] + +[[package]] +name = "debug_stub_derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496b7f8a2f853313c3ca370641d7ff3e42c32974fdccda8f0684599ed0a3ff6b" +dependencies = [ + "quote 0.3.15", + "syn 0.11.11", +] + +[[package]] +name = "deflate" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" +dependencies = [ + "adler32", + "byteorder", +] + +[[package]] +name = "deunicode" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" + +[[package]] +name = "dhall" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d7b648a24d2edd4ba9f31fe42c831080522d1cf35bca3522887ba0d802745" +dependencies = [ + "abnf_to_pest", + "annotate-snippets", + "elsa", + "hex", + "itertools", + "lazy_static", + "once_cell", + "percent-encoding", + "pest", + "pest_consume", + "pest_generator", + "quote 1.0.9", + "reqwest", + "serde", + "serde_cbor", + "sha2", + "url", +] + +[[package]] +name = "dhall_proc_macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64ba6f41d9b223e2e1d7c97a1145a1aa03e57d65e1c9c2baa29f194caf322c9" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dtoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" + +[[package]] +name = "educe" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b50932a01e7ec5c06160492ab660fb19b6bb2a7878030dd6cd68d21df9d4d" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "elsa" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848344296205756adc00ab3bec02658da0f72eaa1461474aa2d51d64311876a5" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "enc_file" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e60880ea95b149257a2f9884a228d29b57fb36f21a98947fdb5d200a1bbde4dd" +dependencies = [ + "aes-gcm-siv", + "bincode", + "blake3", + "chacha20poly1305", + "rand 0.8.4", + "serde", + "sha2", +] + +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "enum-ordinalize" +version = "3.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b166c9e378360dd5a6666a9604bb4f54ae0cac39023ffbac425e917a2a04fef" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "atty", + "humantime 2.1.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "envmnt" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" +dependencies = [ + "fsio 0.1.3", + "indexmap", +] + +[[package]] +name = "envmnt" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbfac51e9996e41d78a943227b7f313efcebf545b21584a0e213b956a062e11e" +dependencies = [ + "fsio 0.2.0", + "indexmap", +] + +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "backtrace", + "version_check", +] + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "faccess" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e039175679baf763ddddf4f76900b92d4dae9411ee88cf42d2f11b976b09e07c" +dependencies = [ + "bitflags", + "libc", + "winapi", +] + +[[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", + "quote 1.0.9", + "syn 1.0.73", + "synstructure", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fallible_collections" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad9169582543d2cfe9961be1e9eaf4fc42f9aa3483f7c485717b8dde36466ea" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "fastrand" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +dependencies = [ + "instant", +] + +[[package]] +name = "filetime" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "winapi", +] + +[[package]] +name = "flate2" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide 0.4.4", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fsio" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3" + +[[package]] +name = "fsio" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50045aa8931ae01afbc5d72439e8f57f326becb8c70d07dfc816778eff3d167" + +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + +[[package]] +name = "futures" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" + +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +dependencies = [ + "futures 0.1.31", + "num_cpus", +] + +[[package]] +name = "futures-executor" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +dependencies = [ + "autocfg", + "proc-macro-hack", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "futures-sink" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" + +[[package]] +name = "futures-task" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" + +[[package]] +name = "futures-util" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +dependencies = [ + "autocfg", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gif" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a668f699973d0f573d15749b7002a9ac9e1f9c6b220e7b165601334c173d8de" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gimli" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" + +[[package]] +name = "git2" +version = "0.13.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9831e983241f8c5591ed53f17d874833e2fa82cac2625f3888c50cbfe136cba" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "globset" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0fc1b9fa0e64ffb1aa5b95daa0f0f167734fd528b7c02eabc581d9d843649b1" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "globwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +dependencies = [ + "bitflags", + "ignore", + "walkdir", +] + +[[package]] +name = "gloo-timers" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash 0.4.7", +] + +[[package]] +name = "headers" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" +dependencies = [ + "base64", + "bitflags", + "bytes", + "headers-core", + "http", + "mime", + "sha-1 0.9.6", + "time", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hound" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" + +[[package]] +name = "http" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" + +[[package]] +name = "httpdate" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" + +[[package]] +name = "humansize" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026" + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" +dependencies = [ + "crossbeam-utils", + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + +[[package]] +name = "image" +version = "0.23.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "gif", + "jpeg-decoder", + "num-iter", + "num-rational", + "num-traits", + "png", + "scoped_threadpool", + "tiff", +] + +[[package]] +name = "indexmap" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "input_buffer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" +dependencies = [ + "bytes", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "ipnet" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "jobserver" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd" +dependencies = [ + "libc", +] + +[[package]] +name = "jpeg-decoder" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" +dependencies = [ + "rayon", +] + +[[package]] +name = "js-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" + +[[package]] +name = "key_of_life" +version = "0.1.0" +dependencies = [ + "base64", + "envmnt 0.8.4", + "os_info", + "reqwest", + "tkdr", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec", + "bitflags", + "cfg-if 1.0.0", + "ryu", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" + +[[package]] +name = "libgit2-sys" +version = "0.12.21+1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86271bacd72b2b9e854c3dcfb82efd538f15f870e4c11af66900effb462f6825" +dependencies = [ + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +] + +[[package]] +name = "libssh2-sys" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0186af0d8f171ae6b9c4c90ec51898bad5d08a2d5e470903a50d9ad8959cbee" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + +[[package]] +name = "lock_api" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lodepng" +version = "3.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f7ef1b146a329001ccc6ad5fc1def8300281dda5176e8336b7fd44e440fb96" +dependencies = [ + "fallible_collections", + "flate2", + "libc", + "rgb", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", + "value-bag", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" + +[[package]] +name = "memoffset" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "multipart" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" +dependencies = [ + "buf_redux", + "httparse", + "log", + "mime", + "mime_guess", + "quick-error", + "rand 0.7.3", + "safemem", + "tempfile", + "twoway", +] + +[[package]] +name = "native-tls" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nom" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +dependencies = [ + "lexical-core", + "memchr", + "version_check", +] + +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssh" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97c2b27e5a865d02ade0d50eca7b1713bf4287083aa7459a5e8ff5b0e69975bc" +dependencies = [ + "shell-escape", + "tempfile", + "tokio", +] + +[[package]] +name = "openssl" +version = "0.10.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" + +[[package]] +name = "openssl-sys" +version = "0.9.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_info" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d2536ab8ff7605e8dc7044ec2f3eb0d49750cb559af9e5373c4564a3706cdd" +dependencies = [ + "log", + "winapi", +] + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parse-zoneinfo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" +dependencies = [ + "regex", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_consume" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f06d200abe3be440ee3be3dcd2a65518250c0181364a332fa334b35152cb82e" +dependencies = [ + "pest", + "pest_consume_macros", + "pest_derive", + "proc-macro-hack", +] + +[[package]] +name = "pest_consume_macros" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "466dea9184791ec0b5304cc103dcbd3f267b0157aa60b2efc74ea1b1c886ea51" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1 0.8.2", +] + +[[package]] +name = "pin-project" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "png" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" +dependencies = [ + "bitflags", + "crc32fast", + "deflate", + "miniz_oxide 0.3.7", +] + +[[package]] +name = "polling" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-ffi", + "winapi", +] + +[[package]] +name = "poly1305" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe800695325da85083cd23b56826fccb2e2dc29b218e7811a6f33bc93f414be" +dependencies = [ + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e597450cbf209787f0e6de80bf3795c6b2356a380ee87837b545aded8dbc1823" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "pretty" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60c0d9f6fc88ecdd245d90c1920ff76a430ab34303fc778d33b1d0a4c3bf6d3" +dependencies = [ + "typed-arena", +] + +[[package]] +name = "pretty_env_logger" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +dependencies = [ + "env_logger 0.7.1", + "log", +] + +[[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 1.0.9", + "syn 1.0.73", + "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 1.0.9", + "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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +dependencies = [ + "unicode-xid 0.2.2", +] + +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.3", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom 0.2.3", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core 0.6.3", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqenv" +version = "0.1.0" +dependencies = [ + "anyhow", + "app_auth", + "app_env", + "app_errors", + "app_tools", + "base64", + "casbin", + "chrono", + "dotenv", + "envmnt 0.9.0", + "error-chain", + "glob", + "json", + "once_cell", + "parking_lot", + "rand 0.8.4", + "regex", + "reqtasks", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "slab", + "tempfile", + "tera", + "thiserror", + "tokio", + "toml", + "url", + "uuid", + "warp", + "yaml-rust", +] + +[[package]] +name = "reqtasks" +version = "0.1.0" +dependencies = [ + "anyhow", + "app_auth", + "app_env", + "app_errors", + "app_tools", + "base64", + "casbin", + "chrono", + "dotenv", + "envmnt 0.9.0", + "error-chain", + "glob", + "json", + "once_cell", + "parking_lot", + "rand 0.8.4", + "regex", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "slab", + "tempfile", + "tera", + "thiserror", + "tokio", + "toml", + "url", + "uuid", + "warp", + "yaml-rust", +] + +[[package]] +name = "reqwest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rfm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3561b82ad64cc977b5d04da33e289353f20221f5fb267d95b502407c13eead" + +[[package]] +name = "rgb" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fddb3b23626145d1776addfc307e1a1851f60ef6ca64f376bcb889697144cf0" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "rhai" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e39f22e6f2e7ecf283d206eb5fcfae2652b05c43f9956f79341fd87f7a4234b9" +dependencies = [ + "ahash 0.7.4", + "instant", + "num-traits", + "rhai_codegen", + "serde", + "smallvec", + "smartstring", +] + +[[package]] +name = "rhai_codegen" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643fd67d19aafd45a9e335afe4183dc58ba0cc6a1f43fbe34c7d92c041cdcafc" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "sanitize-filename" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf18934a12018228c5b55a6dae9df5d0641e3566b3630cb46cc55564068e7c2f" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_cbor" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +dependencies = [ + "half", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "serde_dhall" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1393976875f3080d8cd1ff54083129e2e6a30d7a62582b67c3eb5924789e8e75" +dependencies = [ + "dhall", + "dhall_proc_macros", + "doc-comment", + "serde", + "url", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" +dependencies = [ + "dtoa", + "linked-hash-map", + "serde", + "yaml-rust", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha-1" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sha2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sharded-slab" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shell-escape" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" + +[[package]] +name = "slug" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" +dependencies = [ + "deunicode", +] + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "smartstring" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31aa6a31c0c2b21327ce875f7e8952322acfcfd0c27569a6e18a647281352c9b" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "socket2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stderrlog" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a53e2eff3e94a019afa6265e8ee04cb05b9d33fe9f5078b14e4e391d155a38" +dependencies = [ + "atty", + "chrono", + "log", + "termcolor", + "thread_local", +] + +[[package]] +name = "sthash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7db715ceec6d71162f7985a33f826750340d86767f34866ab772ae56dee0ec" +dependencies = [ + "byteorder", + "tiny-keccak", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "structopt" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "subtle" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" + +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +dependencies = [ + "quote 0.3.15", + "synom", + "unicode-xid 0.0.4", +] + +[[package]] +name = "syn" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.2", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +dependencies = [ + "unicode-xid 0.0.4", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", + "unicode-xid 0.2.2", +] + +[[package]] +name = "tar" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d779dc6aeff029314570f666ec83f19df7280bb36ef338442cfa8c604021b80" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "rand 0.8.4", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "tera" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b6d9027cef72979d3436123f940cb372d5db2ae8afd328c482e8da7ff23aca" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand 0.8.4", + "regex", + "serde", + "serde_json", + "slug", + "unic-segment", +] + +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tiff" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" +dependencies = [ + "jpeg-decoder", + "miniz_oxide 0.4.4", + "weezl", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tkdr" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64", + "blake3", + "chrono", + "dotenv", + "enc_file", + "envmnt 0.8.4", + "failure", + "futures 0.3.15", + "futures-cpupool", + "json", + "rand 0.8.4", + "regex", + "reqwest", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tera", + "toml", + "uuid", +] + +[[package]] +name = "tokio" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" +dependencies = [ + "futures-util", + "log", + "pin-project", + "tokio", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5553bf0883ba7c9cbe493b085c29926bd41b66afc31ff72cf17ff4fb60dcd5" +dependencies = [ + "ansi_term 0.12.1", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "tungstenite" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" +dependencies = [ + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "input_buffer", + "log", + "rand 0.8.4", + "sha-1 0.9.6", + "url", + "utf-8", +] + +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +dependencies = [ + "memchr", +] + +[[package]] +name = "typed-arena" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.3", + "serde", + "sha1", +] + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" +dependencies = [ + "ctor", + "version_check", +] + +[[package]] +name = "vcpkg" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70455df2fdf4e9bf580a92e443f1eb0303c390d682e2ea817312c9e81f8c3399" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "warp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" +dependencies = [ + "async-compression", + "bytes", + "futures 0.3.15", + "headers", + "http", + "hyper", + "log", + "mime", + "mime_guess", + "multipart", + "percent-encoding", + "pin-project", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tokio-stream", + "tokio-tungstenite", + "tokio-util", + "tower-service", + "tracing", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +dependencies = [ + "cfg-if 1.0.0", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +dependencies = [ + "quote 1.0.9", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +dependencies = [ + "proc-macro2", + "quote 1.0.9", + "syn 1.0.73", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" + +[[package]] +name = "web-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "weezl" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e" + +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi", +] + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +dependencies = [ + "libc", +] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..3b7d776 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,115 @@ +[package] +name = "cloudmandala" +version = "0.1.0" +authors = ["JesusPerez "] +edition = "2018" + +[dependencies] + +log = "0.4" +stderrlog = "0.5" +structopt = "0.3" +faccess = "0.2.3" + +## +anyhow = "1.0.40" +# argonautica = "0.2.0" +# +## +blake3 = "0.3.7" +base64 = "0.13.0" +base64-stream = "1.2.5" +captcha = "0.0.8" +chrono = "0.4" +dotenv = "0.15.0" +debug_stub_derive = "0.3.0" +env_logger = "0.8.2" +envmnt = "0.9.0" +error-chain = "0.12.4" +failure = "0.1.8" +futures = "0.3.12" +futures-cpupool = "0.1.8" +git2 = "0.13" +glob = "0.3.0" +json = "0.12.4" +# jsonnet-rs = "0.6.0" +#jwtvault = "0.7.0" +# jwt-simple = "0.2" +lazy_static = "1.4.0" +once_cell = "1.7.2" +openssh = "0.8.0" +openssl-sys = "0.9" +openssl = { version = "0.10", features = ["v110"] } +qstring = "0.7.2" +#r2d2 = "0.8.9" +#r2d2_mysql="18.0.0" +# redis-async = "0.6.3" +rand = "0.8.3" +#redis = { version = "0.19.0", features = [ "tokio-comp", "cluster"] } +regex = "1.5.4" +reqwest = "0.11.3" +rfm = "0.8.0" +sanitize-filename = "0.3.0" +serde = { version = "1.0", features = ["derive"] } +#serde_cbor = "0.11.1" +serde_derive = "1.0" +serde_dhall = "0.10.0" +serde_json = "1.0" +serde_yaml = "0.8.17" + +slab = "0.4.3" +# sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "mysql", "macros", "runtime-actix" ] } +#sqlx = {version = "0.5.1", default-features = false, features = ["macros","runtime-tokio-rustls","sqlite", "mysql", "postgres", "decimal", "chrono"]} + +sthash = "0.2.10" +tempfile = "3.2.0" +tera = "1.8.0" +# tikv-client = { git = "https://github.com/tikv/client-rust.git" } +#tokio = { version = "0.3", features = ["time", "stream"] } +#tokio = { version = "0.3", features = ["full"] } +#tokio = { version = "0.3.7", features = ["full"] } +tokio = { version = "1.5.0", features = ["full"] } +tokio-util = { version = "0.6", features = ["codec"] } +hyper = { version = "0.14.7", features = ["full"] } +thiserror = "1.0" +toml = "0.5" +# thrussh = "0.32.2" +# thrussh-keys = "0.20.2" +#yaml-rust = "0.4" +uuid = { version = "0.8", features = ["serde", "v5"] } +pretty_env_logger = "0.4" + +tkdr = { path = "../lib/tkdr" } +key_of_life = { path = "../lib/key_of_life" } + +clds = { path = "../lib/clds" } + +[profile.release] +lto = true +codegen-units = 1 +opt-level = "z" + +[dev-dependencies] +tracing-subscriber = "0.2.18" +[build-dependencies] +envmnt = "0.9.0" + +[features] +# Nothing by default +default = [] + +# Easily turn it all on +# Uncomment to sacrifice Drop-on-panic cleanup and std::panic::catch_unwind +# for ~24K space saving +#panic = 'abort' + +# [patch.crates-io] +# raft-proto = { git = "https://github.com/tikv/raft-rs", rev = "e624c1d48460940a40d8aa69b5329460d9af87dd" } + +[workspace.metadata.local-install] +cargo-web = "0.1" # == "^0.6" - includes "0.6.26" - locked by default +# cargo-web = { version = "0.6", registry = "crates.io", locked = false } # `locked = false` ignores cargo-web's Cargo.lock +# cargo-web = { path = "../cargo-web" } +# cargo-web = { git = "https://github.com/koute/cargo-web" } +# cargo-web = { git = "https://github.com/koute/cargo-web", branch = "master" } +# cargo-web = { git = "https://github.com/koute/cargo-web", rev = "a9895bf536e8ac6a0806382886b7be90138f01f3" } diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..963d3e7 --- /dev/null +++ b/src/app.rs @@ -0,0 +1,327 @@ +/*! Application-specific logic lives here + + **TODO:** Look into moving the argument definition into a + [build.rs](https://doc.rust-lang.org/cargo/reference/build-scripts.html) like in the + [clap_generate](https://docs.rs/clap_generate/3.0.0-beta.1/clap_generate/fn.generate_to.html) + examples so I don't have build the completion generation code into the output binary. +*/ + +// Parts Copyright 2017-2021, Stephan Sokolow + +// Standard library imports +// use std::path::PathBuf; +// use std::process; +use std::fs; +use std::collections::HashMap; + +// 3rd-party crate imports +use anyhow::Result; +use structopt::StructOpt; + +// Local Imports +use crate::helpers::{BoilerplateOpts, HELP_TEMPLATE}; +// use crate::validators::path_readable_file; +use crate::clouds::{on_cloud}; +use crate::defs::{BxDynResult}; +use clds::clouds::on_clouds::clear_specs; + +use tkdr::crypt_lib::{encrypt, decrypt}; +use tkdr::tera_lib::{hash_from_data, data_templated, hash_content}; +use tkdr::randomkey::{RandomKey}; +use key_of_life::get_key; + +/// The verbosity level when no `-q` or `-v` arguments are given, with `0` being `-q` +pub const DEFAULT_VERBOSITY: u64 = 1; + + + +/// Default KEY PATH +pub const KEY_PATH: &str = ".k"; +/// Command-line argument schema +/// +/// ## Relevant Conventions: +/// +/// * Make sure that there is a blank space between the `` `` line and the +/// description text or the `--help` output won't comply with the platform conventions that +/// `help2man` depends on to generate your manpage. (Specifically, it will mistake the ` +/// ` line for part of the description.) +/// * `StructOpt`'s default behaviour of including the author name in the `--help` output is an +/// oddity among Linux commands and, if you don't disable it, you run the risk of people +/// unfamiliar with `StructOpt` assuming that you are an egotistical person who made a conscious +/// choice to add it. +/// +/// The proper standardized location for author information is the `AUTHOR` section which you +/// can read about by typing `man help2man`. +/// +/// ## Cautions: +/// * Subcommands do not inherit `template` and it must be re-specified for each one. +/// ([clap-rs/clap#1184](https://github.com/clap-rs/clap/issues/1184)) +/// * Double-check that your choice of `about` or `long_about` is actually overriding this +/// doc comment. The precedence has some bugs such as +/// [TeXitoi/structopt#391](https://github.com/TeXitoi/structopt/issues/391) and +/// [TeXitoi/structopt#333](https://github.com/TeXitoi/structopt/issues/333). +/// * Do not begin the description text for subcommands with `\n`. It will break the formatting in +/// the top-level help output's list of subcommands. +#[derive(StructOpt, Debug)] +#[structopt(template = HELP_TEMPLATE, + about = "Coder is a command utility to manage keys (generation,encrypt,hash) and make content with Tera templates", + global_setting = structopt::clap::AppSettings::ColoredHelp)] +pub struct CliOpts { + #[allow(clippy::missing_docs_in_private_items)] // StructOpt compile-time errors if we doc this + #[structopt(flatten)] + pub boilerplate: BoilerplateOpts, + + /// TskSrvc to run + #[structopt(short, long)] + pub tsksrvc: Option, + + /// Command to run on TskSrvc + #[structopt(short, long)] + pub cmd: Option, + + /// On next tsksrvc after TskSrvc selected ('next') + #[structopt(short, long)] + pub next: Option, + + /// Source cloud path + #[structopt(short, long)] + pub source: Option, + + /// list of hosts + #[structopt(short, long)] + pub listhosts: Option, + + /// Force running (-f, -ff etc.) + #[structopt(short, long, parse(from_occurrences))] + pub force: u8, +/* + /// Encrypt text + #[structopt(short, long)] + pub encrypt: Option, + + /// Encrypt file + #[structopt(long)] + fencrypt: Option, + + /// Decrypt text + #[structopt(short, long)] + decrypt: Option, + + /// Decrypt file + #[structopt(long)] + fdecrypt: Option, + + /// Random key (optional uuid format) + #[structopt(short, long)] + key: Option, + + /// Get Blake3 hash from text + #[structopt(long)] + hash: Option, + + /// Tera template with data + #[structopt(short,long)] + tera: Option>, + + /// Get uuid v4 + #[structopt(short,long)] + uuid: Option, + + /// Input for tsksrvc + #[structopt(short, long)] + input: Option, + + /// Output for tsksrvc + #[structopt(short, long)] + output: Option, + + /// Output for http + #[structopt(short, long)] + http: Option, +*/ + // File(s) to use as input + // + // **TODO:** Figure out if there's a way to only enforce constraints on this when not asking + // to dump completions. + /* + #[structopt(parse(from_os_str), + validator_os = path_readable_file) + ] + inpath: Vec, + */ + /// Target + #[structopt()] +args: Vec, +} + +/// The actual `main()` +/// +/// Using a key and `XChaCha20Poly130` and random nonce +/// -run encrypt text-to-encrypt +/// -run decrypt text-to-decrypt +/// +/// Format -key n for a key with n characters long +/// Format -key n uuid for n items in uuid format with dashes +#[allow(clippy::integer_arithmetic, clippy::restriction)] +pub async fn main(opts: CliOpts) -> BxDynResult { // anyhow::Result<()> { + // println!("|{}|",&key); + let key_path = &envmnt::get_or("KEY_PATH", KEY_PATH); + let key = get_key(&key_path,None).await; + // let key = get_key(KEY_PATH,None).await; + if key.is_empty() { + std::process::exit(0x0100); + } + let empty_res=String::from(""); + let mut run_tsksrvc = String::from("all"); + let mut run_cmd = String::from(""); + let mut run_next = String::from(""); + let mut listhosts = String::from(""); + if let Some(tsksrvc)= opts.tsksrvc { + run_tsksrvc=String::from(&tsksrvc); + } + if let Some(cmd)=opts.cmd { + run_cmd=String::from(&cmd); + } + if let Some(list_hosts)=opts.listhosts { + listhosts=String::from(&list_hosts); + } + if let Some(nxt)=opts.next { + run_next=String::from(&nxt); + } + if let Some(source)=opts.source { + //let res = encrypt(&text, &key); + match on_cloud(&run_tsksrvc, &run_cmd, &run_next, &source, &listhosts, opts.force).await { + Ok(res) => return Ok(res), + Err(e) => println!("Error on_cloud: {}",e), + } + if envmnt::get_or("KLDS_DEBUG", "").len() == 0 { + println!("Clean on_cloud"); + match clear_specs(&source).await { + Ok(_) => return Ok(empty_res), + Err(e) => println!("Error on_cloud: {}",e), + } + } + let now = chrono::Utc::now().timestamp(); + // println!("{}",&now); + return Ok(empty_res); + // TODO Chect to remove provision specs config +// println!("{} - {}",&tsksrvc,&source); + } + /* + if opts.force > 0 { + println!("Force: {}",opts.force); + return Ok(()); + } + // dbg!(&opts); + if let Some(text)= opts.encrypt { + let res = encrypt(&text, &key); + println!("{}",&res); + return Ok(()); + } + if let Some(file)= opts.fencrypt { + match fs::read_to_string(&file.as_str()) { + Ok(content) => { + let res = encrypt(&content, &key); + println!("{}",&res); + }, + Err(e) => { + println!("Unable to open {}\n {}",&file,e); + }, + } + return Ok(()); + } + if let Some(text)= opts.decrypt { + let res = decrypt(&text, &key); + println!("{}",&res); + return Ok(()); + } + if let Some(file)= opts.fdecrypt { + match fs::read_to_string(&file.as_str()) { + Ok(content) => { + let res = decrypt(&content, &key); + println!("{}",&res); + }, + Err(e) => { + println!("Unable to open {}\n {}",&file,e); + }, + } + return Ok(()); + } + if core::option::Option::is_some(&opts.key) { + let mut template = ""; + if let (Some(_),Some(templ)) = (opts.args.get(0),opts.args.get(1)) { + template = templ.as_str(); + } + if let Some(text_long) = opts.args.get(0) { + match text_long.parse::() { + Ok(lon) => { + let random = RandomKey::config(lon,false); + if template == "" { + println!("{}", random.get_key()); + } else { + for ky in random.from_template(template, lon) { + println!("{}",ky); + } + }; + }, + Err(e) => println!("Error number conversion {}",e), + }; + } + return Ok(()); + } +// if core::option::Option::is_some(&opts.tera) { + if let Some(tera) = opts.tera { + if let (Some(data_file),Some(tpl_file))= (tera.get(0),tera.get(1)) { + let mut data_hash: HashMap = HashMap::new(); + let mut tpl_context = tera::Context::new(); + // println!("data: {} template: {}",data_file,tpl_file); + match hash_from_data(data_file, &mut tpl_context, &mut data_hash, true) { + Ok(_) => { + match data_templated(&"".to_string(),tpl_file,&mut tpl_context, &data_hash) { + Ok(result) => println!("{}",result), + Err(e) => println!("Error with {} data in {} template: {}", data_file, tpl_file, e), + } + }, + Err(e) => println!("Error with {} data in {} template: {}", data_file, tpl_file, e), + } + return Ok(()); + } + } + if let Some(text) = opts.hash { + let res = hash_content(&text); + println!("{}",res); + return Ok(()); + } + if let Some(_) = opts.uuid { + println!("{}", uuid::Uuid::new_v4()); + return Ok(()); + } + */ + // if let Some(_) = opts.http { + // let _ =http_main().await; + // return Ok(()); + // } + /* + for inpath in opts.inpath { +// todo!("Implement application logic") + println!("Target: {}",inpath.display()); + } + + */ + Ok(empty_res) +} + +// Tests go below the code where they'll be out of the way when not the target of attention +#[cfg(test)] +mod tests { + use super::CliOpts; + + // TODO: Unit test to verify that the doc comments on `CliOpts` or `BoilerplateOpts` aren't + // overriding the intended about string. + + #[test] + /// Test something + fn test_something() { + // TODO: Test something + } +} diff --git a/src/clouds.rs b/src/clouds.rs new file mode 100644 index 0000000..d965e55 --- /dev/null +++ b/src/clouds.rs @@ -0,0 +1,177 @@ +use std::fs; //, io}; +use std::fs::OpenOptions; +use std::io::Write; +use std::path::Path; +use rfm::mkdir; +use std::collections::HashMap; +use serde_yaml::Value; +use serde_dhall; +// use std::process::{Command}; + +use std::collections::BTreeMap; + +use anyhow::{anyhow,Result,Context,Error}; +use tkdr::tera_lib::make_template_content; + +use clds::pkgs::{get_pkgs_vers,PkgInfo,PkgVers}; +use clds::clouds::defs::{ + CfgRs, + CloudEnv, + Cloud, + ConfigResources, + Server, + TskSrvc, + MainResourcesConfig, +}; +use clds::clouds::on_clouds::env_cloud; + +use clds::tsksrvcs::run_tsksrvcs_on_providers; +use crate::defs::{load_key}; +use crate::errors::AppError; +use crate::utils; + +// use tempfile::tempfile; +// use std::fs::File; +//use base64_stream::FromBase64Writer; + +/// On_cloud +/// Load env and config files +/// Load `tsksrvc` (can be group of tsksrvcs) +/// On each `element` in `config` run `tsksrvc` +pub async fn on_cloud(tsksrvc: &str, cmd: &str, nxt: &str, source: &str, listhosts: &str, force: u8) -> Result { + let mut cloud = Cloud::default(); + cloud.env = CloudEnv::new(force, load_key().await); + cloud.providers = Cloud::load_providers().await; + env_cloud(source, &mut cloud.env).await?; + get_pkgs_vers(&mut cloud).await?; + cloud.env.listhosts = String::from(listhosts); + + let cfg_path = format!("{}/{}/{}/{}",&cloud.env.home,&source,&cloud.env.config_root,&cloud.env.config_path); + let mut cfg_data = fs::read_to_string(&cfg_path).with_context(|| format!("Failed to read 'cfg_path' from {}", &cfg_path))?; + + let mut cfg: MainResourcesConfig = serde_yaml::from_str(&cfg_data)?; + let provider = cloud.providers.get(&cfg.provider).with_context(|| format!("Provider '{}'' not defined", &cfg.provider))?; + + // Load tsksrvcs.yaml into TskSrvcs + + // for (i, tsk) in tsksrvcs.tsksrvcsList.iter().enumerate() { + // if tsksrvc == "all" || tsk.name.as_str() == tsksrvc { + // match tsk.target.as_str() { + // "servers" => on_cloud_server(&mut cloud, i, tsk).await?, + // _ => println!("Target '{}' undefined from {}", &tsk.target, cloud.env.config_path), + // } + // } + // } + + //let tsksrvcs_path = format!("{}/home/{}/tsksrvcs.yaml",&cloud.env.path,&source); + //let mut tsksrvcs_data = fs::read_to_string(&tsksrvcs_path).with_context(|| format!("Failed to read 'tsksrvcs_path' from {}", &tsksrvcs_path))?; + //let mut tsksrvcs: TskSrvcs = serde_yaml::from_str(&tsksrvcs_data)?; // .with_context(|| format!("Failed to parse 'tsksrvcs_path' from {}", &tsksrvcs_path))?; + + run_tsksrvcs_on_providers(provider, &cfg_data, &cloud, tsksrvc, &cmd, &nxt, &cfg).await?; +// .map_err(|e| AppError::ErrorInternalServerError(format!("Template error {}",e)))?; + + //utils::tera_render(tera: &mut Tera, tpl_context: tera::Context, tpl: &str, output_path: &str, append: bool).await?; + // dbg!(&cloud); +// for (i, elem) in config_res.servers.iter().enumerate() { +// dbg!(&elem); +// } +// // println!("DONE: {} - {}",&tsksrvc,&source); +// if &envmnt::get_or("WEB_MODE", "") == "" { +// // println!("{}",&str_config_res); +// println!("DONE: {} ",&cfg_path); +// } + Ok("done".to_string()) +} + +/* +pub fn get_packages_serde_value(src: &Option>>, key: &str, target: &str, dflt: String) -> String { + let mut target_value= String::from(""); + if let Some(pkgs) = &src { + if let Some(val) = pkgs.get(key) { + if let Some(item) = val.get(target) { + dbg!(item); + match item.as_str() { + Some(v) => target_value=v.to_string(), + None => target_value=dflt.to_owned(), + } + // target_value = tkdr::tera_lib::get_yaml_val(item,dflt); + }; + } + } + target_value +} + +pub async fn create_full_config(cloud: &mut Cloud) -> Result<()> { + let mut output_path = format!("{}/specs",&cloud.env.provision); + if ! Path::new(&output_path).exists() { + fs::create_dir(&output_path)?; + println!("{} created", &output_path); + } + output_path = format!("{}/specs/config.yaml",&cloud.env.provision); + if Path::new(&output_path).exists() && cloud.env.force < 1u8 { + println!("Found created {}", &output_path); + return Ok(()); + } + let mut config_resources = cloud.config_resources.to_owned(); + config_resources.servers = Vec::new(); + let mut file =std::fs::File::create(&output_path).with_context(|| format!("Failed to open to file: {}",&output_path))?; + let mut str_config_resources = serde_yaml::to_string(&config_resources).with_context(|| format!("Failed creating yaml from config_resources in {}",&cloud.env.provision))?; + str_config_resources = str_config_resources.replace("servers: []","servers: \n"); + file.write(&str_config_resources.as_bytes())?; + // fs.write apped to fs::write!(&output_path); + /* + for (i, elem) in cloud.config_resources.servers.iter().enumerate() { + if let Some(tpl) = &elem.tpl { + let tpl_path = get_env_path("",&tpl, &cloud.env.source , &cloud.env.tpls_path,true).await?; + let tpl_content= fs::read_to_string(&tpl_path).with_context(|| format!("Failed to read 'tpl_path' from {}", &tpl_path))?; + // println!("Template {} -> {}",&tpl, &tpl_path); + utils::tpl_data_server(&elem, &tpl_content, &output_path, true).await.with_context(|| format!("Failed 'ConfigResources' template {}",&tpl_path))?; + if let Some(specs) = &elem.spec { + if let Some(pkgs_tpl) = &specs.tplPkgs { + let pkgs_tpl_path = get_env_path("",&pkgs_tpl, &cloud.env.source , &cloud.env.tpls_path, true).await?; + let pkgs_tpl_content= fs::read_to_string(&pkgs_tpl_path).with_context(|| format!("Failed to read 'pkgs_tpl_path' from {}", &pkgs_tpl_path))?; + utils::tpl_data_map(&cloud.env.pkgs_vers, &pkgs_tpl_content, &output_path, true).await.with_context(|| format!("Failed render 'versions' on template {}",&pkgs_tpl_path))?; + // let mut file = OpenOptions::new().append(true).open(&output_path)?; + // file.write(&pkgs_tpl_content.as_bytes())?; + } + } + } + } + */ + println!("Full 'config_resources' created"); + Ok(()) +} +/// On_cloud_servers run tsksrvcs +pub async fn on_cloud_server(cloud: &mut Cloud, pos: usize, tsksrvc: &TskSrvc) -> Result<()> { + let mut tsksrvc_path = String::from(""); + if tsksrvc.path.len() > 0 { + tsksrvc_path = get_env_path(format!("CLOUDS_TSKSRVC_{}",&tsksrvc.name).as_str(), &tsksrvc.path, "" , &cloud.env.root_tsksrvcs,true).await?; + } + match tsksrvc.name.as_str() { + "createserver" | "modifyip" | "startserver" => { + for (i, elem) in cloud.config_resources.servers.iter().enumerate() { + println!("TskSrvc {}th {} in {}th {}: {} ", pos+1, &tsksrvc.name,i+1, &tsksrvc.target, &elem.hostname); + println!("{}",&tsksrvc_path); + if let Some(provider) = &cloud.config_resources.provider { + match provider.as_str() { + "upcloud" => if let Some(provider_def) = cloud.providers.get(provider) { + let cmd = format!("{} {} {}",&provider_def.runner,&provider_def.args, &tsksrvc.name); + println!("Provider '{}' to create '{} -f {}/config_resources.yaml",provider,&cmd, &cloud.env.provision); + }, + "manual" => { + println!("Provider '{}' create manually",&provider); + if tsksrvc.path.len() > 0 { + tkdr::utils::run_command(&tsksrvc.path,"","")?; + } + }, + _ => println!("Provider '{}' to create '{}' undefined",&provider,&elem.hostname), + + } + } + } + }, + _ => println!("TskSrvc '{}' undefined on {}", &tsksrvc.name, &tsksrvc.target), + } + Ok(()) +} +*/ \ No newline at end of file diff --git a/src/cmds.rs b/src/cmds.rs new file mode 100644 index 0000000..7d76835 --- /dev/null +++ b/src/cmds.rs @@ -0,0 +1,73 @@ +// use openssh::{Session, KnownHosts}; +use openssh::*; +use std::io; +use std::process::Stdio; +use tokio::io::{AsyncWriteExt,AsyncReadExt}; + +/// ssh +/// ````rust +/// // Prepare address +/// let host= String::from("hostname-or-ip"); +/// let user= String::from("root"); +/// let port: u16 = 22; +/// let addr = format!("ssh://{}@{}:{}",&user,&host,port); +/// +/// // for scp_to_add data content into /tmp/hola +/// let tsksrvc= String::from("scp_to_add"); +/// let trgt=String::from("/tmp/hola"); +/// let mut data = String::from("Dime \n"); +// +/// // for ssh ls /tmp +/// let tsksrvc= String::from("ssh"); +/// let trgt=String::from("ls"); +/// let mut data = String::from("/tmp"); +/// +/// // Call command and "macth" result +/// match cmds::ssh(&tsksrvc, &addr, &trgt, &mut data) { +/// Ok(rs) => println!("ssh res: {:?} -> {:?}", rs, &data), +/// Err(e) => println!("ssh error: {:?}", e), +/// } +/// ``` +// #[tokio::main] +pub async fn ssh(tsksrvc: &str, addr: &str, trgt: &str, data: &mut String ) -> anyhow::Result<()> { + + let session = Session::connect(&addr,KnownHosts::Strict).await?; + + if tsksrvc == "ssh" { + let ls = session.command(trgt).arg(data).output().await?; + match String::from_utf8(ls.stdout) { + Ok(res) => println!("ls : {:?}",&res), + Err(e) => println!("Error {:?}",e), + }; + } else { + let mut sftp = session.sftp(); + match tsksrvc { + "scp_to" => { + let mut w = sftp.write_to(trgt).await?; + let content = data.as_bytes(); + w.write_all(content).await?; + w.close().await?; + }, + "scp_to_add" => { + let mut w = sftp.append_to(trgt).await?; + let content = data.as_bytes(); + w.write_all(content).await?; + w.close().await?; + }, + "scp_from" => { + let mut r = sftp.read_from(trgt).await?; + r.read_to_string(data).await?; + // println!("source: {:?}",&data); + r.close().await?; + }, + _ => println!("Undefined {:?}",&tsksrvc), + }; + } + session.close().await?; + Ok(()) +} +// println!("SSH error no KeyPair found"); +// .map_err(|e| { +// debug!("e = {:?}", e); +// Error::SendError +// })?; \ No newline at end of file diff --git a/src/defs.rs b/src/defs.rs new file mode 100644 index 0000000..28c8097 --- /dev/null +++ b/src/defs.rs @@ -0,0 +1,15 @@ + + +pub type BxDynResult = std::result::Result>; + +pub const KEY_PATH: &str = ".k"; +use key_of_life::get_key; + +pub async fn load_key() -> String { + let key_path = envmnt::get_or("KEY_PATH", KEY_PATH); + let key = get_key(&key_path,None).await; + if key.is_empty() { + std::process::exit(0x0100); + } + key +} \ No newline at end of file diff --git a/src/dsc.rs b/src/dsc.rs new file mode 100644 index 0000000..c01a1d9 --- /dev/null +++ b/src/dsc.rs @@ -0,0 +1,89 @@ +use tokio::io::{AsyncWriteExt,AsyncReadExt}; +/* + +format as json with: { nm="name",v="version",h="hash",ctx="",ath="Auth",p="perms",rqmt="requiremtes",rqst="request",...,cod=1,cry=1, data } +data is a dhall content: if cod = 1 is encoded, cry = 1 is encrypted + +data: + - about + - request + - tsksrvcs + - config + - tpls + - lang + - defs + + +Header + - Read Header + - Create Header +Pack + - UnPack Data + - Pack Data + +Run + - Request + - TskSrvc + +Create LDSC + +Attach Data - CRUD + + + + if path.ends_with(".dhall") { // As source dhall + + } else if path.ends_with(".dhallb") { // As encoded dhallb + + } else if path.ends_with(".dhllb") { // As base64 + encrypt + encoded dhllb + + } else { // As base64 + encrypt dhll or no extension + + } +*/ + +#[tokio::main] +pub async fn dsc(tsksrvc: &str, addr: &str, trgt: &str, data: &mut String ) -> anyhow::Result<()> { +/* + let session = Session::connect(&addr,KnownHosts::Strict).await?; + + if tsksrvc == "ssh" { + let ls = session.command(trgt).arg(data).output().await?; + match String::from_utf8(ls.stdout) { + Ok(res) => println!("ls : {:?}",&res), + Err(e) => println!("Error {:?}",e), + }; + } else { + let mut sftp = session.sftp(); + match tsksrvc { + "scp_to" => { + let mut w = sftp.write_to(trgt).await?; + let content = data.as_bytes(); + w.write_all(content).await?; + w.close().await?; + }, + "scp_to_add" => { + let mut w = sftp.append_to(trgt).await?; + let content = data.as_bytes(); + w.write_all(content).await?; + w.close().await?; + }, + "scp_from" => { + let mut r = sftp.read_from(trgt).await?; + r.read_to_string(data).await?; + // println!("source: {:?}",&data); + r.close().await?; + }, + _ => println!("Undefined {:?}",&tsksrvc), + } + } + + session.close().await?; +*/ + Ok(()) +} +// println!("SSH error no KeyPair found"); +// .map_err(|e| { +// debug!("e = {:?}", e); +// Error::SendError +// })?; \ No newline at end of file diff --git a/src/errors.rs b/src/errors.rs new file mode 100644 index 0000000..e18f197 --- /dev/null +++ b/src/errors.rs @@ -0,0 +1,147 @@ +/// Main errors definition +// +// Copyright 2020, Jesús Pérez Lorenzo +// +use failure::Fail; +// use diesel::result::DatabaseErrorKind::UniqueViolation; +// use diesel::result::Error::{DatabaseError, NotFound}; +use std::fmt; + +///`AppError` Aplication Errors definition ans display +/// +#[derive(Debug)] +pub enum AppError { +/// when toke not valid + NoValidToken, + NoValidSession, + SSLModeError, + RunningModeError, + UndefinedCollection, + RecordAlreadyExists, + RecordNotFound, + DatabaseError, + NoDataStorePool, + NoAppEnvLoaded, + NoCertsLoaded, + SqlDeleteError, + HasherError, + MailSendError(String), + MailError, +// DatabaseError(diesel::result::Error), + OperationCanceled, +} + +#[allow(clippy::pattern_type_mismatch)] +impl fmt::Display for AppError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AppError::NoValidToken => write!(f, "No valid token found"), + AppError::NoValidSession => write!(f, "No valid session found"), + AppError::SSLModeError => write!(f, "SSL Mode error"), + AppError::RunningModeError => write!(f, "No valid run mode"), + AppError::UndefinedCollection => write!(f, "Collection undefined"), + AppError::RecordAlreadyExists => write!(f, "This record violates a unique constraint"), + AppError::RecordNotFound => write!(f, "This record does not exist"), + AppError::NoDataStorePool => write!(f, "No data store pool"), + AppError::NoAppEnvLoaded => write!(f, "Application environment not loaded.\nReview APP_CONFIG_PATH and config.toml content "), + AppError::NoCertsLoaded => write!(f, "Certifcations not loaded. Review APP_CONFIG_PATH certs_store_path"), + AppError::SqlDeleteError => write!(f, "Sql Delete error"), +// AppError::DatabaseError(e) => write!(f, "Database error: {:?}", e), + AppError::MailSendError(e) => write!(f, "Mail send error: {:?}", e), + AppError::MailError => write!(f, "Mail error "), + AppError::DatabaseError => write!(f, "Database error "), + AppError::HasherError => write!(f, "Hasher error "), + AppError::OperationCanceled => write!(f, "The running operation was canceled"), + } + } +} +/* +/* +impl From for AppError { + fn from(e: diesel::result::Error) -> Self { + match e { +// DatabaseError(UniqueViolation, _) => AppError::RecordAlreadyExists, + NotFound => AppError::RecordNotFound, + _ => AppError::DatabaseError(e), + } + } +} +*/ + + +impl From> for AppError { + fn from(e: BlockingError) -> Self { + match e { + BlockingError::Error(inner) => inner, + BlockingError::Canceled => AppError::OperationCanceled, + } + } +} + +#[derive(Debug, Serialize)] +struct ErrorResponse { + err: String, +} + +impl actix_web::ResponseError for AppError { + fn error_response(&self) -> HttpResponse { + let err = format!("{}", self); + let mut builder = match self { + AppError::RecordAlreadyExists => HttpResponse::BadRequest(), + AppError::RecordNotFound => HttpResponse::NotFound(), + _ => HttpResponse::InternalServerError(), + }; + builder.json(ErrorResponse { err }) + } + + // fn render_response(&self) -> HttpResponse { + // self.error_response() + // } +} + + +#[derive(Debug, Fail)] +pub enum AppCertificateError { + #[fail(display = "{} - Reason: {}", 0, 1)] + BadFile(String, String), + #[fail(display = "{} - Reason: {}", 0, 1)] + FileReadError(String, String), +} + +#[derive(Debug, Fail)] +pub enum TokenErrors { + #[fail(display = "{} - Reason: {}", 0, 1)] + TokenEncodingFailed(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + TokenDecodingFailed(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + MissingServerRefreshToken(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + InvalidServerRefreshToken(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + InvalidClientAuthenticationToken(String, String), +} + +#[derive(Debug, Fail)] +pub enum LoginFailed { + #[fail(display = "{} - Reason: {}", 0, 1)] + MissingPassword(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + InvalidPassword(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + InvalidTokenOwner(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + PasswordHashingFailed(String, String), + + #[fail(display = "{} - Reason: {}", 0, 1)] + PasswordVerificationFailed(String, String), + +} +*/ \ No newline at end of file diff --git a/src/helpers.rs b/src/helpers.rs new file mode 100644 index 0000000..d67ee0f --- /dev/null +++ b/src/helpers.rs @@ -0,0 +1,54 @@ +/*! Functions and templates which can be imported by `app.rs` to save effort */ +// Copyright 2017-2019, Stephan Sokolow + +use structopt::{clap, StructOpt}; + +/// Modified version of Clap's default template for proper help2man compatibility +/// +/// Used as a workaround for: +/// 1. Clap's default template interfering with `help2man`'s proper function +/// ([clap-rs/clap/#1432](https://github.com/clap-rs/clap/issues/1432)) +/// 2. Workarounds involving injecting `\n` into the description breaking help output if used +/// on subcommand descriptions. +pub const HELP_TEMPLATE: &str = "{bin} {version} + +{about} + +TskSrvcs: +- Create a Random Key +- Hash content Blake3 +- Encrypt/Decrypt XChaCha20Poly1305 and random nonce +- Tera template with json-data + +USAGE: + {usage} + + +{all-args} +"; + +#[allow(clippy::missing_docs_in_private_items)] +// Can't doc-comment until TeXitoi/structopt#333 +// Options used by boilerplate code in `main.rs` +// +// FIXME: Report that StructOpt trips Clippy's `cast_possible_truncation` lint unless I use +// `u64` for my `from_occurrences` inputs, which is a ridiculous state of things. +#[derive(StructOpt, Debug)] +#[structopt(rename_all = "kebab-case")] +pub struct BoilerplateOpts { + /// Decrease verbosity (-q, -qq, -qqq, etc.) + #[structopt(short, long, parse(from_occurrences))] + pub quiet: u64, + + /// Increase verbosity (-v, -vv, -vvv, etc.) + #[structopt(short, long, parse(from_occurrences))] + pub verbose: u64, + + /// Display timestamps on log messages (sec, ms, ns, none) + #[structopt(long, value_name = "resolution")] + pub timestamp: Option, + + /// Write a completion definition for the specified shell to stdout (bash, zsh, etc.) + #[structopt(long, value_name = "shell")] + pub dump_completions: Option, +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..87a28f0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,148 @@ +/*! TODO: Application description here + +This file provided by [rust-cli-boilerplate](https://github.com/ssokolow/rust-cli-boilerplate) +*/ +// Copyright 2017-2021, Stephan Sokolow + +// Make rustc's built-in lints more strict and set clippy into a whitelist-based configuration so +// we see new lints as they get written, then opt out of ones we have seen and don't want +#![warn(warnings, rust_2018_idioms)] +#![warn(clippy::all, clippy::pedantic, clippy::restriction)] +#![allow(clippy::float_arithmetic, clippy::implicit_return, clippy::needless_return)] +#![forbid(unsafe_code)] // Enforce my policy of only allowing it in my own code as a last resort + +#![allow(warnings)] +#![allow(unused_imports)] + +// stdlib imports +//use std::{any, convert::TryInto}; +use std::{convert::TryInto}; +use std::io; + +// 3rd-party imports +use anyhow::{Context, Result}; +use structopt::{clap, StructOpt}; + +#[macro_use] +extern crate serde_derive; + +use tkdr::crypt_lib::{encrypt, decrypt}; +use tkdr::tera_lib::{hash_from_data, data_templated, hash_content}; +use tkdr::randomkey::{RandomKey}; +use key_of_life::get_key; + +// use log::{debug, error, info, trace, warn}; +// use actix_web::{guard, middleware, web, App, HttpServer}; +use dotenv::dotenv; +use tokio::fs::File; +use tokio_util::codec::{BytesCodec, FramedRead}; +use hyper::service::{make_service_fn, service_fn}; +use hyper::{Body, Method, Request, Response, Server, StatusCode}; + +use crate::defs::{BxDynResult}; + +/// The verbosity level when no `-q` or `-v` arguments are given, with `0` being `-q` +pub const DEFAULT_VERBOSITY: u64 = 1; + +/// Default KEY PATH +pub const KEY_PATH: &str = ".k"; +// Local imports +mod app; +mod helpers; +mod cmds; +// mod dsc; +mod defs; +mod utils; +mod errors; +mod clouds; +mod web; + +/// cmd main +// async fn cmd_main() -> Result<(), Box> { +async fn cmd_main() -> BxDynResult { + // Parse command-line arguments (exiting on parse error, --version, or --help) + let opts = app::CliOpts::from_args(); + + // Configure logging output so that -q is "decrease verbosity" rather than instant silence + let verbosity = opts + .boilerplate + .verbose + .saturating_add(app::DEFAULT_VERBOSITY) + .saturating_sub(opts.boilerplate.quiet); + + stderrlog::new() + .module(module_path!()) + .quiet(verbosity == 0) + .verbosity(verbosity.saturating_sub(1).try_into().context("Verbosity too high")?) + .timestamp(opts.boilerplate.timestamp.unwrap_or(stderrlog::Timestamp::Off)) + .init() + .context("Failed to initialize logging output")?; + // If requested, generate shell completions and then exit with status of "success" + opts.boilerplate.dump_completions.map_or(app::main(opts).await, |shell| { + app::CliOpts::clap().gen_completions_to( + app::CliOpts::clap().get_bin_name().unwrap_or_else(|| clap::crate_name!()), + shell, + &mut io::stdout(), + ); + Ok(String::from("")) + }) + // if let Some(shell) = opts.boilerplate.dump_completions { + // app::CliOpts::clap().gen_completions_to( + // app::CliOpts::clap().get_bin_name().unwrap_or_else(|| clap::crate_name!()), + // shell, + // &mut io::stdout(), + // ); + // Ok(()) + // } else { + // // Run the actual `main` and rely on `impl Termination` to provide a simple, concise way to + // // allow terminal errors that can be changed later as needed but starts out analogous to + // // letting an unhandled exception bubble up in something like Python. + // // TODO: Experiment with this and look for ways to polish it up further + // app::main(opts) + // } +} +/// Boilerplate to parse command-line arguments, set up logging, and handle bubbled-up `Error`s. +/// +/// See `app::main` for the application-specific logic. +// #[actix_rt::main] +// async fn main() -> std::io::Result<()> { // Result<()> { +#[tokio::main] +async fn main() -> std::io::Result<()> { // Result<()> { + // // println!("|{}|",&key); + // let key_path = &envmnt::get_or("KEY_PATH", KEY_PATH); + // let key = get_key(&key_path,None).await; + // // let key = get_key(KEY_PATH,None).await; + // if key.is_empty() { + // std::process::exit(0x0100); + // } +// cmd_main().await; + + let web_mode = &envmnt::get_or("WEB_MODE", ""); + if web_mode == "" { + cmd_main().await; + } else { + let opts = app::CliOpts::from_args(); + // dbg!(opts); + match app::main(opts).await { + Ok(res) => println!("{}",res), + Err(e) => println!("Errror: {}",e), + } + pretty_env_logger::init(); + + let addr = "127.0.0.1:1337".parse().unwrap(); + + let make_service = + make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(web::response_examples)) }); + + let server = Server::bind(&addr).serve(make_service); + + println!("Listening on http://{}", addr); + + if let Err(e) = server.await { + eprintln!("server error: {}", e); + } + } + + Ok(()) +} +// vim: set sw=4 sts=4 expandtab : \ No newline at end of file diff --git a/src/routes.rs b/src/routes.rs new file mode 100644 index 0000000..8a48368 --- /dev/null +++ b/src/routes.rs @@ -0,0 +1,30 @@ +/// Router modules loader +// +// Copyright 2021, Jesús Pérez Lorenzo +// +// use crate::errors::AppError; +// use actix_web::HttpResponse; +/// Main routes +// pub(super) mod base; +pub(super) mod main_gets; +// pub(super) mod main_posts; +// pub(super) mod adm_gets; +// pub(super) mod adm_posts; +// // pub(super) mod principal; +// /// Auth routes login, tokens, etc +// pub(super) mod gql; +// // pub(super) mod auth; +// pub(super) mod files; +// pub(super) mod utils; +// pub(super) mod reqtsksrvcs; +/* +fn convert(res: Result) -> Result +where + T: serde::Serialize, + AppError: From, +{ + res.map(|d| HttpResponse::Ok().json(d)) + .map_err(Into::into) +} + +*/ \ No newline at end of file diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 0000000..39a2c4f --- /dev/null +++ b/src/utils.rs @@ -0,0 +1,127 @@ +use std::fs; //, io}; +use std::fs::OpenOptions; +use std::io::Write; +use std::path::Path; +use std::collections::HashMap; +use tera::Tera; + +use anyhow::{anyhow,Result,Context,Error}; + +use clds::clouds::defs::{ConfigResources,Server}; +use clds::pkgs::{Packages}; + + +pub fn trim_newline(s: &mut String) { + if s.ends_with('\n') { + s.pop(); + if s.ends_with('\r') { + s.pop(); + } + } +} + +/// render Tera +/// +pub async fn tera_render(tera: &mut Tera, tpl_context: tera::Context, tpl: &str, output_path: &str, append: bool) -> Result<()> { + let mut all_tpls = vec![("data-template.html",tpl)]; + // match read_path_file(&path, &template_head, "content") { + // Ok(tpl_head) => all_tpls.push((&template_head,tpl_head)), + // Err(_) => {} // ignore if no header + // } + tera.add_raw_templates(all_tpls); + match tera.render("data-template.html", &tpl_context) { + Ok(mut res) => if append && Path::new(&output_path).exists() { + let mut file = OpenOptions::new().append(true).open(&output_path)?; + res = res.replace("/", "/"); + // println!("{}",&res); + file.write(res.as_bytes())?; + } else { + // fs::write(&output_path, res)?; + let mut file = OpenOptions::new().write(true).truncate(true).open(&output_path)?; + file.write_all(&res.as_bytes())?; + }, + Err(e) => { + println!("Error 'tera_render': {}",e); + // return Err(anyhow!("Error tera render: {}", e)); + }, + } + Ok(()) +} + +/// tpl_data +pub async fn tpl_data_map(config: &HashMap, tpl: &str, output_path: &str, append: bool) -> Result<()> { + let mut tera = Tera::default(); + match tera::Context::from_serialize(&config) { + Ok(tpl_context) => { + // tpl_context.contains_key(index); + // tpl_context.insert(index); + tera_render(&mut tera, tpl_context, tpl, output_path, append).await.with_context(|| format!("Failed to render 'data_map' {}", &tpl))?; + }, + Err(e) => return Err(anyhow!("Error tera context 'data_map' serialize: {:?}", e)), + } + Ok(()) +} + +/// tpl_data +pub async fn tpl_data(config: &ConfigResources, tpl: &str, output_path: &str, append: bool) -> Result<()> { + let mut tera = tera::Tera::default(); + // let template_head = "header.html"; + //let tpl = read_path_file(&path, &template_name, "content")?; + match tera::Context::from_serialize(config) { + Ok(tpl_context) => { + // tpl_context.contains_key(index); + // tpl_context.insert(index); + tera_render(&mut tera, tpl_context, tpl, output_path, append).await.with_context(|| format!("Failed to render 'data' {}", &tpl))?; + }, + Err(e) => return Err(anyhow!("Error tera context 'data' serialize: {:?}", e)), + } + + // Ok(res) + + // let mut data_hash: HashMap = HashMap::new(); + // let mut tpl_context = tera::Context::new(); + // // println!("data: {} template: {}",data_file,tpl_file); + // match hash_from_data(data_file, &mut tpl_context, &mut data_hash, true) { + // Ok(_) => { + // match data_templated(&"".to_string(),tpl_file,&mut tpl_context, &data_hash) { + // Ok(result) => println!("{}",result), + // Err(e) => println!("Error with {} data in {} template: {}", data_file, tpl_file, e), + // } + // }, + // Err(e) => println!("Error with {} data in {} template: {}", data_file, tpl_file, e), + // } + Ok(()) +} + +/// tpl_data +pub async fn tpl_data_server(config: &Server, tpl: &str, output_path: &str, append: bool) -> Result<()> { +// if let Some(servers) = &config.servers { + let mut tera = tera::Tera::default(); + match tera::Context::from_serialize(&config) { + Ok(tpl_context) => { + // tpl_context.contains_key(index); + // tpl_context.insert(index); + tera_render(&mut tera, tpl_context, tpl, output_path, append).await.with_context(|| format!("Failed to render 'data_server' {}:", &tpl))?; + }, + Err(e) => return Err(anyhow!("Error tera context 'data_server' serialize: {:?}", e)), + } +// } + Ok(()) +} + + +/// yaml +pub fn load_yaml_config(path: String) -> Result { // }, serde_yaml::Error> { + // let mut data= Config::default(); + let content=fs::read_to_string(path)?; + let data: ConfigResources = serde_yaml::from_str(&content)?; + // println!("{:#?}",data); + Ok(data) +} +pub fn load_yaml_packages(path: String) -> Result { // }, serde_yaml::Error> { + // let mut data= Config::default(); + let content=fs::read_to_string(path)?; + let data: Packages = serde_yaml::from_str(&content)?; + // println!("{:#?}",data); + Ok(data) +} \ No newline at end of file diff --git a/src/validators.rs b/src/validators.rs new file mode 100644 index 0000000..94bed17 --- /dev/null +++ b/src/validators.rs @@ -0,0 +1,572 @@ +/*! Validator functions suitable for use with `Clap` and `StructOpt` */ +// Copyright 2017-2021, Stephan Sokolow + +use std::ffi::OsString; +use std::fs::File; +use std::path::{Component, Path}; + +use faccess::PathExt; + +/// Special filenames which cannot be used for real files under Win32 +/// +/// (Unless your app uses the `\\?\` path prefix to bypass legacy Win32 API compatibility +/// limitations) +/// +/// **NOTE:** These are still reserved if you append an extension to them. +/// +/// Sources: +/// * [Boost Path Name Portability Guide +/// ](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/portability_guide.htm) +/// * Wikipedia: [Filename: Comparison of filename limitations +/// ](https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations) +/// +/// **TODO:** Decide what (if anything) to do about the NTFS "only in root directory" reservations. +#[rustfmt::skip] +pub const RESERVED_DOS_FILENAMES: &[&str] = &["AUX", "CON", "NUL", "PRN", + "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", // Serial Ports + "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", // Parallel Ports + "CLOCK$", "$IDLE$", "CONFIG$", "KEYBD$", "LST", "SCREEN$"]; + +/// Test that the given path *should* be writable +/// +/// ## Use For: +/// * Output directories that should exist and be writable. +/// +/// ## Relevant Conventions: +/// * Use `-o` to specify the output path if doing so is optional. Less commonly, `-d` is also +/// used. [[1]](http://www.catb.org/esr/writings/taoup/html/ch10s05.html) +/// +/// ## Cautions: +/// * Never assume a directory's permissions will remain unchanged between the time you check them +/// and the time you attempt to use them. +/// * Some filesystems provide sufficiently fine-grained permissions that having access to create +/// a file does not imply having access to delete the file you've created. +/// +/// **TODO:** A complementary validator which will verify that the closest existing ancestor is +/// writable. (for things that will `mkdir -p` if necessary.) +#[cfg(unix)] +pub fn path_output_dir + ?Sized>(value: &P) -> Result<(), OsString> { + let path = value.as_ref(); + + if !path.is_dir() { + return Err(format!("Not a directory: {}", path.display()).into()); + } + + if path.writable() { + return Ok(()); + } + + Err(format!("Would be unable to write to destination directory: {}", path.display()).into()) +} + +/// The given path is a file that can be opened for reading or `-` denoting `stdin` +/// +/// ## Use For: +/// * Input file paths +/// +/// ## Relevant Conventions: +/// * If specifying an input file via an option flag, use `-f` as the name of the flag. +/// [[1]](http://www.catb.org/esr/writings/taoup/html/ch10s05.html) +/// * Prefer taking input paths as positional arguments and, if feasible, allow an arbitrary +/// number of input arguments. This allows easy use of shell globs. +/// +/// **Note:** The following command-lines, which interleave files and `stdin`, are a good test of +/// how the above conventions should interact: +/// +/// data_source | my_utility_a header.dat - footer.dat > output.dat +/// data_source | my_utility_b -f header.dat -f - -f footer.dat > output.dat +/// +/// ## Cautions: +/// * If the value is not `-`, this will momentarily open the given path for reading to verify +/// that it is readable. However, relying on this to remain true will introduce a race +/// condition. This validator is intended only to allow your program to exit as quickly as +/// possible in the case of obviously bad input. +/// * As a more reliable validity check, you are advised to open a handle to the file in question +/// as early in your program's operation as possible, use it for all your interactions with the +/// file, and keep it open until you are finished. This will both verify its validity and +/// minimize the window in which another process could render the path invalid. +#[rustfmt::skip] +pub fn path_readable_file_or_stdin + ?Sized>(value: &P) + -> std::result::Result<(), OsString> { + if value.as_ref().to_string_lossy() == "-" { + return Ok(()) + } + + path_readable_file(value) +} + +/// The given path is a file that can be opened for reading +/// +/// ## Use For: +/// * Input file paths +/// +/// ## Relevant Conventions: +/// * **Prefer [`path_readable_file_or_stdin`](fn.path_readable_file_or_stdin.html).** +/// Commands should support taking input via `stdin` whenever feasible. +/// * If specifying an input file via an option flag, use `-f` as the name of the flag. +/// [[1]](http://www.catb.org/esr/writings/taoup/html/ch10s05.html) +/// * Prefer taking input paths as positional arguments and, if feasible, allow an arbitrary +/// number of input arguments. This allows easy use of shell globs. +/// +/// ## Cautions: +/// * This will momentarily open the given path for reading to verify that it is readable. +/// However, relying on this to remain true will introduce a race condition. This validator is +/// intended only to allow your program to exit as quickly as possible in the case of obviously +/// bad input. +/// * As a more reliable validity check, you are advised to open a handle to the file in question +/// as early in your program's operation as possible, use it for all your interactions with the +/// file, and keep it open until you are finished. This will both verify its validity and +/// minimize the window in which another process could render the path invalid. +#[rustfmt::skip] +pub fn path_readable_file + ?Sized>(value: &P) + -> std::result::Result<(), OsString> { + let path = value.as_ref(); + + if path.is_dir() { + return Err(format!("{}: Input path must be a file, not a directory", + path.display()).into()); + } + + File::open(path).map(|_| ()).map_err(|e| format!("{}: {}", path.display(), e).into()) +} + +// TODO: Implement path_readable_dir and path_readable for --recurse use-cases + +/// The given path is valid on all major filesystems and OSes +/// +/// ## Use For: +/// * Output file or directory paths that will be created if missing +/// (See also [`path_output_dir`](fn.path_output_dir.html).) +/// +/// ## Relevant Conventions: +/// * Use `-o` to specify the output path if doing so is optional. +/// [[1]](http://www.catb.org/esr/writings/taoup/html/ch10s05.html) +/// [[2]](http://tldp.org/LDP/abs/html/standard-options.html) +/// * Interpret a value of `-` to mean "Write output to stdout". +/// [[3]](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html) +/// * Because `-o` does not inherently indicate whether it expects a file or a directory, consider +/// also providing a GNU-style long version with a name like `--outfile` to allow scripts which +/// depend on your tool to be more self-documenting. +/// +/// ## Cautions: +/// * To ensure files can be copied/moved without issue, this validator may impose stricter +/// restrictions on filenames than your filesystem. Do *not* use it for input paths. +/// * Other considerations, such as paths containing symbolic links with longer target names, may +/// still cause your system to reject paths which pass this check. +/// * As a more reliable validity check, you are advised to open a handle to the file in question +/// as early in your program's operation as possible and keep it open until you are finished. +/// This will both verify its validity and minimize the window in which another process could +/// render the path invalid. +/// +/// ## Design Considerations: +/// * Many popular Linux filesystems impose no total length limit. +/// * This function imposes a 32,760-character limit for compatibility with flash drives formatted +/// FAT32 or exFAT. [[4]](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) +/// * Some POSIX API functions, such as `getcwd()` and `realpath()` rely on the `PATH_MAX` +/// constant, which typically specifies a length of 4096 bytes including terminal `NUL`, but +/// this is not enforced by the filesystem itself. +/// [[5]](https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html) +/// +/// Programs which rely on libc for this functionality but do not attempt to canonicalize paths +/// will usually work if you change the working directory and use relative paths. +/// * The following lengths were considered too limiting to be enforced by this function: +/// * The UDF filesystem used on DVDs imposes a 1023-byte length limit on paths. +/// * When not using the `\\?\` prefix to disable legacy compatibility, Windows paths are +/// limited to 260 characters, which was arrived at as `A:\MAX_FILENAME_LENGTH`. +/// [[6]](https://stackoverflow.com/a/1880453/435253) +/// * ISO 9660 without Joliet or Rock Ridge extensions does not permit periods in directory +/// names, directory trees more than 8 levels deep, or filenames longer than 32 characters. +/// [[7]](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/portability_guide.htm) +/// * See [`filename_valid_portable`](fn.filename_valid_portable.html) for design considerations +/// relating to individual path components. +/// +/// **TODO:** Write another function for enforcing the limits imposed by targeting optical media. +pub fn path_valid_portable + ?Sized>(value: &P) -> Result<(), OsString> { + let path = value.as_ref(); + + #[allow(clippy::decimal_literal_representation)] // Path lengths are most intuitive as decimal + if path.as_os_str().is_empty() { + Err("Path is empty".into()) + } else if path.as_os_str().len() > 32760 { + // Limit length to fit on VFAT/exFAT when using the `\\?\` prefix to disable legacy limits + // Source: https://en.wikipedia.org/wiki/Comparison_of_file_systems + Err(format!("Path is too long ({} chars): {:?}", path.as_os_str().len(), path).into()) + } else { + for component in path.components() { + if let Component::Normal(string) = component { + filename_valid_portable(string)? + } + } + Ok(()) + } +} + +/// The string is a valid file/folder name on all major filesystems and OSes +/// +/// ## Use For: +/// * Output file or directory names within a parent directory specified through other means. +/// +/// ## Relevant Conventions: +/// * Most of the time, you want to let users specify a full path via [`path_valid_portable` +/// ](fn.path_valid_portable.html) instead. +/// +/// ## Cautions: +/// * To ensure files can be copied/moved without issue, this validator may impose stricter +/// restrictions on filenames than your filesystem. Do *not* use it for input filenames. +/// * This validator cannot guarantee that a given filename will be valid once other +/// considerations such as overall path length limits are taken into account. +/// * As a more reliable validity check, you are advised to open a handle to the file in question +/// as early in your program's operation as possible, use it for all your interactions with the +/// file, and keep it open until you are finished. This will both verify its validity and +/// minimize the window in which another process could render the path invalid. +/// +/// ## Design Considerations: +/// * In the interest of not inconveniencing users in the most common case, this validator imposes +/// a 255-character length limit. +/// [[1]](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) +/// * The eCryptFS home directory encryption offered by Ubuntu Linux imposes a 143-character +/// length limit when filename encryption is enabled. +/// [[2]](https://bugs.launchpad.net/ecryptfs/+bug/344878) +/// * the Joliet extensions for ISO 9660 are specified to support only 64-character filenames and +/// tested to support either 103 or 110 characters depending whether you ask the mkisofs +/// developers or Microsoft. [[3]](https://en.wikipedia.org/wiki/Joliet_(file_system)) +/// * The [POSIX Portable Filename Character Set +/// ](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282) +/// is too restrictive to be baked into a general-purpose validator. +/// +/// **TODO:** Consider converting this to a private function that just exists as a helper for the +/// path validator in favour of more specialized validators for filename patterns, prefixes, and/or +/// suffixes, to properly account for how "you can specify a name but not a path" generally +/// comes about. +pub fn filename_valid_portable + ?Sized>(value: &P) -> Result<(), OsString> { + let path = value.as_ref(); + + // TODO: Should I refuse incorrect Unicode normalization since Finder doesn't like it or just + // advise users to run a normalization pass? + // Source: https://news.ycombinator.com/item?id=16993687 + + // Check that the length is within range + let os_str = path.as_os_str(); + if os_str.len() > 255 { + #[rustfmt::skip] + return Err(format!("File/folder name is too long ({} chars): {}", + path.as_os_str().len(), path.display()).into()); + } + + // Check for invalid characters + let lossy_str = match os_str.to_str() { + Some(string) => string, + None => { + return Err("File/folder names containing non-UTF8 characters aren't portable".into()) + } + }; + let last_char = match lossy_str.chars().last() { + Some(chr) => chr, + None => return Err("File/folder name is empty".into()), + }; + if [' ', '.'].iter().any(|&x| x == last_char) { + // The Windows shell and UI don't support component names ending in periods or spaces + // Source: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file + return Err("Windows forbids path components ending with spaces/periods".into()); + } + + #[allow(clippy::match_same_arms)] // Would need to cram everything onto one arm otherwise + if lossy_str.as_bytes().iter().any(|c| match c { + // invalid on all APIs which don't use counted strings like inside the NT kernel + b'\0' => true, + // invalid under FAT*, VFAT, exFAT, and NTFS + 0x1..=0x1f | 0x7f | b'"' | b'*' | b'<' | b'>' | b'?' | b'|' => true, + // POSIX path separator (invalid on Unixy platforms like Linux and BSD) + b'/' => true, + // HFS/Carbon path separator (invalid in filenames on MacOS and Mac filesystems) + // DOS/Win32 drive separator (invalid in filenames on Windows and Windows filesystems) + b':' => true, + // DOS/Windows path separator (invalid in filenames on Windows and Windows filesystems) + b'\\' => true, + // let everything else through + _ => false, + }) { + #[rustfmt::skip] + return Err(format!("Path component contains invalid characters: {}", + path.display()).into()); + } + + // Reserved DOS filenames that still can't be used on modern Windows for compatibility + if let Some(file_stem) = path.file_stem() { + let stem = file_stem.to_string_lossy().to_uppercase(); + if RESERVED_DOS_FILENAMES.iter().any(|&x| x == stem) { + Err(format!("Filename is reserved on Windows: {:?}", file_stem).into()) + } else { + Ok(()) + } + } else { + Ok(()) + } +} + +#[cfg(test)] +mod tests { + #![allow(clippy::wildcard_imports, clippy::panic, clippy::result_expect_used)] // OK for tests + + use super::*; + use std::ffi::OsStr; + + #[cfg(unix)] + use std::os::unix::ffi::OsStrExt; + #[cfg(windows)] + use std::os::windows::ffi::OsStringExt; + + #[test] + #[cfg(unix)] + #[rustfmt::skip] + fn path_output_dir_basic_functionality() { + assert!(path_output_dir(OsStr::new("/")).is_err()); // Root + assert!(path_output_dir(OsStr::new("/tmp")).is_ok()); // OK Folder + assert!(path_output_dir(OsStr::new("/dev/null")).is_err()); // OK File + assert!(path_output_dir(OsStr::new("/etc/shadow")).is_err()); // Denied File + assert!(path_output_dir(OsStr::new("/etc/ssl/private")).is_err()); // Denied Folder + assert!(path_output_dir(OsStr::new("/nonexistant_test_path")).is_err()); // Missing Path + assert!(path_output_dir(OsStr::new("/tmp\0with\0null")).is_err()); // Invalid CString + // TODO: Not-already-canonicalized paths (eg. relative paths) + + assert!(path_output_dir(OsStr::from_bytes(b"/not\xffutf8")).is_err()); // Invalid UTF-8 + // TODO: Non-UTF8 path that actually does exist and is writable + } + + #[test] + #[cfg(windows)] + fn path_output_dir_basic_functionality() { + unimplemented!("TODO: Implement Windows version of path_output_dir"); + } + + // ---- path_readable_file ---- + + #[test] + fn path_readable_file_stdin_test() { + assert!(path_readable_file(OsStr::new("-")).is_err()); + assert!(path_readable_file_or_stdin(OsStr::new("-")).is_ok()); + } + + #[cfg(unix)] + #[test] + #[rustfmt::skip] + fn path_readable_file_basic_functionality() { + for func in &[path_readable_file, path_readable_file_or_stdin] { + // Existing paths + assert!(func(OsStr::new("/bin/sh")).is_ok()); // OK File + assert!(func(OsStr::new("/bin/../etc/.././bin/sh")).is_ok()); // Non-canonicalized + assert!(func(OsStr::new("/../../../../bin/sh")).is_ok()); // Above root + + // Inaccessible, nonexistent, or invalid paths + assert!(func(OsStr::new("")).is_err()); // Empty String + assert!(func(OsStr::new("/")).is_err()); // OK Folder + assert!(func(OsStr::new("/etc/shadow")).is_err()); // Denied File + assert!(func(OsStr::new("/etc/ssl/private")).is_err()); // Denied Folder + assert!(func(OsStr::new("/nonexistant_test_path")).is_err()); // Missing Path + assert!(func(OsStr::new("/null\0containing")).is_err()); // Invalid CString + } + } + + #[cfg(windows)] + #[test] + fn path_readable_file_basic_functionality() { + unimplemented!("TODO: Pick some appropriate equivalent test paths for Windows"); + } + + #[cfg(unix)] + #[test] + #[rustfmt::skip] + fn path_readable_file_invalid_utf8() { + for func in &[path_readable_file, path_readable_file_or_stdin] { + assert!(func(OsStr::from_bytes(b"/not\xffutf8")).is_err()); // Invalid UTF-8 + // TODO: Non-UTF8 path that actually IS valid + } + } + #[cfg(windows)] + #[test] + #[rustfmt::skip] + fn path_readable_file_unpaired_surrogates() { + for func in &[path_readable_file, path_readable_file_or_stdin] { + assert!(path_readable_file(&OsString::from_wide( + &['C' as u16, ':' as u16, '\\' as u16, 0xd800])).is_err()); + // TODO: Unpaired surrogate path that actually IS valid + } + } + + // ---- filename_valid_portable ---- + + #[rustfmt::skip] + const VALID_FILENAMES: &[&str] = &[ + "-", // stdin/stdout + "test1", "te st", ".test", // regular, space, and leading period + "lpt", "lpt0", "lpt10", // would break if DOS reserved check is doing dumb matching + ]; + + // Paths which should pass because std::path::Path will recognize the separators + // TODO: Actually run the tests on Windows to make sure they work + #[cfg(windows)] + const PATHS_WITH_NATIVE_SEPARATORS: &[&str] = + &["re/lative", "/ab/solute", "re\\lative", "\\ab\\solute"]; + #[cfg(unix)] + const PATHS_WITH_NATIVE_SEPARATORS: &[&str] = &["re/lative", "/ab/solute"]; + + // Paths which should fail because std::path::Path won't recognize the separators and we don't + // want them showing up in the components. + #[cfg(windows)] + const PATHS_WITH_FOREIGN_SEPARATORS: &[&str] = &["Classic Mac HD:Folder Name:File"]; + #[cfg(unix)] + const PATHS_WITH_FOREIGN_SEPARATORS: &[&str] = &[ + "relative\\win32", + "C:\\absolute\\win32", + "\\drive\\relative\\win32", + "\\\\unc\\path\\for\\win32", + "Classic Mac HD:Folder Name:File", + ]; + + // Source: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file + #[rustfmt::skip] + const INVALID_PORTABLE_FILENAMES: &[&str] = &[ + "test\x03", "test\x07", "test\x08", "test\x0B", "test\x7f", // Control characters (VFAT) + "\"test\"", "", "testsss|", "testsss*", "testsss?", "?estsss", // VFAT + "ends with space ", "ends_with_period.", // DOS/Win32 + "CON", "Con", "coN", "cOn", "CoN", "con", "lpt1", "com9", // Reserved names (DOS/Win32) + "con.txt", "lpt1.dat", // DOS/Win32 API (Reserved names are extension agnostic) + "", "\0"]; // POSIX + + #[test] + fn filename_valid_portable_accepts_valid_names() { + for path in VALID_FILENAMES { + assert!(filename_valid_portable(OsStr::new(path)).is_ok(), "{:?}", path); + } + } + + #[test] + fn filename_valid_portable_refuses_path_separators() { + for path in PATHS_WITH_NATIVE_SEPARATORS { + assert!(filename_valid_portable(OsStr::new(path)).is_err(), "{:?}", path); + } + for path in PATHS_WITH_FOREIGN_SEPARATORS { + assert!(filename_valid_portable(OsStr::new(path)).is_err(), "{:?}", path); + } + } + + #[test] + fn filename_valid_portable_refuses_invalid_characters() { + for fname in INVALID_PORTABLE_FILENAMES { + assert!(filename_valid_portable(OsStr::new(fname)).is_err(), "{:?}", fname); + } + } + + #[test] + fn filename_valid_portable_refuses_empty_strings() { + assert!(filename_valid_portable(OsStr::new("")).is_err()); + } + + #[test] + fn filename_valid_portable_enforces_length_limits() { + // 256 characters + let mut test_str = std::str::from_utf8(&[b'X'; 256]).expect("parsing constant"); + assert!(filename_valid_portable(OsStr::new(test_str)).is_err()); + + // 255 characters (maximum for NTFS, ext2/3/4, and a lot of others) + test_str = std::str::from_utf8(&[b'X'; 255]).expect("parsing constant"); + assert!(filename_valid_portable(OsStr::new(test_str)).is_ok()); + } + + #[cfg(unix)] + #[test] + fn filename_valid_portable_refuses_non_utf8_bytes() { + // Ensure that we refuse invalid UTF-8 since it's unclear if/how things like POSIX's + // "bag of bytes" paths and Windows's un-paired UTF-16 surrogates map to each other. + assert!(filename_valid_portable(OsStr::from_bytes(b"\xff")).is_err()); + } + #[cfg(windows)] + #[test] + fn filename_valid_portable_accepts_unpaired_surrogates() { + assert!(path_valid_portable(&OsString::from_wide(&[0xd800])).is_ok()); + } + + // ---- path_valid_portable ---- + + #[test] + fn path_valid_portable_accepts_stdout() { + assert!(path_valid_portable(OsStr::new("-")).is_ok()); + } + + #[test] + fn path_valid_portable_accepts_valid_names() { + for path in VALID_FILENAMES { + assert!(path_valid_portable(OsStr::new(path)).is_ok(), "{:?}", path); + } + + // No filename (.file_stem() returns None) + assert!(path_valid_portable(OsStr::new("foo/..")).is_ok()); + } + + #[test] + fn path_valid_portable_accepts_native_path_separators() { + for path in PATHS_WITH_NATIVE_SEPARATORS { + assert!(path_valid_portable(OsStr::new(path)).is_ok(), "{:?}", path); + } + + // Verify that repeated separators are getting collapsed before filename_valid_portable + // sees them. + // TODO: Make this conditional on platform and also test repeated backslashes on Windows + assert!(path_valid_portable(OsStr::new("/path//with/repeated//separators")).is_ok()); + } + + #[test] + fn path_valid_portable_refuses_foreign_path_separators() { + for path in PATHS_WITH_FOREIGN_SEPARATORS { + assert!(path_valid_portable(OsStr::new(path)).is_err(), "{:?}", path); + } + } + + #[test] + fn path_valid_portable_refuses_invalid_characters() { + for fname in INVALID_PORTABLE_FILENAMES { + assert!(path_valid_portable(OsStr::new(fname)).is_err(), "{:?}", fname); + } + } + + #[test] + fn path_valid_portable_enforces_length_limits() { + let mut test_string = String::with_capacity(255 * 130); + #[allow(clippy::decimal_literal_representation)] // Path lengths more intuitive as decimal + while test_string.len() < 32761 { + test_string.push_str(std::str::from_utf8(&[b'X'; 255]).expect("utf8 from literal")); + test_string.push('/'); + } + + // >32760 characters + assert!(path_valid_portable(OsStr::new(&test_string)).is_err()); + + // 32760 characters (maximum for FAT32/VFAT/exFAT) + test_string.truncate(32760); + assert!(path_valid_portable(OsStr::new(&test_string)).is_ok()); + + // 256 characters with no path separators + test_string.truncate(255); + test_string.push('X'); + assert!(path_valid_portable(OsStr::new(&test_string)).is_err()); + + // 255 characters with no path separators + test_string.truncate(255); + assert!(path_valid_portable(OsStr::new(&test_string)).is_ok()); + } + + #[cfg(unix)] + #[test] + fn path_valid_portable_accepts_non_utf8_bytes() { + // Ensure that we refuse invalid UTF-8 since it's unclear if/how things like POSIX's + // "bag of bytes" paths and Windows's un-paired UTF-16 surrogates map to each other. + assert!(path_valid_portable(OsStr::from_bytes(b"/\xff/foo")).is_err()); + } + #[cfg(windows)] + #[test] + fn path_valid_portable_accepts_unpaired_surrogates() { + #[rustfmt::skip] + assert!(path_valid_portable(&OsString::from_wide( + &['C' as u16, ':' as u16, '\\' as u16, 0xd800])).is_ok()); + } +} diff --git a/src/web.rs b/src/web.rs new file mode 100644 index 0000000..8a96a40 --- /dev/null +++ b/src/web.rs @@ -0,0 +1,87 @@ +// #![deny(warnings)] +#[allow(clippy::missing_docs_in_private_items)] + +use crate::clouds; +use tokio::fs::File; + +use tokio_util::codec::{BytesCodec, FramedRead}; + +use hyper::service::{make_service_fn, service_fn}; +use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; + +#[allow(clippy::missing_docs_in_private_items)] +static INDEX: &str = "html/send_file_index.html"; +#[allow(clippy::missing_docs_in_private_items)] +static NOTFOUND: &[u8] = b"Not Found"; + +// https://docs.rs/hyper/0.11.2/hyper/header/struct.Authorization.html +// https://github.com/aramperes/hyper-server-ssl-auth-example/blob/master/src/main.rs +// https://dev.to/deciduously/skip-the-framework-build-a-simple-rust-api-with-hyper-4jf5 +/* + +#[tokio::main] +pub async fn web_main() -> std::io::Result<()> { // Result<()> { + pretty_env_logger::init(); + + let addr = "127.0.0.1:1337".parse().unwrap(); + + let make_service = + make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(response_examples)) }); + + let server = Server::bind(&addr).serve(make_service); + + println!("Listening on http://{}", addr); + + if let Err(e) = server.await { + eprintln!("server error: {}", e); + } + Ok(()) +} +*/ +#[allow(clippy::missing_docs_in_private_items)] +pub async fn response_examples(req: Request) -> Result> { + match (req.method(), req.uri().path()) { + (&Method::GET, "/") | (&Method::GET, "/index.html") => simple_file_send(INDEX).await, + (&Method::GET, "/y") | (&Method::GET, "/yaml.html") => data_file_send().await, + (&Method::GET, "/no_file.html") => { + // Test what happens when file cannot be be found + simple_file_send("this_file_should_not_exist.html").await + } + _ => Ok(not_found()), + } +} + +/// HTTP status code 404 +#[allow(clippy::missing_docs_in_private_items,clippy::unwrap_used)] +fn not_found() -> Response { + Response::builder() + .status(StatusCode::NOT_FOUND) + .body(NOTFOUND.into()) + .unwrap() +} + +#[allow(clippy::missing_docs_in_private_items)] +pub async fn simple_file_send(filename: &str) -> Result> { + // Serve a file by asynchronously reading it by chunks using tokio-util crate. + + if let Ok(file) = File::open(filename).await { + let stream = FramedRead::new(file, BytesCodec::new()); + let body = Body::wrap_stream(stream); + return Ok(Response::new(body)); + } + + Ok(not_found()) +} + +#[allow(clippy::missing_docs_in_private_items)] +pub async fn data_file_send() -> Result> { + // Serve a file by asynchronously reading it by chunks using tokio-util crate. + + // if let Ok(file) = File::open(filename).await { + // let stream = FramedRead::new(file, BytesCodec::new()); + // let body = Body::wrap_stream(stream); + match clouds::on_cloud("createserver", "test","install","","", 1).await { + Ok(data) => Ok(Response::new(Body::from(data))), + Err(_) =>Ok(Response::new(Body::from("Error"))) + } +} \ No newline at end of file