├── .github └── workflows │ └── main.yaml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── readme-images ├── main.png └── network.png └── src ├── app.rs ├── client.rs ├── config.rs ├── display.rs ├── main.rs ├── nets.rs └── terminal.rs /.github/workflows/main.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - v[0-9]+.* 7 | 8 | jobs: 9 | create-release: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | - uses: taiki-e/create-gh-release-action@v1 14 | # with: 15 | # (optional) Path to changelog. 16 | #changelog: CHANGELOG.md 17 | env: 18 | # (required) GitHub token for creating GitHub Releases. 19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 20 | upload-assets: 21 | strategy: 22 | matrix: 23 | os: 24 | - ubuntu-latest 25 | - macos-latest 26 | #- windows-latest 27 | runs-on: ${{ matrix.os }} 28 | steps: 29 | - uses: actions/checkout@v3 30 | - uses: taiki-e/upload-rust-binary-action@v1 31 | with: 32 | # (required) 33 | bin: ztui 34 | # (optional) On which platform to distribute the `.tar.gz` file. 35 | # [default value: unix] 36 | # [possible values: all, unix, windows, none] 37 | tar: unix 38 | # (optional) On which platform to distribute the `.zip` file. 39 | # [default value: windows] 40 | # [possible values: all, unix, windows, none] 41 | zip: windows 42 | env: 43 | # (required) 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aho-corasick" 13 | version = "0.7.20" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" 16 | dependencies = [ 17 | "memchr", 18 | ] 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.0.1" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "android_system_properties" 31 | version = "0.1.5" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 34 | dependencies = [ 35 | "libc", 36 | ] 37 | 38 | [[package]] 39 | name = "ansi_colours" 40 | version = "1.2.1" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "7db9d9767fde724f83933a716ee182539788f293828244e9d999695ce0f7ba1e" 43 | dependencies = [ 44 | "rgb", 45 | ] 46 | 47 | [[package]] 48 | name = "anstream" 49 | version = "0.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" 52 | dependencies = [ 53 | "anstyle", 54 | "anstyle-parse", 55 | "anstyle-query", 56 | "anstyle-wincon", 57 | "colorchoice", 58 | "is-terminal", 59 | "utf8parse", 60 | ] 61 | 62 | [[package]] 63 | name = "anstyle" 64 | version = "1.0.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" 67 | 68 | [[package]] 69 | name = "anstyle-parse" 70 | version = "0.2.0" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" 73 | dependencies = [ 74 | "utf8parse", 75 | ] 76 | 77 | [[package]] 78 | name = "anstyle-query" 79 | version = "1.0.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" 82 | dependencies = [ 83 | "windows-sys 0.48.0", 84 | ] 85 | 86 | [[package]] 87 | name = "anstyle-wincon" 88 | version = "1.0.1" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" 91 | dependencies = [ 92 | "anstyle", 93 | "windows-sys 0.48.0", 94 | ] 95 | 96 | [[package]] 97 | name = "anyhow" 98 | version = "1.0.71" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" 101 | 102 | [[package]] 103 | name = "atty" 104 | version = "0.2.14" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 107 | dependencies = [ 108 | "hermit-abi 0.1.19", 109 | "libc", 110 | "winapi", 111 | ] 112 | 113 | [[package]] 114 | name = "autocfg" 115 | version = "1.1.0" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 118 | 119 | [[package]] 120 | name = "base64" 121 | version = "0.21.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" 124 | 125 | [[package]] 126 | name = "bat" 127 | version = "0.23.0" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "fd4b13b0233143ae151a66e0135d715b65f631d1028c40502cc88182bcb9f4fa" 130 | dependencies = [ 131 | "ansi_colours", 132 | "atty", 133 | "bincode", 134 | "bytesize", 135 | "clap", 136 | "clircle", 137 | "console", 138 | "content_inspector", 139 | "dirs", 140 | "encoding", 141 | "flate2", 142 | "globset", 143 | "grep-cli", 144 | "nu-ansi-term", 145 | "once_cell", 146 | "path_abs", 147 | "plist", 148 | "semver 1.0.17", 149 | "serde", 150 | "serde_yaml", 151 | "shell-words", 152 | "syntect", 153 | "thiserror", 154 | "unicode-width", 155 | "wild", 156 | ] 157 | 158 | [[package]] 159 | name = "bincode" 160 | version = "1.3.3" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 163 | dependencies = [ 164 | "serde", 165 | ] 166 | 167 | [[package]] 168 | name = "bitflags" 169 | version = "1.3.2" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 172 | 173 | [[package]] 174 | name = "bstr" 175 | version = "1.4.0" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" 178 | dependencies = [ 179 | "memchr", 180 | "once_cell", 181 | "regex-automata", 182 | "serde", 183 | ] 184 | 185 | [[package]] 186 | name = "bumpalo" 187 | version = "3.12.2" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" 190 | 191 | [[package]] 192 | name = "byte-unit" 193 | version = "4.0.19" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | checksum = "da78b32057b8fdfc352504708feeba7216dcd65a2c9ab02978cbd288d1279b6c" 196 | dependencies = [ 197 | "serde", 198 | "utf8-width", 199 | ] 200 | 201 | [[package]] 202 | name = "bytemuck" 203 | version = "1.13.1" 204 | source = "registry+https://github.com/rust-lang/crates.io-index" 205 | checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" 206 | 207 | [[package]] 208 | name = "bytes" 209 | version = "1.4.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 212 | 213 | [[package]] 214 | name = "bytesize" 215 | version = "1.2.0" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" 218 | 219 | [[package]] 220 | name = "cassowary" 221 | version = "0.3.0" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" 224 | 225 | [[package]] 226 | name = "cc" 227 | version = "1.0.79" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 230 | 231 | [[package]] 232 | name = "cfg-if" 233 | version = "0.1.10" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 236 | 237 | [[package]] 238 | name = "cfg-if" 239 | version = "1.0.0" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 242 | 243 | [[package]] 244 | name = "chrono" 245 | version = "0.4.24" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" 248 | dependencies = [ 249 | "iana-time-zone", 250 | "js-sys", 251 | "num-integer", 252 | "num-traits", 253 | "serde", 254 | "time 0.1.45", 255 | "wasm-bindgen", 256 | "winapi", 257 | ] 258 | 259 | [[package]] 260 | name = "clap" 261 | version = "4.2.7" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" 264 | dependencies = [ 265 | "clap_builder", 266 | ] 267 | 268 | [[package]] 269 | name = "clap_builder" 270 | version = "4.2.7" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" 273 | dependencies = [ 274 | "anstream", 275 | "anstyle", 276 | "bitflags", 277 | "clap_lex", 278 | "once_cell", 279 | "strsim", 280 | "terminal_size", 281 | ] 282 | 283 | [[package]] 284 | name = "clap_lex" 285 | version = "0.4.1" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" 288 | 289 | [[package]] 290 | name = "clircle" 291 | version = "0.3.0" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396" 294 | dependencies = [ 295 | "cfg-if 1.0.0", 296 | "libc", 297 | "serde", 298 | "winapi", 299 | ] 300 | 301 | [[package]] 302 | name = "colorchoice" 303 | version = "1.0.0" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 306 | 307 | [[package]] 308 | name = "console" 309 | version = "0.15.6" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "d0525278dce688103060006713371cedbad27186c7d913f33d866b498da0f595" 312 | dependencies = [ 313 | "encode_unicode", 314 | "lazy_static", 315 | "libc", 316 | "unicode-width", 317 | "windows-sys 0.45.0", 318 | ] 319 | 320 | [[package]] 321 | name = "content_inspector" 322 | version = "0.2.4" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" 325 | dependencies = [ 326 | "memchr", 327 | ] 328 | 329 | [[package]] 330 | name = "core-foundation" 331 | version = "0.9.3" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 334 | dependencies = [ 335 | "core-foundation-sys", 336 | "libc", 337 | ] 338 | 339 | [[package]] 340 | name = "core-foundation-sys" 341 | version = "0.8.4" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 344 | 345 | [[package]] 346 | name = "crc32fast" 347 | version = "1.3.2" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 350 | dependencies = [ 351 | "cfg-if 1.0.0", 352 | ] 353 | 354 | [[package]] 355 | name = "crossterm" 356 | version = "0.25.0" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" 359 | dependencies = [ 360 | "bitflags", 361 | "crossterm_winapi", 362 | "libc", 363 | "mio", 364 | "parking_lot", 365 | "signal-hook", 366 | "signal-hook-mio", 367 | "winapi", 368 | ] 369 | 370 | [[package]] 371 | name = "crossterm" 372 | version = "0.26.1" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" 375 | dependencies = [ 376 | "bitflags", 377 | "crossterm_winapi", 378 | "libc", 379 | "mio", 380 | "parking_lot", 381 | "signal-hook", 382 | "signal-hook-mio", 383 | "winapi", 384 | ] 385 | 386 | [[package]] 387 | name = "crossterm_winapi" 388 | version = "0.9.0" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" 391 | dependencies = [ 392 | "winapi", 393 | ] 394 | 395 | [[package]] 396 | name = "directories" 397 | version = "5.0.1" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" 400 | dependencies = [ 401 | "dirs-sys", 402 | ] 403 | 404 | [[package]] 405 | name = "dirs" 406 | version = "5.0.1" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" 409 | dependencies = [ 410 | "dirs-sys", 411 | ] 412 | 413 | [[package]] 414 | name = "dirs-sys" 415 | version = "0.4.1" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" 418 | dependencies = [ 419 | "libc", 420 | "option-ext", 421 | "redox_users", 422 | "windows-sys 0.48.0", 423 | ] 424 | 425 | [[package]] 426 | name = "downcast-rs" 427 | version = "1.2.0" 428 | source = "registry+https://github.com/rust-lang/crates.io-index" 429 | checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" 430 | 431 | [[package]] 432 | name = "dyn-clone" 433 | version = "1.0.11" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" 436 | 437 | [[package]] 438 | name = "encode_unicode" 439 | version = "0.3.6" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 442 | 443 | [[package]] 444 | name = "encoding" 445 | version = "0.2.33" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" 448 | dependencies = [ 449 | "encoding-index-japanese", 450 | "encoding-index-korean", 451 | "encoding-index-simpchinese", 452 | "encoding-index-singlebyte", 453 | "encoding-index-tradchinese", 454 | ] 455 | 456 | [[package]] 457 | name = "encoding-index-japanese" 458 | version = "1.20141219.5" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" 461 | dependencies = [ 462 | "encoding_index_tests", 463 | ] 464 | 465 | [[package]] 466 | name = "encoding-index-korean" 467 | version = "1.20141219.5" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" 470 | dependencies = [ 471 | "encoding_index_tests", 472 | ] 473 | 474 | [[package]] 475 | name = "encoding-index-simpchinese" 476 | version = "1.20141219.5" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" 479 | dependencies = [ 480 | "encoding_index_tests", 481 | ] 482 | 483 | [[package]] 484 | name = "encoding-index-singlebyte" 485 | version = "1.20141219.5" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" 488 | dependencies = [ 489 | "encoding_index_tests", 490 | ] 491 | 492 | [[package]] 493 | name = "encoding-index-tradchinese" 494 | version = "1.20141219.5" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" 497 | dependencies = [ 498 | "encoding_index_tests", 499 | ] 500 | 501 | [[package]] 502 | name = "encoding_index_tests" 503 | version = "0.1.4" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" 506 | 507 | [[package]] 508 | name = "encoding_rs" 509 | version = "0.8.32" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" 512 | dependencies = [ 513 | "cfg-if 1.0.0", 514 | ] 515 | 516 | [[package]] 517 | name = "errno" 518 | version = "0.3.1" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 521 | dependencies = [ 522 | "errno-dragonfly", 523 | "libc", 524 | "windows-sys 0.48.0", 525 | ] 526 | 527 | [[package]] 528 | name = "errno-dragonfly" 529 | version = "0.1.2" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 532 | dependencies = [ 533 | "cc", 534 | "libc", 535 | ] 536 | 537 | [[package]] 538 | name = "fancy-duration" 539 | version = "0.2.1" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "1513718752a185157254ce39805f589a33abbc64788cdbba30cc1039b8a2d524" 542 | dependencies = [ 543 | "itoa", 544 | "time 0.3.21", 545 | ] 546 | 547 | [[package]] 548 | name = "fastrand" 549 | version = "1.9.0" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 552 | dependencies = [ 553 | "instant", 554 | ] 555 | 556 | [[package]] 557 | name = "filedescriptor" 558 | version = "0.8.2" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e" 561 | dependencies = [ 562 | "libc", 563 | "thiserror", 564 | "winapi", 565 | ] 566 | 567 | [[package]] 568 | name = "flate2" 569 | version = "1.0.26" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 572 | dependencies = [ 573 | "crc32fast", 574 | "miniz_oxide", 575 | ] 576 | 577 | [[package]] 578 | name = "fnv" 579 | version = "1.0.7" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 582 | 583 | [[package]] 584 | name = "foreign-types" 585 | version = "0.3.2" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 588 | dependencies = [ 589 | "foreign-types-shared", 590 | ] 591 | 592 | [[package]] 593 | name = "foreign-types-shared" 594 | version = "0.1.1" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 597 | 598 | [[package]] 599 | name = "form_urlencoded" 600 | version = "1.1.0" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 603 | dependencies = [ 604 | "percent-encoding", 605 | ] 606 | 607 | [[package]] 608 | name = "futures" 609 | version = "0.3.28" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" 612 | dependencies = [ 613 | "futures-channel", 614 | "futures-core", 615 | "futures-executor", 616 | "futures-io", 617 | "futures-sink", 618 | "futures-task", 619 | "futures-util", 620 | ] 621 | 622 | [[package]] 623 | name = "futures-channel" 624 | version = "0.3.28" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 627 | dependencies = [ 628 | "futures-core", 629 | "futures-sink", 630 | ] 631 | 632 | [[package]] 633 | name = "futures-core" 634 | version = "0.3.28" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 637 | 638 | [[package]] 639 | name = "futures-executor" 640 | version = "0.3.28" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" 643 | dependencies = [ 644 | "futures-core", 645 | "futures-task", 646 | "futures-util", 647 | ] 648 | 649 | [[package]] 650 | name = "futures-io" 651 | version = "0.3.28" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" 654 | 655 | [[package]] 656 | name = "futures-macro" 657 | version = "0.3.28" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" 660 | dependencies = [ 661 | "proc-macro2", 662 | "quote", 663 | "syn 2.0.16", 664 | ] 665 | 666 | [[package]] 667 | name = "futures-sink" 668 | version = "0.3.28" 669 | source = "registry+https://github.com/rust-lang/crates.io-index" 670 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 671 | 672 | [[package]] 673 | name = "futures-task" 674 | version = "0.3.28" 675 | source = "registry+https://github.com/rust-lang/crates.io-index" 676 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 677 | 678 | [[package]] 679 | name = "futures-util" 680 | version = "0.3.28" 681 | source = "registry+https://github.com/rust-lang/crates.io-index" 682 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 683 | dependencies = [ 684 | "futures-channel", 685 | "futures-core", 686 | "futures-io", 687 | "futures-macro", 688 | "futures-sink", 689 | "futures-task", 690 | "memchr", 691 | "pin-project-lite", 692 | "pin-utils", 693 | "slab", 694 | ] 695 | 696 | [[package]] 697 | name = "getopts" 698 | version = "0.2.21" 699 | source = "registry+https://github.com/rust-lang/crates.io-index" 700 | checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" 701 | dependencies = [ 702 | "unicode-width", 703 | ] 704 | 705 | [[package]] 706 | name = "getrandom" 707 | version = "0.2.9" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" 710 | dependencies = [ 711 | "cfg-if 1.0.0", 712 | "libc", 713 | "wasi 0.11.0+wasi-snapshot-preview1", 714 | ] 715 | 716 | [[package]] 717 | name = "glob" 718 | version = "0.3.1" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" 721 | 722 | [[package]] 723 | name = "globset" 724 | version = "0.4.10" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" 727 | dependencies = [ 728 | "aho-corasick 0.7.20", 729 | "bstr", 730 | "fnv", 731 | "log", 732 | "regex", 733 | ] 734 | 735 | [[package]] 736 | name = "grep-cli" 737 | version = "0.1.7" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "d19fc6687bc64b6719a839cd24f2c700bcb05ffeb684d19da6a637c2455a7ba1" 740 | dependencies = [ 741 | "atty", 742 | "bstr", 743 | "globset", 744 | "lazy_static", 745 | "log", 746 | "regex", 747 | "same-file", 748 | "termcolor", 749 | "winapi-util", 750 | ] 751 | 752 | [[package]] 753 | name = "h2" 754 | version = "0.3.19" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" 757 | dependencies = [ 758 | "bytes", 759 | "fnv", 760 | "futures-core", 761 | "futures-sink", 762 | "futures-util", 763 | "http", 764 | "indexmap", 765 | "slab", 766 | "tokio", 767 | "tokio-util", 768 | "tracing", 769 | ] 770 | 771 | [[package]] 772 | name = "hashbrown" 773 | version = "0.12.3" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 776 | 777 | [[package]] 778 | name = "heck" 779 | version = "0.4.1" 780 | source = "registry+https://github.com/rust-lang/crates.io-index" 781 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 782 | 783 | [[package]] 784 | name = "hermit-abi" 785 | version = "0.1.19" 786 | source = "registry+https://github.com/rust-lang/crates.io-index" 787 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 788 | dependencies = [ 789 | "libc", 790 | ] 791 | 792 | [[package]] 793 | name = "hermit-abi" 794 | version = "0.2.6" 795 | source = "registry+https://github.com/rust-lang/crates.io-index" 796 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 797 | dependencies = [ 798 | "libc", 799 | ] 800 | 801 | [[package]] 802 | name = "hermit-abi" 803 | version = "0.3.1" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 806 | 807 | [[package]] 808 | name = "home" 809 | version = "0.5.5" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" 812 | dependencies = [ 813 | "windows-sys 0.48.0", 814 | ] 815 | 816 | [[package]] 817 | name = "http" 818 | version = "0.2.9" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 821 | dependencies = [ 822 | "bytes", 823 | "fnv", 824 | "itoa", 825 | ] 826 | 827 | [[package]] 828 | name = "http-body" 829 | version = "0.4.5" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 832 | dependencies = [ 833 | "bytes", 834 | "http", 835 | "pin-project-lite", 836 | ] 837 | 838 | [[package]] 839 | name = "httparse" 840 | version = "1.8.0" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 843 | 844 | [[package]] 845 | name = "httpdate" 846 | version = "1.0.2" 847 | source = "registry+https://github.com/rust-lang/crates.io-index" 848 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 849 | 850 | [[package]] 851 | name = "hyper" 852 | version = "0.14.26" 853 | source = "registry+https://github.com/rust-lang/crates.io-index" 854 | checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" 855 | dependencies = [ 856 | "bytes", 857 | "futures-channel", 858 | "futures-core", 859 | "futures-util", 860 | "h2", 861 | "http", 862 | "http-body", 863 | "httparse", 864 | "httpdate", 865 | "itoa", 866 | "pin-project-lite", 867 | "socket2", 868 | "tokio", 869 | "tower-service", 870 | "tracing", 871 | "want", 872 | ] 873 | 874 | [[package]] 875 | name = "hyper-tls" 876 | version = "0.5.0" 877 | source = "registry+https://github.com/rust-lang/crates.io-index" 878 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 879 | dependencies = [ 880 | "bytes", 881 | "hyper", 882 | "native-tls", 883 | "tokio", 884 | "tokio-native-tls", 885 | ] 886 | 887 | [[package]] 888 | name = "iana-time-zone" 889 | version = "0.1.56" 890 | source = "registry+https://github.com/rust-lang/crates.io-index" 891 | checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" 892 | dependencies = [ 893 | "android_system_properties", 894 | "core-foundation-sys", 895 | "iana-time-zone-haiku", 896 | "js-sys", 897 | "wasm-bindgen", 898 | "windows", 899 | ] 900 | 901 | [[package]] 902 | name = "iana-time-zone-haiku" 903 | version = "0.1.2" 904 | source = "registry+https://github.com/rust-lang/crates.io-index" 905 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 906 | dependencies = [ 907 | "cc", 908 | ] 909 | 910 | [[package]] 911 | name = "idna" 912 | version = "0.3.0" 913 | source = "registry+https://github.com/rust-lang/crates.io-index" 914 | checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" 915 | dependencies = [ 916 | "unicode-bidi", 917 | "unicode-normalization", 918 | ] 919 | 920 | [[package]] 921 | name = "indexmap" 922 | version = "1.9.3" 923 | source = "registry+https://github.com/rust-lang/crates.io-index" 924 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 925 | dependencies = [ 926 | "autocfg", 927 | "hashbrown", 928 | "serde", 929 | ] 930 | 931 | [[package]] 932 | name = "instant" 933 | version = "0.1.12" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 936 | dependencies = [ 937 | "cfg-if 1.0.0", 938 | ] 939 | 940 | [[package]] 941 | name = "io-kit-sys" 942 | version = "0.2.0" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919" 945 | dependencies = [ 946 | "core-foundation-sys", 947 | "mach", 948 | ] 949 | 950 | [[package]] 951 | name = "io-lifetimes" 952 | version = "1.0.10" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" 955 | dependencies = [ 956 | "hermit-abi 0.3.1", 957 | "libc", 958 | "windows-sys 0.48.0", 959 | ] 960 | 961 | [[package]] 962 | name = "ioctl-rs" 963 | version = "0.1.6" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "f7970510895cee30b3e9128319f2cefd4bde883a39f38baa279567ba3a7eb97d" 966 | dependencies = [ 967 | "libc", 968 | ] 969 | 970 | [[package]] 971 | name = "ipnet" 972 | version = "2.7.2" 973 | source = "registry+https://github.com/rust-lang/crates.io-index" 974 | checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" 975 | 976 | [[package]] 977 | name = "is-terminal" 978 | version = "0.4.7" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" 981 | dependencies = [ 982 | "hermit-abi 0.3.1", 983 | "io-lifetimes", 984 | "rustix", 985 | "windows-sys 0.48.0", 986 | ] 987 | 988 | [[package]] 989 | name = "itoa" 990 | version = "1.0.6" 991 | source = "registry+https://github.com/rust-lang/crates.io-index" 992 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 993 | 994 | [[package]] 995 | name = "js-sys" 996 | version = "0.3.63" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" 999 | dependencies = [ 1000 | "wasm-bindgen", 1001 | ] 1002 | 1003 | [[package]] 1004 | name = "lazy_static" 1005 | version = "1.4.0" 1006 | source = "registry+https://github.com/rust-lang/crates.io-index" 1007 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 1008 | 1009 | [[package]] 1010 | name = "libc" 1011 | version = "0.2.144" 1012 | source = "registry+https://github.com/rust-lang/crates.io-index" 1013 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" 1014 | 1015 | [[package]] 1016 | name = "line-wrap" 1017 | version = "0.1.1" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" 1020 | dependencies = [ 1021 | "safemem", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "linked-hash-map" 1026 | version = "0.5.6" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" 1029 | 1030 | [[package]] 1031 | name = "linux-raw-sys" 1032 | version = "0.3.7" 1033 | source = "registry+https://github.com/rust-lang/crates.io-index" 1034 | checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" 1035 | 1036 | [[package]] 1037 | name = "lock_api" 1038 | version = "0.4.9" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 1041 | dependencies = [ 1042 | "autocfg", 1043 | "scopeguard", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "log" 1048 | version = "0.4.17" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 1051 | dependencies = [ 1052 | "cfg-if 1.0.0", 1053 | ] 1054 | 1055 | [[package]] 1056 | name = "mach" 1057 | version = "0.3.2" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" 1060 | dependencies = [ 1061 | "libc", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "memchr" 1066 | version = "2.5.0" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 1069 | 1070 | [[package]] 1071 | name = "memoffset" 1072 | version = "0.6.5" 1073 | source = "registry+https://github.com/rust-lang/crates.io-index" 1074 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 1075 | dependencies = [ 1076 | "autocfg", 1077 | ] 1078 | 1079 | [[package]] 1080 | name = "mime" 1081 | version = "0.3.17" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 1084 | 1085 | [[package]] 1086 | name = "miniz_oxide" 1087 | version = "0.7.1" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 1090 | dependencies = [ 1091 | "adler", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "mio" 1096 | version = "0.8.6" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" 1099 | dependencies = [ 1100 | "libc", 1101 | "log", 1102 | "wasi 0.11.0+wasi-snapshot-preview1", 1103 | "windows-sys 0.45.0", 1104 | ] 1105 | 1106 | [[package]] 1107 | name = "native-tls" 1108 | version = "0.2.11" 1109 | source = "registry+https://github.com/rust-lang/crates.io-index" 1110 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 1111 | dependencies = [ 1112 | "lazy_static", 1113 | "libc", 1114 | "log", 1115 | "openssl", 1116 | "openssl-probe", 1117 | "openssl-sys", 1118 | "schannel", 1119 | "security-framework", 1120 | "security-framework-sys", 1121 | "tempfile", 1122 | ] 1123 | 1124 | [[package]] 1125 | name = "nix" 1126 | version = "0.14.1" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" 1129 | dependencies = [ 1130 | "bitflags", 1131 | "cc", 1132 | "cfg-if 0.1.10", 1133 | "libc", 1134 | "void", 1135 | ] 1136 | 1137 | [[package]] 1138 | name = "nix" 1139 | version = "0.24.3" 1140 | source = "registry+https://github.com/rust-lang/crates.io-index" 1141 | checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" 1142 | dependencies = [ 1143 | "bitflags", 1144 | "cfg-if 1.0.0", 1145 | "libc", 1146 | "memoffset", 1147 | ] 1148 | 1149 | [[package]] 1150 | name = "nix" 1151 | version = "0.25.1" 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" 1153 | checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" 1154 | dependencies = [ 1155 | "autocfg", 1156 | "bitflags", 1157 | "cfg-if 1.0.0", 1158 | "libc", 1159 | "memoffset", 1160 | "pin-utils", 1161 | ] 1162 | 1163 | [[package]] 1164 | name = "nu-ansi-term" 1165 | version = "0.47.0" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76" 1168 | dependencies = [ 1169 | "windows-sys 0.45.0", 1170 | ] 1171 | 1172 | [[package]] 1173 | name = "num-integer" 1174 | version = "0.1.45" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 1177 | dependencies = [ 1178 | "autocfg", 1179 | "num-traits", 1180 | ] 1181 | 1182 | [[package]] 1183 | name = "num-traits" 1184 | version = "0.2.15" 1185 | source = "registry+https://github.com/rust-lang/crates.io-index" 1186 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 1187 | dependencies = [ 1188 | "autocfg", 1189 | ] 1190 | 1191 | [[package]] 1192 | name = "num_cpus" 1193 | version = "1.15.0" 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" 1195 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 1196 | dependencies = [ 1197 | "hermit-abi 0.2.6", 1198 | "libc", 1199 | ] 1200 | 1201 | [[package]] 1202 | name = "once_cell" 1203 | version = "1.17.1" 1204 | source = "registry+https://github.com/rust-lang/crates.io-index" 1205 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 1206 | 1207 | [[package]] 1208 | name = "onig" 1209 | version = "6.4.0" 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" 1211 | checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" 1212 | dependencies = [ 1213 | "bitflags", 1214 | "libc", 1215 | "once_cell", 1216 | "onig_sys", 1217 | ] 1218 | 1219 | [[package]] 1220 | name = "onig_sys" 1221 | version = "69.8.1" 1222 | source = "registry+https://github.com/rust-lang/crates.io-index" 1223 | checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" 1224 | dependencies = [ 1225 | "cc", 1226 | "pkg-config", 1227 | ] 1228 | 1229 | [[package]] 1230 | name = "openapiv3" 1231 | version = "1.0.2" 1232 | source = "registry+https://github.com/rust-lang/crates.io-index" 1233 | checksum = "7b1a9f106eb0a780abd17ba9fca8e0843e3461630bcbe2af0ad4d5d3ba4e9aa4" 1234 | dependencies = [ 1235 | "indexmap", 1236 | "serde", 1237 | "serde_json", 1238 | ] 1239 | 1240 | [[package]] 1241 | name = "openssl" 1242 | version = "0.10.52" 1243 | source = "registry+https://github.com/rust-lang/crates.io-index" 1244 | checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" 1245 | dependencies = [ 1246 | "bitflags", 1247 | "cfg-if 1.0.0", 1248 | "foreign-types", 1249 | "libc", 1250 | "once_cell", 1251 | "openssl-macros", 1252 | "openssl-sys", 1253 | ] 1254 | 1255 | [[package]] 1256 | name = "openssl-macros" 1257 | version = "0.1.1" 1258 | source = "registry+https://github.com/rust-lang/crates.io-index" 1259 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 1260 | dependencies = [ 1261 | "proc-macro2", 1262 | "quote", 1263 | "syn 2.0.16", 1264 | ] 1265 | 1266 | [[package]] 1267 | name = "openssl-probe" 1268 | version = "0.1.5" 1269 | source = "registry+https://github.com/rust-lang/crates.io-index" 1270 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 1271 | 1272 | [[package]] 1273 | name = "openssl-src" 1274 | version = "111.25.3+1.1.1t" 1275 | source = "registry+https://github.com/rust-lang/crates.io-index" 1276 | checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c" 1277 | dependencies = [ 1278 | "cc", 1279 | ] 1280 | 1281 | [[package]] 1282 | name = "openssl-sys" 1283 | version = "0.9.87" 1284 | source = "registry+https://github.com/rust-lang/crates.io-index" 1285 | checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" 1286 | dependencies = [ 1287 | "cc", 1288 | "libc", 1289 | "openssl-src", 1290 | "pkg-config", 1291 | "vcpkg", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "option-ext" 1296 | version = "0.2.0" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 1299 | 1300 | [[package]] 1301 | name = "parking_lot" 1302 | version = "0.12.1" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 1305 | dependencies = [ 1306 | "lock_api", 1307 | "parking_lot_core", 1308 | ] 1309 | 1310 | [[package]] 1311 | name = "parking_lot_core" 1312 | version = "0.9.7" 1313 | source = "registry+https://github.com/rust-lang/crates.io-index" 1314 | checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" 1315 | dependencies = [ 1316 | "cfg-if 1.0.0", 1317 | "libc", 1318 | "redox_syscall 0.2.16", 1319 | "smallvec", 1320 | "windows-sys 0.45.0", 1321 | ] 1322 | 1323 | [[package]] 1324 | name = "path_abs" 1325 | version = "0.5.1" 1326 | source = "registry+https://github.com/rust-lang/crates.io-index" 1327 | checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3" 1328 | dependencies = [ 1329 | "std_prelude", 1330 | ] 1331 | 1332 | [[package]] 1333 | name = "percent-encoding" 1334 | version = "2.2.0" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 1337 | 1338 | [[package]] 1339 | name = "pest" 1340 | version = "2.6.0" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" 1343 | dependencies = [ 1344 | "thiserror", 1345 | "ucd-trie", 1346 | ] 1347 | 1348 | [[package]] 1349 | name = "pin-project-lite" 1350 | version = "0.2.9" 1351 | source = "registry+https://github.com/rust-lang/crates.io-index" 1352 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 1353 | 1354 | [[package]] 1355 | name = "pin-utils" 1356 | version = "0.1.0" 1357 | source = "registry+https://github.com/rust-lang/crates.io-index" 1358 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1359 | 1360 | [[package]] 1361 | name = "pkg-config" 1362 | version = "0.3.27" 1363 | source = "registry+https://github.com/rust-lang/crates.io-index" 1364 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" 1365 | 1366 | [[package]] 1367 | name = "plist" 1368 | version = "1.4.3" 1369 | source = "registry+https://github.com/rust-lang/crates.io-index" 1370 | checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" 1371 | dependencies = [ 1372 | "base64", 1373 | "indexmap", 1374 | "line-wrap", 1375 | "quick-xml", 1376 | "serde", 1377 | "time 0.3.21", 1378 | ] 1379 | 1380 | [[package]] 1381 | name = "portable-pty" 1382 | version = "0.8.1" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "806ee80c2a03dbe1a9fb9534f8d19e4c0546b790cde8fd1fea9d6390644cb0be" 1385 | dependencies = [ 1386 | "anyhow", 1387 | "bitflags", 1388 | "downcast-rs", 1389 | "filedescriptor", 1390 | "lazy_static", 1391 | "libc", 1392 | "log", 1393 | "nix 0.25.1", 1394 | "serial", 1395 | "shared_library", 1396 | "shell-words", 1397 | "winapi", 1398 | "winreg", 1399 | ] 1400 | 1401 | [[package]] 1402 | name = "proc-macro2" 1403 | version = "1.0.58" 1404 | source = "registry+https://github.com/rust-lang/crates.io-index" 1405 | checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" 1406 | dependencies = [ 1407 | "unicode-ident", 1408 | ] 1409 | 1410 | [[package]] 1411 | name = "progenitor" 1412 | version = "0.1.1" 1413 | source = "registry+https://github.com/rust-lang/crates.io-index" 1414 | checksum = "54484468975e18aa57ed3e9a13ac0468160a433af89eee1189f681292eafc5d1" 1415 | dependencies = [ 1416 | "anyhow", 1417 | "getopts", 1418 | "openapiv3", 1419 | "progenitor-client 0.1.1", 1420 | "progenitor-impl", 1421 | "progenitor-macro", 1422 | "serde", 1423 | "serde_json", 1424 | ] 1425 | 1426 | [[package]] 1427 | name = "progenitor-client" 1428 | version = "0.1.1" 1429 | source = "registry+https://github.com/rust-lang/crates.io-index" 1430 | checksum = "45c7752120152426ce577c3de6b341fecdaae59883f31296d91871a6d7843206" 1431 | dependencies = [ 1432 | "bytes", 1433 | "futures-core", 1434 | "percent-encoding", 1435 | "reqwest", 1436 | "serde", 1437 | "serde_json", 1438 | ] 1439 | 1440 | [[package]] 1441 | name = "progenitor-client" 1442 | version = "0.3.0" 1443 | source = "registry+https://github.com/rust-lang/crates.io-index" 1444 | checksum = "20a0a6991db287668871a9682499f52ac525e5033a31c356f364b6f701b51079" 1445 | dependencies = [ 1446 | "bytes", 1447 | "futures-core", 1448 | "percent-encoding", 1449 | "reqwest", 1450 | "serde", 1451 | "serde_json", 1452 | "serde_urlencoded", 1453 | ] 1454 | 1455 | [[package]] 1456 | name = "progenitor-impl" 1457 | version = "0.1.1" 1458 | source = "registry+https://github.com/rust-lang/crates.io-index" 1459 | checksum = "1980a31d714128082fe8dd6a7cb6086c15080cdb9a693feba171361fb961b034" 1460 | dependencies = [ 1461 | "getopts", 1462 | "heck", 1463 | "indexmap", 1464 | "openapiv3", 1465 | "proc-macro2", 1466 | "quote", 1467 | "regex", 1468 | "rustfmt-wrapper", 1469 | "schemars", 1470 | "serde", 1471 | "serde_json", 1472 | "syn 1.0.109", 1473 | "thiserror", 1474 | "typify", 1475 | "unicode-xid", 1476 | ] 1477 | 1478 | [[package]] 1479 | name = "progenitor-macro" 1480 | version = "0.1.1" 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" 1482 | checksum = "0993b8f5bbcf35ec130f9d305cefbbd81f00c014c049bf298bd218529989b054" 1483 | dependencies = [ 1484 | "openapiv3", 1485 | "proc-macro2", 1486 | "progenitor-impl", 1487 | "quote", 1488 | "serde", 1489 | "serde_json", 1490 | "serde_tokenstream", 1491 | "syn 1.0.109", 1492 | ] 1493 | 1494 | [[package]] 1495 | name = "quick-xml" 1496 | version = "0.28.2" 1497 | source = "registry+https://github.com/rust-lang/crates.io-index" 1498 | checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" 1499 | dependencies = [ 1500 | "memchr", 1501 | ] 1502 | 1503 | [[package]] 1504 | name = "quote" 1505 | version = "1.0.27" 1506 | source = "registry+https://github.com/rust-lang/crates.io-index" 1507 | checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" 1508 | dependencies = [ 1509 | "proc-macro2", 1510 | ] 1511 | 1512 | [[package]] 1513 | name = "redox_syscall" 1514 | version = "0.2.16" 1515 | source = "registry+https://github.com/rust-lang/crates.io-index" 1516 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 1517 | dependencies = [ 1518 | "bitflags", 1519 | ] 1520 | 1521 | [[package]] 1522 | name = "redox_syscall" 1523 | version = "0.3.5" 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" 1525 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 1526 | dependencies = [ 1527 | "bitflags", 1528 | ] 1529 | 1530 | [[package]] 1531 | name = "redox_users" 1532 | version = "0.4.3" 1533 | source = "registry+https://github.com/rust-lang/crates.io-index" 1534 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 1535 | dependencies = [ 1536 | "getrandom", 1537 | "redox_syscall 0.2.16", 1538 | "thiserror", 1539 | ] 1540 | 1541 | [[package]] 1542 | name = "regex" 1543 | version = "1.8.1" 1544 | source = "registry+https://github.com/rust-lang/crates.io-index" 1545 | checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" 1546 | dependencies = [ 1547 | "aho-corasick 1.0.1", 1548 | "memchr", 1549 | "regex-syntax 0.7.1", 1550 | ] 1551 | 1552 | [[package]] 1553 | name = "regex-automata" 1554 | version = "0.1.10" 1555 | source = "registry+https://github.com/rust-lang/crates.io-index" 1556 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 1557 | 1558 | [[package]] 1559 | name = "regex-syntax" 1560 | version = "0.6.29" 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" 1562 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 1563 | 1564 | [[package]] 1565 | name = "regex-syntax" 1566 | version = "0.7.1" 1567 | source = "registry+https://github.com/rust-lang/crates.io-index" 1568 | checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" 1569 | 1570 | [[package]] 1571 | name = "reqwest" 1572 | version = "0.11.18" 1573 | source = "registry+https://github.com/rust-lang/crates.io-index" 1574 | checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" 1575 | dependencies = [ 1576 | "base64", 1577 | "bytes", 1578 | "encoding_rs", 1579 | "futures-core", 1580 | "futures-util", 1581 | "h2", 1582 | "http", 1583 | "http-body", 1584 | "hyper", 1585 | "hyper-tls", 1586 | "ipnet", 1587 | "js-sys", 1588 | "log", 1589 | "mime", 1590 | "native-tls", 1591 | "once_cell", 1592 | "percent-encoding", 1593 | "pin-project-lite", 1594 | "serde", 1595 | "serde_json", 1596 | "serde_urlencoded", 1597 | "tokio", 1598 | "tokio-native-tls", 1599 | "tokio-util", 1600 | "tower-service", 1601 | "url", 1602 | "wasm-bindgen", 1603 | "wasm-bindgen-futures", 1604 | "wasm-streams", 1605 | "web-sys", 1606 | "winreg", 1607 | ] 1608 | 1609 | [[package]] 1610 | name = "rgb" 1611 | version = "0.8.36" 1612 | source = "registry+https://github.com/rust-lang/crates.io-index" 1613 | checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59" 1614 | dependencies = [ 1615 | "bytemuck", 1616 | ] 1617 | 1618 | [[package]] 1619 | name = "rustfmt-wrapper" 1620 | version = "0.1.0" 1621 | source = "registry+https://github.com/rust-lang/crates.io-index" 1622 | checksum = "7733577fb5b13c8b256232e7ca84aa424f915efae6ec980082d60a03f99da3f8" 1623 | dependencies = [ 1624 | "tempfile", 1625 | "thiserror", 1626 | "toolchain_find", 1627 | ] 1628 | 1629 | [[package]] 1630 | name = "rustix" 1631 | version = "0.37.19" 1632 | source = "registry+https://github.com/rust-lang/crates.io-index" 1633 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" 1634 | dependencies = [ 1635 | "bitflags", 1636 | "errno", 1637 | "io-lifetimes", 1638 | "libc", 1639 | "linux-raw-sys", 1640 | "windows-sys 0.48.0", 1641 | ] 1642 | 1643 | [[package]] 1644 | name = "ryu" 1645 | version = "1.0.13" 1646 | source = "registry+https://github.com/rust-lang/crates.io-index" 1647 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1648 | 1649 | [[package]] 1650 | name = "safemem" 1651 | version = "0.3.3" 1652 | source = "registry+https://github.com/rust-lang/crates.io-index" 1653 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 1654 | 1655 | [[package]] 1656 | name = "same-file" 1657 | version = "1.0.6" 1658 | source = "registry+https://github.com/rust-lang/crates.io-index" 1659 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1660 | dependencies = [ 1661 | "winapi-util", 1662 | ] 1663 | 1664 | [[package]] 1665 | name = "schannel" 1666 | version = "0.1.21" 1667 | source = "registry+https://github.com/rust-lang/crates.io-index" 1668 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" 1669 | dependencies = [ 1670 | "windows-sys 0.42.0", 1671 | ] 1672 | 1673 | [[package]] 1674 | name = "schemars" 1675 | version = "0.8.12" 1676 | source = "registry+https://github.com/rust-lang/crates.io-index" 1677 | checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" 1678 | dependencies = [ 1679 | "chrono", 1680 | "dyn-clone", 1681 | "schemars_derive", 1682 | "serde", 1683 | "serde_json", 1684 | "uuid", 1685 | ] 1686 | 1687 | [[package]] 1688 | name = "schemars_derive" 1689 | version = "0.8.12" 1690 | source = "registry+https://github.com/rust-lang/crates.io-index" 1691 | checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" 1692 | dependencies = [ 1693 | "proc-macro2", 1694 | "quote", 1695 | "serde_derive_internals", 1696 | "syn 1.0.109", 1697 | ] 1698 | 1699 | [[package]] 1700 | name = "scopeguard" 1701 | version = "1.1.0" 1702 | source = "registry+https://github.com/rust-lang/crates.io-index" 1703 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1704 | 1705 | [[package]] 1706 | name = "security-framework" 1707 | version = "2.9.0" 1708 | source = "registry+https://github.com/rust-lang/crates.io-index" 1709 | checksum = "ca2855b3715770894e67cbfa3df957790aa0c9edc3bf06efa1a84d77fa0839d1" 1710 | dependencies = [ 1711 | "bitflags", 1712 | "core-foundation", 1713 | "core-foundation-sys", 1714 | "libc", 1715 | "security-framework-sys", 1716 | ] 1717 | 1718 | [[package]] 1719 | name = "security-framework-sys" 1720 | version = "2.9.0" 1721 | source = "registry+https://github.com/rust-lang/crates.io-index" 1722 | checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" 1723 | dependencies = [ 1724 | "core-foundation-sys", 1725 | "libc", 1726 | ] 1727 | 1728 | [[package]] 1729 | name = "semver" 1730 | version = "0.11.0" 1731 | source = "registry+https://github.com/rust-lang/crates.io-index" 1732 | checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" 1733 | dependencies = [ 1734 | "semver-parser", 1735 | ] 1736 | 1737 | [[package]] 1738 | name = "semver" 1739 | version = "1.0.17" 1740 | source = "registry+https://github.com/rust-lang/crates.io-index" 1741 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1742 | 1743 | [[package]] 1744 | name = "semver-parser" 1745 | version = "0.10.2" 1746 | source = "registry+https://github.com/rust-lang/crates.io-index" 1747 | checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" 1748 | dependencies = [ 1749 | "pest", 1750 | ] 1751 | 1752 | [[package]] 1753 | name = "serde" 1754 | version = "1.0.163" 1755 | source = "registry+https://github.com/rust-lang/crates.io-index" 1756 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" 1757 | dependencies = [ 1758 | "serde_derive", 1759 | ] 1760 | 1761 | [[package]] 1762 | name = "serde_derive" 1763 | version = "1.0.163" 1764 | source = "registry+https://github.com/rust-lang/crates.io-index" 1765 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" 1766 | dependencies = [ 1767 | "proc-macro2", 1768 | "quote", 1769 | "syn 2.0.16", 1770 | ] 1771 | 1772 | [[package]] 1773 | name = "serde_derive_internals" 1774 | version = "0.26.0" 1775 | source = "registry+https://github.com/rust-lang/crates.io-index" 1776 | checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" 1777 | dependencies = [ 1778 | "proc-macro2", 1779 | "quote", 1780 | "syn 1.0.109", 1781 | ] 1782 | 1783 | [[package]] 1784 | name = "serde_json" 1785 | version = "1.0.96" 1786 | source = "registry+https://github.com/rust-lang/crates.io-index" 1787 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 1788 | dependencies = [ 1789 | "itoa", 1790 | "ryu", 1791 | "serde", 1792 | ] 1793 | 1794 | [[package]] 1795 | name = "serde_tokenstream" 1796 | version = "0.1.7" 1797 | source = "registry+https://github.com/rust-lang/crates.io-index" 1798 | checksum = "797ba1d80299b264f3aac68ab5d12e5825a561749db4df7cd7c8083900c5d4e9" 1799 | dependencies = [ 1800 | "proc-macro2", 1801 | "serde", 1802 | "syn 1.0.109", 1803 | ] 1804 | 1805 | [[package]] 1806 | name = "serde_urlencoded" 1807 | version = "0.7.1" 1808 | source = "registry+https://github.com/rust-lang/crates.io-index" 1809 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1810 | dependencies = [ 1811 | "form_urlencoded", 1812 | "itoa", 1813 | "ryu", 1814 | "serde", 1815 | ] 1816 | 1817 | [[package]] 1818 | name = "serde_yaml" 1819 | version = "0.8.26" 1820 | source = "registry+https://github.com/rust-lang/crates.io-index" 1821 | checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" 1822 | dependencies = [ 1823 | "indexmap", 1824 | "ryu", 1825 | "serde", 1826 | "yaml-rust", 1827 | ] 1828 | 1829 | [[package]] 1830 | name = "serial" 1831 | version = "0.4.0" 1832 | source = "registry+https://github.com/rust-lang/crates.io-index" 1833 | checksum = "a1237a96570fc377c13baa1b88c7589ab66edced652e43ffb17088f003db3e86" 1834 | dependencies = [ 1835 | "serial-core", 1836 | "serial-unix", 1837 | "serial-windows", 1838 | ] 1839 | 1840 | [[package]] 1841 | name = "serial-core" 1842 | version = "0.4.0" 1843 | source = "registry+https://github.com/rust-lang/crates.io-index" 1844 | checksum = "3f46209b345401737ae2125fe5b19a77acce90cd53e1658cda928e4fe9a64581" 1845 | dependencies = [ 1846 | "libc", 1847 | ] 1848 | 1849 | [[package]] 1850 | name = "serial-unix" 1851 | version = "0.4.0" 1852 | source = "registry+https://github.com/rust-lang/crates.io-index" 1853 | checksum = "f03fbca4c9d866e24a459cbca71283f545a37f8e3e002ad8c70593871453cab7" 1854 | dependencies = [ 1855 | "ioctl-rs", 1856 | "libc", 1857 | "serial-core", 1858 | "termios", 1859 | ] 1860 | 1861 | [[package]] 1862 | name = "serial-windows" 1863 | version = "0.4.0" 1864 | source = "registry+https://github.com/rust-lang/crates.io-index" 1865 | checksum = "15c6d3b776267a75d31bbdfd5d36c0ca051251caafc285827052bc53bcdc8162" 1866 | dependencies = [ 1867 | "libc", 1868 | "serial-core", 1869 | ] 1870 | 1871 | [[package]] 1872 | name = "shared_library" 1873 | version = "0.1.9" 1874 | source = "registry+https://github.com/rust-lang/crates.io-index" 1875 | checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" 1876 | dependencies = [ 1877 | "lazy_static", 1878 | "libc", 1879 | ] 1880 | 1881 | [[package]] 1882 | name = "shell-words" 1883 | version = "1.1.0" 1884 | source = "registry+https://github.com/rust-lang/crates.io-index" 1885 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 1886 | 1887 | [[package]] 1888 | name = "signal" 1889 | version = "0.7.0" 1890 | source = "registry+https://github.com/rust-lang/crates.io-index" 1891 | checksum = "2f6ce83b159ab6984d2419f495134972b48754d13ff2e3f8c998339942b56ed9" 1892 | dependencies = [ 1893 | "libc", 1894 | "nix 0.14.1", 1895 | ] 1896 | 1897 | [[package]] 1898 | name = "signal-hook" 1899 | version = "0.3.15" 1900 | source = "registry+https://github.com/rust-lang/crates.io-index" 1901 | checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" 1902 | dependencies = [ 1903 | "libc", 1904 | "signal-hook-registry", 1905 | ] 1906 | 1907 | [[package]] 1908 | name = "signal-hook-mio" 1909 | version = "0.2.3" 1910 | source = "registry+https://github.com/rust-lang/crates.io-index" 1911 | checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" 1912 | dependencies = [ 1913 | "libc", 1914 | "mio", 1915 | "signal-hook", 1916 | ] 1917 | 1918 | [[package]] 1919 | name = "signal-hook-registry" 1920 | version = "1.4.1" 1921 | source = "registry+https://github.com/rust-lang/crates.io-index" 1922 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 1923 | dependencies = [ 1924 | "libc", 1925 | ] 1926 | 1927 | [[package]] 1928 | name = "slab" 1929 | version = "0.4.8" 1930 | source = "registry+https://github.com/rust-lang/crates.io-index" 1931 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 1932 | dependencies = [ 1933 | "autocfg", 1934 | ] 1935 | 1936 | [[package]] 1937 | name = "smallvec" 1938 | version = "1.10.0" 1939 | source = "registry+https://github.com/rust-lang/crates.io-index" 1940 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1941 | 1942 | [[package]] 1943 | name = "socket2" 1944 | version = "0.4.9" 1945 | source = "registry+https://github.com/rust-lang/crates.io-index" 1946 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 1947 | dependencies = [ 1948 | "libc", 1949 | "winapi", 1950 | ] 1951 | 1952 | [[package]] 1953 | name = "std_prelude" 1954 | version = "0.2.12" 1955 | source = "registry+https://github.com/rust-lang/crates.io-index" 1956 | checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe" 1957 | 1958 | [[package]] 1959 | name = "strsim" 1960 | version = "0.10.0" 1961 | source = "registry+https://github.com/rust-lang/crates.io-index" 1962 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1963 | 1964 | [[package]] 1965 | name = "syn" 1966 | version = "1.0.109" 1967 | source = "registry+https://github.com/rust-lang/crates.io-index" 1968 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1969 | dependencies = [ 1970 | "proc-macro2", 1971 | "quote", 1972 | "unicode-ident", 1973 | ] 1974 | 1975 | [[package]] 1976 | name = "syn" 1977 | version = "2.0.16" 1978 | source = "registry+https://github.com/rust-lang/crates.io-index" 1979 | checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" 1980 | dependencies = [ 1981 | "proc-macro2", 1982 | "quote", 1983 | "unicode-ident", 1984 | ] 1985 | 1986 | [[package]] 1987 | name = "syntect" 1988 | version = "5.0.0" 1989 | source = "registry+https://github.com/rust-lang/crates.io-index" 1990 | checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" 1991 | dependencies = [ 1992 | "bincode", 1993 | "bitflags", 1994 | "flate2", 1995 | "fnv", 1996 | "lazy_static", 1997 | "once_cell", 1998 | "onig", 1999 | "regex-syntax 0.6.29", 2000 | "serde", 2001 | "serde_derive", 2002 | "serde_json", 2003 | "thiserror", 2004 | "walkdir", 2005 | ] 2006 | 2007 | [[package]] 2008 | name = "sys_metrics" 2009 | version = "0.2.6" 2010 | source = "registry+https://github.com/rust-lang/crates.io-index" 2011 | checksum = "01b907378c2dafb7cb7aa5caad1ea18a1d0a337af4f8fc28d43f4d1e807b1ff7" 2012 | dependencies = [ 2013 | "core-foundation-sys", 2014 | "glob", 2015 | "io-kit-sys", 2016 | "lazy_static", 2017 | "libc", 2018 | "mach", 2019 | "serde", 2020 | ] 2021 | 2022 | [[package]] 2023 | name = "tempfile" 2024 | version = "3.5.0" 2025 | source = "registry+https://github.com/rust-lang/crates.io-index" 2026 | checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" 2027 | dependencies = [ 2028 | "cfg-if 1.0.0", 2029 | "fastrand", 2030 | "redox_syscall 0.3.5", 2031 | "rustix", 2032 | "windows-sys 0.45.0", 2033 | ] 2034 | 2035 | [[package]] 2036 | name = "termcolor" 2037 | version = "1.2.0" 2038 | source = "registry+https://github.com/rust-lang/crates.io-index" 2039 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 2040 | dependencies = [ 2041 | "winapi-util", 2042 | ] 2043 | 2044 | [[package]] 2045 | name = "terminal_size" 2046 | version = "0.2.6" 2047 | source = "registry+https://github.com/rust-lang/crates.io-index" 2048 | checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" 2049 | dependencies = [ 2050 | "rustix", 2051 | "windows-sys 0.48.0", 2052 | ] 2053 | 2054 | [[package]] 2055 | name = "termios" 2056 | version = "0.2.2" 2057 | source = "registry+https://github.com/rust-lang/crates.io-index" 2058 | checksum = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a" 2059 | dependencies = [ 2060 | "libc", 2061 | ] 2062 | 2063 | [[package]] 2064 | name = "thiserror" 2065 | version = "1.0.40" 2066 | source = "registry+https://github.com/rust-lang/crates.io-index" 2067 | checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" 2068 | dependencies = [ 2069 | "thiserror-impl", 2070 | ] 2071 | 2072 | [[package]] 2073 | name = "thiserror-impl" 2074 | version = "1.0.40" 2075 | source = "registry+https://github.com/rust-lang/crates.io-index" 2076 | checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" 2077 | dependencies = [ 2078 | "proc-macro2", 2079 | "quote", 2080 | "syn 2.0.16", 2081 | ] 2082 | 2083 | [[package]] 2084 | name = "time" 2085 | version = "0.1.45" 2086 | source = "registry+https://github.com/rust-lang/crates.io-index" 2087 | checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" 2088 | dependencies = [ 2089 | "libc", 2090 | "wasi 0.10.0+wasi-snapshot-preview1", 2091 | "winapi", 2092 | ] 2093 | 2094 | [[package]] 2095 | name = "time" 2096 | version = "0.3.21" 2097 | source = "registry+https://github.com/rust-lang/crates.io-index" 2098 | checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" 2099 | dependencies = [ 2100 | "itoa", 2101 | "serde", 2102 | "time-core", 2103 | "time-macros", 2104 | ] 2105 | 2106 | [[package]] 2107 | name = "time-core" 2108 | version = "0.1.1" 2109 | source = "registry+https://github.com/rust-lang/crates.io-index" 2110 | checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" 2111 | 2112 | [[package]] 2113 | name = "time-macros" 2114 | version = "0.2.9" 2115 | source = "registry+https://github.com/rust-lang/crates.io-index" 2116 | checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" 2117 | dependencies = [ 2118 | "time-core", 2119 | ] 2120 | 2121 | [[package]] 2122 | name = "tinyvec" 2123 | version = "1.6.0" 2124 | source = "registry+https://github.com/rust-lang/crates.io-index" 2125 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 2126 | dependencies = [ 2127 | "tinyvec_macros", 2128 | ] 2129 | 2130 | [[package]] 2131 | name = "tinyvec_macros" 2132 | version = "0.1.1" 2133 | source = "registry+https://github.com/rust-lang/crates.io-index" 2134 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 2135 | 2136 | [[package]] 2137 | name = "tokio" 2138 | version = "1.28.1" 2139 | source = "registry+https://github.com/rust-lang/crates.io-index" 2140 | checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" 2141 | dependencies = [ 2142 | "autocfg", 2143 | "bytes", 2144 | "libc", 2145 | "mio", 2146 | "num_cpus", 2147 | "parking_lot", 2148 | "pin-project-lite", 2149 | "signal-hook-registry", 2150 | "socket2", 2151 | "tokio-macros", 2152 | "windows-sys 0.48.0", 2153 | ] 2154 | 2155 | [[package]] 2156 | name = "tokio-macros" 2157 | version = "2.1.0" 2158 | source = "registry+https://github.com/rust-lang/crates.io-index" 2159 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 2160 | dependencies = [ 2161 | "proc-macro2", 2162 | "quote", 2163 | "syn 2.0.16", 2164 | ] 2165 | 2166 | [[package]] 2167 | name = "tokio-native-tls" 2168 | version = "0.3.1" 2169 | source = "registry+https://github.com/rust-lang/crates.io-index" 2170 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 2171 | dependencies = [ 2172 | "native-tls", 2173 | "tokio", 2174 | ] 2175 | 2176 | [[package]] 2177 | name = "tokio-util" 2178 | version = "0.7.8" 2179 | source = "registry+https://github.com/rust-lang/crates.io-index" 2180 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" 2181 | dependencies = [ 2182 | "bytes", 2183 | "futures-core", 2184 | "futures-sink", 2185 | "pin-project-lite", 2186 | "tokio", 2187 | "tracing", 2188 | ] 2189 | 2190 | [[package]] 2191 | name = "toolchain_find" 2192 | version = "0.2.0" 2193 | source = "registry+https://github.com/rust-lang/crates.io-index" 2194 | checksum = "5e85654a10e7a07a47c6f19d93818f3f343e22927f2fa280c84f7c8042743413" 2195 | dependencies = [ 2196 | "home", 2197 | "lazy_static", 2198 | "regex", 2199 | "semver 0.11.0", 2200 | "walkdir", 2201 | ] 2202 | 2203 | [[package]] 2204 | name = "tower-service" 2205 | version = "0.3.2" 2206 | source = "registry+https://github.com/rust-lang/crates.io-index" 2207 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 2208 | 2209 | [[package]] 2210 | name = "tracing" 2211 | version = "0.1.37" 2212 | source = "registry+https://github.com/rust-lang/crates.io-index" 2213 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 2214 | dependencies = [ 2215 | "cfg-if 1.0.0", 2216 | "pin-project-lite", 2217 | "tracing-core", 2218 | ] 2219 | 2220 | [[package]] 2221 | name = "tracing-core" 2222 | version = "0.1.31" 2223 | source = "registry+https://github.com/rust-lang/crates.io-index" 2224 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" 2225 | dependencies = [ 2226 | "once_cell", 2227 | ] 2228 | 2229 | [[package]] 2230 | name = "try-lock" 2231 | version = "0.2.4" 2232 | source = "registry+https://github.com/rust-lang/crates.io-index" 2233 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 2234 | 2235 | [[package]] 2236 | name = "tui" 2237 | version = "0.19.0" 2238 | source = "registry+https://github.com/rust-lang/crates.io-index" 2239 | checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" 2240 | dependencies = [ 2241 | "bitflags", 2242 | "cassowary", 2243 | "crossterm 0.25.0", 2244 | "unicode-segmentation", 2245 | "unicode-width", 2246 | ] 2247 | 2248 | [[package]] 2249 | name = "typify" 2250 | version = "0.0.6" 2251 | source = "registry+https://github.com/rust-lang/crates.io-index" 2252 | checksum = "75e642ba5bfa5a7b2e085a700f5f5111b069a833156f82c53a365210e545258d" 2253 | dependencies = [ 2254 | "typify-impl", 2255 | "typify-macro", 2256 | ] 2257 | 2258 | [[package]] 2259 | name = "typify-impl" 2260 | version = "0.0.6" 2261 | source = "registry+https://github.com/rust-lang/crates.io-index" 2262 | checksum = "54b1b5a377f1e0dceb8a18b25c86c80b32d0882b01e1585fd520354a56b7c30c" 2263 | dependencies = [ 2264 | "heck", 2265 | "log", 2266 | "proc-macro2", 2267 | "quote", 2268 | "rustfmt-wrapper", 2269 | "schemars", 2270 | "serde_json", 2271 | "syn 1.0.109", 2272 | "thiserror", 2273 | "unicode-xid", 2274 | ] 2275 | 2276 | [[package]] 2277 | name = "typify-macro" 2278 | version = "0.0.6" 2279 | source = "registry+https://github.com/rust-lang/crates.io-index" 2280 | checksum = "25cad3517ce4190a7f108cd6360da245c7e289060003d077156f2da7dcf1f568" 2281 | dependencies = [ 2282 | "proc-macro2", 2283 | "quote", 2284 | "schemars", 2285 | "serde", 2286 | "serde_json", 2287 | "serde_tokenstream", 2288 | "syn 1.0.109", 2289 | "typify-impl", 2290 | ] 2291 | 2292 | [[package]] 2293 | name = "ucd-trie" 2294 | version = "0.1.5" 2295 | source = "registry+https://github.com/rust-lang/crates.io-index" 2296 | checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" 2297 | 2298 | [[package]] 2299 | name = "unicode-bidi" 2300 | version = "0.3.13" 2301 | source = "registry+https://github.com/rust-lang/crates.io-index" 2302 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 2303 | 2304 | [[package]] 2305 | name = "unicode-ident" 2306 | version = "1.0.8" 2307 | source = "registry+https://github.com/rust-lang/crates.io-index" 2308 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 2309 | 2310 | [[package]] 2311 | name = "unicode-normalization" 2312 | version = "0.1.22" 2313 | source = "registry+https://github.com/rust-lang/crates.io-index" 2314 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 2315 | dependencies = [ 2316 | "tinyvec", 2317 | ] 2318 | 2319 | [[package]] 2320 | name = "unicode-segmentation" 2321 | version = "1.10.1" 2322 | source = "registry+https://github.com/rust-lang/crates.io-index" 2323 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 2324 | 2325 | [[package]] 2326 | name = "unicode-width" 2327 | version = "0.1.10" 2328 | source = "registry+https://github.com/rust-lang/crates.io-index" 2329 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 2330 | 2331 | [[package]] 2332 | name = "unicode-xid" 2333 | version = "0.2.4" 2334 | source = "registry+https://github.com/rust-lang/crates.io-index" 2335 | checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" 2336 | 2337 | [[package]] 2338 | name = "url" 2339 | version = "2.3.1" 2340 | source = "registry+https://github.com/rust-lang/crates.io-index" 2341 | checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" 2342 | dependencies = [ 2343 | "form_urlencoded", 2344 | "idna", 2345 | "percent-encoding", 2346 | ] 2347 | 2348 | [[package]] 2349 | name = "utf8-width" 2350 | version = "0.1.6" 2351 | source = "registry+https://github.com/rust-lang/crates.io-index" 2352 | checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" 2353 | 2354 | [[package]] 2355 | name = "utf8parse" 2356 | version = "0.2.1" 2357 | source = "registry+https://github.com/rust-lang/crates.io-index" 2358 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 2359 | 2360 | [[package]] 2361 | name = "uuid" 2362 | version = "0.8.2" 2363 | source = "registry+https://github.com/rust-lang/crates.io-index" 2364 | checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" 2365 | dependencies = [ 2366 | "getrandom", 2367 | "serde", 2368 | ] 2369 | 2370 | [[package]] 2371 | name = "vcpkg" 2372 | version = "0.2.15" 2373 | source = "registry+https://github.com/rust-lang/crates.io-index" 2374 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2375 | 2376 | [[package]] 2377 | name = "void" 2378 | version = "1.0.2" 2379 | source = "registry+https://github.com/rust-lang/crates.io-index" 2380 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 2381 | 2382 | [[package]] 2383 | name = "walkdir" 2384 | version = "2.3.3" 2385 | source = "registry+https://github.com/rust-lang/crates.io-index" 2386 | checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" 2387 | dependencies = [ 2388 | "same-file", 2389 | "winapi-util", 2390 | ] 2391 | 2392 | [[package]] 2393 | name = "want" 2394 | version = "0.3.0" 2395 | source = "registry+https://github.com/rust-lang/crates.io-index" 2396 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 2397 | dependencies = [ 2398 | "log", 2399 | "try-lock", 2400 | ] 2401 | 2402 | [[package]] 2403 | name = "wasi" 2404 | version = "0.10.0+wasi-snapshot-preview1" 2405 | source = "registry+https://github.com/rust-lang/crates.io-index" 2406 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 2407 | 2408 | [[package]] 2409 | name = "wasi" 2410 | version = "0.11.0+wasi-snapshot-preview1" 2411 | source = "registry+https://github.com/rust-lang/crates.io-index" 2412 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2413 | 2414 | [[package]] 2415 | name = "wasm-bindgen" 2416 | version = "0.2.86" 2417 | source = "registry+https://github.com/rust-lang/crates.io-index" 2418 | checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" 2419 | dependencies = [ 2420 | "cfg-if 1.0.0", 2421 | "wasm-bindgen-macro", 2422 | ] 2423 | 2424 | [[package]] 2425 | name = "wasm-bindgen-backend" 2426 | version = "0.2.86" 2427 | source = "registry+https://github.com/rust-lang/crates.io-index" 2428 | checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" 2429 | dependencies = [ 2430 | "bumpalo", 2431 | "log", 2432 | "once_cell", 2433 | "proc-macro2", 2434 | "quote", 2435 | "syn 2.0.16", 2436 | "wasm-bindgen-shared", 2437 | ] 2438 | 2439 | [[package]] 2440 | name = "wasm-bindgen-futures" 2441 | version = "0.4.36" 2442 | source = "registry+https://github.com/rust-lang/crates.io-index" 2443 | checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" 2444 | dependencies = [ 2445 | "cfg-if 1.0.0", 2446 | "js-sys", 2447 | "wasm-bindgen", 2448 | "web-sys", 2449 | ] 2450 | 2451 | [[package]] 2452 | name = "wasm-bindgen-macro" 2453 | version = "0.2.86" 2454 | source = "registry+https://github.com/rust-lang/crates.io-index" 2455 | checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" 2456 | dependencies = [ 2457 | "quote", 2458 | "wasm-bindgen-macro-support", 2459 | ] 2460 | 2461 | [[package]] 2462 | name = "wasm-bindgen-macro-support" 2463 | version = "0.2.86" 2464 | source = "registry+https://github.com/rust-lang/crates.io-index" 2465 | checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" 2466 | dependencies = [ 2467 | "proc-macro2", 2468 | "quote", 2469 | "syn 2.0.16", 2470 | "wasm-bindgen-backend", 2471 | "wasm-bindgen-shared", 2472 | ] 2473 | 2474 | [[package]] 2475 | name = "wasm-bindgen-shared" 2476 | version = "0.2.86" 2477 | source = "registry+https://github.com/rust-lang/crates.io-index" 2478 | checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" 2479 | 2480 | [[package]] 2481 | name = "wasm-streams" 2482 | version = "0.2.3" 2483 | source = "registry+https://github.com/rust-lang/crates.io-index" 2484 | checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" 2485 | dependencies = [ 2486 | "futures-util", 2487 | "js-sys", 2488 | "wasm-bindgen", 2489 | "wasm-bindgen-futures", 2490 | "web-sys", 2491 | ] 2492 | 2493 | [[package]] 2494 | name = "web-sys" 2495 | version = "0.3.63" 2496 | source = "registry+https://github.com/rust-lang/crates.io-index" 2497 | checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" 2498 | dependencies = [ 2499 | "js-sys", 2500 | "wasm-bindgen", 2501 | ] 2502 | 2503 | [[package]] 2504 | name = "wild" 2505 | version = "2.1.0" 2506 | source = "registry+https://github.com/rust-lang/crates.io-index" 2507 | checksum = "05b116685a6be0c52f5a103334cbff26db643826c7b3735fc0a3ba9871310a74" 2508 | dependencies = [ 2509 | "glob", 2510 | ] 2511 | 2512 | [[package]] 2513 | name = "winapi" 2514 | version = "0.3.9" 2515 | source = "registry+https://github.com/rust-lang/crates.io-index" 2516 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2517 | dependencies = [ 2518 | "winapi-i686-pc-windows-gnu", 2519 | "winapi-x86_64-pc-windows-gnu", 2520 | ] 2521 | 2522 | [[package]] 2523 | name = "winapi-i686-pc-windows-gnu" 2524 | version = "0.4.0" 2525 | source = "registry+https://github.com/rust-lang/crates.io-index" 2526 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2527 | 2528 | [[package]] 2529 | name = "winapi-util" 2530 | version = "0.1.5" 2531 | source = "registry+https://github.com/rust-lang/crates.io-index" 2532 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2533 | dependencies = [ 2534 | "winapi", 2535 | ] 2536 | 2537 | [[package]] 2538 | name = "winapi-x86_64-pc-windows-gnu" 2539 | version = "0.4.0" 2540 | source = "registry+https://github.com/rust-lang/crates.io-index" 2541 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2542 | 2543 | [[package]] 2544 | name = "windows" 2545 | version = "0.48.0" 2546 | source = "registry+https://github.com/rust-lang/crates.io-index" 2547 | checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" 2548 | dependencies = [ 2549 | "windows-targets 0.48.0", 2550 | ] 2551 | 2552 | [[package]] 2553 | name = "windows-sys" 2554 | version = "0.42.0" 2555 | source = "registry+https://github.com/rust-lang/crates.io-index" 2556 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 2557 | dependencies = [ 2558 | "windows_aarch64_gnullvm 0.42.2", 2559 | "windows_aarch64_msvc 0.42.2", 2560 | "windows_i686_gnu 0.42.2", 2561 | "windows_i686_msvc 0.42.2", 2562 | "windows_x86_64_gnu 0.42.2", 2563 | "windows_x86_64_gnullvm 0.42.2", 2564 | "windows_x86_64_msvc 0.42.2", 2565 | ] 2566 | 2567 | [[package]] 2568 | name = "windows-sys" 2569 | version = "0.45.0" 2570 | source = "registry+https://github.com/rust-lang/crates.io-index" 2571 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 2572 | dependencies = [ 2573 | "windows-targets 0.42.2", 2574 | ] 2575 | 2576 | [[package]] 2577 | name = "windows-sys" 2578 | version = "0.48.0" 2579 | source = "registry+https://github.com/rust-lang/crates.io-index" 2580 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 2581 | dependencies = [ 2582 | "windows-targets 0.48.0", 2583 | ] 2584 | 2585 | [[package]] 2586 | name = "windows-targets" 2587 | version = "0.42.2" 2588 | source = "registry+https://github.com/rust-lang/crates.io-index" 2589 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 2590 | dependencies = [ 2591 | "windows_aarch64_gnullvm 0.42.2", 2592 | "windows_aarch64_msvc 0.42.2", 2593 | "windows_i686_gnu 0.42.2", 2594 | "windows_i686_msvc 0.42.2", 2595 | "windows_x86_64_gnu 0.42.2", 2596 | "windows_x86_64_gnullvm 0.42.2", 2597 | "windows_x86_64_msvc 0.42.2", 2598 | ] 2599 | 2600 | [[package]] 2601 | name = "windows-targets" 2602 | version = "0.48.0" 2603 | source = "registry+https://github.com/rust-lang/crates.io-index" 2604 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 2605 | dependencies = [ 2606 | "windows_aarch64_gnullvm 0.48.0", 2607 | "windows_aarch64_msvc 0.48.0", 2608 | "windows_i686_gnu 0.48.0", 2609 | "windows_i686_msvc 0.48.0", 2610 | "windows_x86_64_gnu 0.48.0", 2611 | "windows_x86_64_gnullvm 0.48.0", 2612 | "windows_x86_64_msvc 0.48.0", 2613 | ] 2614 | 2615 | [[package]] 2616 | name = "windows_aarch64_gnullvm" 2617 | version = "0.42.2" 2618 | source = "registry+https://github.com/rust-lang/crates.io-index" 2619 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 2620 | 2621 | [[package]] 2622 | name = "windows_aarch64_gnullvm" 2623 | version = "0.48.0" 2624 | source = "registry+https://github.com/rust-lang/crates.io-index" 2625 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 2626 | 2627 | [[package]] 2628 | name = "windows_aarch64_msvc" 2629 | version = "0.42.2" 2630 | source = "registry+https://github.com/rust-lang/crates.io-index" 2631 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 2632 | 2633 | [[package]] 2634 | name = "windows_aarch64_msvc" 2635 | version = "0.48.0" 2636 | source = "registry+https://github.com/rust-lang/crates.io-index" 2637 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 2638 | 2639 | [[package]] 2640 | name = "windows_i686_gnu" 2641 | version = "0.42.2" 2642 | source = "registry+https://github.com/rust-lang/crates.io-index" 2643 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 2644 | 2645 | [[package]] 2646 | name = "windows_i686_gnu" 2647 | version = "0.48.0" 2648 | source = "registry+https://github.com/rust-lang/crates.io-index" 2649 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 2650 | 2651 | [[package]] 2652 | name = "windows_i686_msvc" 2653 | version = "0.42.2" 2654 | source = "registry+https://github.com/rust-lang/crates.io-index" 2655 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 2656 | 2657 | [[package]] 2658 | name = "windows_i686_msvc" 2659 | version = "0.48.0" 2660 | source = "registry+https://github.com/rust-lang/crates.io-index" 2661 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 2662 | 2663 | [[package]] 2664 | name = "windows_x86_64_gnu" 2665 | version = "0.42.2" 2666 | source = "registry+https://github.com/rust-lang/crates.io-index" 2667 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 2668 | 2669 | [[package]] 2670 | name = "windows_x86_64_gnu" 2671 | version = "0.48.0" 2672 | source = "registry+https://github.com/rust-lang/crates.io-index" 2673 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 2674 | 2675 | [[package]] 2676 | name = "windows_x86_64_gnullvm" 2677 | version = "0.42.2" 2678 | source = "registry+https://github.com/rust-lang/crates.io-index" 2679 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 2680 | 2681 | [[package]] 2682 | name = "windows_x86_64_gnullvm" 2683 | version = "0.48.0" 2684 | source = "registry+https://github.com/rust-lang/crates.io-index" 2685 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 2686 | 2687 | [[package]] 2688 | name = "windows_x86_64_msvc" 2689 | version = "0.42.2" 2690 | source = "registry+https://github.com/rust-lang/crates.io-index" 2691 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 2692 | 2693 | [[package]] 2694 | name = "windows_x86_64_msvc" 2695 | version = "0.48.0" 2696 | source = "registry+https://github.com/rust-lang/crates.io-index" 2697 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 2698 | 2699 | [[package]] 2700 | name = "winreg" 2701 | version = "0.10.1" 2702 | source = "registry+https://github.com/rust-lang/crates.io-index" 2703 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 2704 | dependencies = [ 2705 | "winapi", 2706 | ] 2707 | 2708 | [[package]] 2709 | name = "yaml-rust" 2710 | version = "0.4.5" 2711 | source = "registry+https://github.com/rust-lang/crates.io-index" 2712 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 2713 | dependencies = [ 2714 | "linked-hash-map", 2715 | ] 2716 | 2717 | [[package]] 2718 | name = "zerotier-central-api" 2719 | version = "1.2.1" 2720 | source = "registry+https://github.com/rust-lang/crates.io-index" 2721 | checksum = "bbcbbc3ebfe848d2305d8f4bec2ae68d81bcdde1d9ff2f14e7957e8608a9a0c7" 2722 | dependencies = [ 2723 | "anyhow", 2724 | "chrono", 2725 | "futures", 2726 | "progenitor", 2727 | "progenitor-client 0.3.0", 2728 | "reqwest", 2729 | "serde", 2730 | "serde_json", 2731 | "uuid", 2732 | ] 2733 | 2734 | [[package]] 2735 | name = "zerotier-one-api" 2736 | version = "1.2.1" 2737 | source = "registry+https://github.com/rust-lang/crates.io-index" 2738 | checksum = "df22f59fd0537dc76b31474d1b2af45f0a8fafa1b7edaa0f2127c2688bfb1795" 2739 | dependencies = [ 2740 | "anyhow", 2741 | "chrono", 2742 | "futures", 2743 | "progenitor", 2744 | "progenitor-client 0.3.0", 2745 | "reqwest", 2746 | "serde", 2747 | "serde_json", 2748 | "uuid", 2749 | ] 2750 | 2751 | [[package]] 2752 | name = "ztui" 2753 | version = "0.1.6" 2754 | dependencies = [ 2755 | "anyhow", 2756 | "bat", 2757 | "byte-unit", 2758 | "crossterm 0.26.1", 2759 | "directories", 2760 | "fancy-duration", 2761 | "http", 2762 | "lazy_static", 2763 | "nix 0.24.3", 2764 | "openssl", 2765 | "portable-pty", 2766 | "reqwest", 2767 | "serde", 2768 | "serde_json", 2769 | "signal", 2770 | "sys_metrics", 2771 | "tempfile", 2772 | "time 0.3.21", 2773 | "tokio", 2774 | "tui", 2775 | "zerotier-central-api", 2776 | "zerotier-one-api", 2777 | ] 2778 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ztui" 3 | version = "0.1.7" 4 | edition = "2021" 5 | readme = "README.md" 6 | description = "ztui is a terminal UI for zerotier" 7 | authors = ["Erik Hollensbe "] 8 | license = "AGPL-3.0-or-later" 9 | homepage = "https://github.com/erikh/ztui" 10 | repository = "https://github.com/erikh/ztui" 11 | 12 | [dependencies] 13 | sys_metrics = "^0.2.0" 14 | tokio = { version = "^1.28.0", features = [ "full" ] } 15 | crossterm = "^0.26.0" 16 | tui = "^0.19.0" 17 | anyhow = "^1.0.0" 18 | zerotier-one-api = "1.2.1" 19 | zerotier-central-api = "1.2.1" 20 | http = "^0.2.0" 21 | reqwest = "^0.11.0" 22 | serde_json = "^1.0" 23 | serde = "^1.0" 24 | directories = "^5.0.0" 25 | bat = { version = "^0.23.0", default-features = false, features = [ "minimal-application" ] } 26 | byte-unit = "^4.0.0" 27 | portable-pty = "^0.8.0" 28 | fancy-duration = "^0.2.0" 29 | time = "^0.3.0" 30 | lazy_static = "^1.4.0" 31 | nix = "0.24" 32 | signal = "^0.7.0" 33 | openssl = { version = "^0.10.0", features = [ "vendored" ] } 34 | tempfile = "^3.5.0" 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ztui: your one-stop shop for ZeroTier terminal UI goodness 2 | 3 | ztui aims to be a frontend for all interactions with ZeroTier in an attempt to 4 | transform how people work with it. It provides the following features: 5 | 6 | - Main Screen: 7 | - Bookmarks for Networks (disconnecting does not make the network id disappear from the list, and you can rejoin easily) 8 | - Interaction directly with Central members from the network list. 9 | - Joining, Leaving Networks 10 | - Per-Network bandwidth statistics 11 | - Bind arbitrary commands to keys that use a template to launch (see more on this below) 12 | - Review the network JSON formatted pretty 13 | - Launch `$EDITOR` against a file of network rules (and save them back to central) 14 | - Central / Member List: 15 | - Rename members 16 | - Auth, Unauth, and Delete members 17 | 18 | Networks List View: 19 | 20 |
21 | 22 | Members List / Network View: 23 | 24 |
25 | 26 | ## Installing 27 | 28 | Get [Rust](https://www.rustup.rs) 1.60 or better if you need to. You'll need it. 29 | 30 | ``` 31 | cargo install ztui 32 | ``` 33 | 34 | You may also appreciate our [GitHub Releases](https://github.com/erikh/ztui/releases)! 35 | 36 | ## Configuring arbitrary commands 37 | 38 | ### Rules 39 | 40 | - Command must not be mapped by existing commands 41 | - Will be executed in a shell; quote accordingly 42 | 43 | ### Configuration Syntax 44 | 45 | After you start `ztui` for the first time, `$HOME/.config.zerotier/settings.json` will be created for you with your last-saved network information. Now, what we want to do is create `$HOME/.config.zerotier/config.json` and add something like this: 46 | 47 | ```json 48 | { 49 | "network_commands": { 50 | "1": "/bin/tcpdump -i %i" 51 | }, 52 | "member_commands": { 53 | "1": "/bin/iperf -c %a" 54 | } 55 | } 56 | ``` 57 | 58 | Network format strings available: 59 | 60 | - `%i`: the interface of the ZeroTier network 61 | - `%n`: the network ID of the ZeroTier network 62 | - `%a`: the first addresses in the list of assigned IP addresses 63 | 64 | In this case, it would allow me to press `1` over a network to `tcpdump` its interface; then I would control+C out of it to come back to `ztui`. 65 | 66 | Member format strings available: 67 | 68 | - `%n`: the network ID of the ZeroTier network 69 | - `%i`: the identity of the member of this ZeroTier network 70 | - `%a`: the first assigned IP address of this member 71 | - `%N`: the name (not the fqdn!) of the ZeroTier network member as it appears in central 72 | 73 | In the above example, it allows me to start an `iperf` client against the address of the selected member. 74 | 75 | ## Author 76 | 77 | Erik Hollensbe 78 | -------------------------------------------------------------------------------- /readme-images/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikh/ztui/6d50082c7ba75ac15973908d193d2f33eb26837e/readme-images/main.png -------------------------------------------------------------------------------- /readme-images/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erikh/ztui/6d50082c7ba75ac15973908d193d2f33eb26837e/readme-images/network.png -------------------------------------------------------------------------------- /src/app.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | collections::HashMap, 3 | io::{Read, Write}, 4 | process::Stdio, 5 | sync::{Arc, Mutex}, 6 | time::{Duration, Instant}, 7 | }; 8 | 9 | use bat::{Input, PrettyPrinter}; 10 | use crossterm::{ 11 | event::{self, Event, KeyCode, KeyEvent}, 12 | execute, 13 | terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, 14 | }; 15 | use serde::{Deserialize, Serialize}; 16 | use tempfile::NamedTempFile; 17 | use tokio::sync::mpsc; 18 | use tui::{ 19 | backend::{Backend, CrosstermBackend}, 20 | layout::Rect, 21 | style::{Color, Modifier, Style}, 22 | text::{Span, Spans}, 23 | widgets::{Clear, Paragraph, TableState}, 24 | Frame, Terminal, 25 | }; 26 | 27 | use crate::{ 28 | client::{self, central_client}, 29 | config::Settings, 30 | }; 31 | 32 | pub const STATUS_DISCONNECTED: &str = "DISCONNECTED"; 33 | 34 | #[derive(Debug, Clone, Serialize, Deserialize)] 35 | pub enum EditingMode { 36 | Command, 37 | Editing, 38 | } 39 | 40 | #[derive(Debug, Clone, Serialize, Deserialize)] 41 | pub enum ListFilter { 42 | None, 43 | Connected, 44 | } 45 | 46 | pub enum NetworkFlag { 47 | AllowDNS, 48 | AllowManaged, 49 | AllowGlobal, 50 | AllowDefault, 51 | } 52 | 53 | #[derive(Debug, Clone, Serialize, Deserialize)] 54 | pub enum Dialog { 55 | None, 56 | Join, 57 | Config, 58 | Help, 59 | APIKey(String), 60 | RenameMember(String, String), 61 | AddMember(String), 62 | NetworkFlags(String), 63 | } 64 | 65 | #[derive(Debug, Clone, Serialize, Deserialize)] 66 | pub enum Page { 67 | Networks, 68 | Network(String), 69 | } 70 | 71 | impl Default for Page { 72 | fn default() -> Self { 73 | Page::Networks 74 | } 75 | } 76 | 77 | #[derive(Debug, Clone)] 78 | pub struct App { 79 | pub editing_mode: EditingMode, 80 | pub dialog: Dialog, 81 | pub inputbuffer: String, 82 | pub last_usage: HashMap>, 83 | pub member_count: usize, 84 | pub member_state: TableState, 85 | } 86 | 87 | impl Default for App { 88 | fn default() -> Self { 89 | Self { 90 | dialog: Dialog::None, 91 | editing_mode: EditingMode::Command, 92 | inputbuffer: String::new(), 93 | last_usage: HashMap::new(), 94 | member_count: 0, 95 | member_state: TableState::default(), 96 | } 97 | } 98 | } 99 | 100 | impl App { 101 | pub fn run( 102 | &mut self, 103 | terminal: &mut Terminal>, 104 | settings: Arc>, 105 | ) -> Result<(), anyhow::Error> { 106 | terminal.clear()?; 107 | 108 | loop { 109 | if let Dialog::Config = self.dialog { 110 | crate::temp_mute_terminal!(terminal, { 111 | PrettyPrinter::new() 112 | .input(Input::from_bytes(self.inputbuffer.as_bytes()).name("settings.json")) 113 | .paging_mode(bat::PagingMode::Always) 114 | .print() 115 | .expect("could not print"); 116 | }); 117 | self.dialog = Dialog::None; 118 | self.inputbuffer = String::new(); 119 | } 120 | 121 | let last_tick = Instant::now(); 122 | let s = settings.clone(); 123 | terminal.draw(|f| { 124 | self.draw(f, s).unwrap(); 125 | })?; 126 | 127 | let timeout = Duration::new(1, 0) 128 | .checked_sub(last_tick.elapsed()) 129 | .unwrap_or_else(|| Duration::from_secs(0)); 130 | if crossterm::event::poll(timeout)? { 131 | if self.read_key(terminal, settings.clone())? { 132 | return Ok(()); 133 | } 134 | } 135 | } 136 | } 137 | 138 | fn set_dialog_api_key(&mut self, settings: Arc>, id: String) { 139 | settings.lock().unwrap().page = Page::Networks; 140 | self.dialog = Dialog::APIKey(id); 141 | self.editing_mode = EditingMode::Editing; 142 | self.inputbuffer = String::new(); 143 | } 144 | 145 | fn show_toast(&self, f: &mut Frame<'_, B>, color: Color, mut message: String) { 146 | let size = f.size(); 147 | message.truncate(size.width as usize - 10); 148 | let span = Spans::from(vec![Span::styled( 149 | format!("[ {} ]", message), 150 | Style::default().fg(color).add_modifier(Modifier::BOLD), 151 | )]); 152 | 153 | let rect = Rect::new( 154 | size.width - span.width() as u16 - 2, 155 | size.height - 1, 156 | span.width() as u16, 157 | 1, 158 | ); 159 | f.render_widget(Clear, rect); 160 | f.render_widget(Paragraph::new(span), rect); 161 | } 162 | 163 | fn draw( 164 | &mut self, 165 | f: &mut Frame<'_, B>, 166 | settings: Arc>, 167 | ) -> Result<(), anyhow::Error> { 168 | let lock = settings.lock().unwrap(); 169 | let page = lock.page.clone(); 170 | drop(lock); 171 | 172 | match page { 173 | Page::Networks => { 174 | crate::display::display_networks(f, self, settings.clone())?; 175 | } 176 | Page::Network(id) => { 177 | let lock = settings.lock().unwrap(); 178 | let members = lock.members.clone(); 179 | let members = members.get(&id); 180 | let err = lock.last_error.clone(); 181 | drop(lock); 182 | 183 | if let Some(err) = err { 184 | self.show_toast(f, Color::LightRed, err); 185 | self.set_dialog_api_key(settings.clone(), id); 186 | } 187 | 188 | if let Some(members) = members { 189 | crate::display::display_network(f, self, members.to_vec())?; 190 | } else { 191 | self.show_toast( 192 | f, 193 | Color::LightGreen, 194 | "Loading your results, please wait...".to_string(), 195 | ) 196 | } 197 | } 198 | } 199 | 200 | crate::display::display_dialogs(f, self, settings); 201 | Ok(()) 202 | } 203 | 204 | pub fn read_key( 205 | &mut self, 206 | terminal: &mut Terminal>, 207 | settings: Arc>, 208 | ) -> Result { 209 | if let Event::Key(key) = event::read()? { 210 | match self.editing_mode { 211 | EditingMode::Command => { 212 | if self.command_mode_key(terminal, settings, key)? { 213 | return Ok(true); 214 | } 215 | } 216 | EditingMode::Editing => self.edit_mode_key(terminal, settings, key), 217 | } 218 | } 219 | Ok(false) 220 | } 221 | 222 | fn command_mode_key( 223 | &mut self, 224 | terminal: &mut Terminal>, 225 | settings: Arc>, 226 | key: KeyEvent, 227 | ) -> Result { 228 | let mut lock = settings.lock().unwrap(); 229 | match &lock.page { 230 | Page::Network(id) => match key.code { 231 | KeyCode::Up => { 232 | if let Some(pos) = self.member_state.selected() { 233 | if pos > 0 { 234 | self.member_state.select(Some(pos - 1)); 235 | } 236 | } 237 | } 238 | KeyCode::Down => { 239 | let pos = self.member_state.selected().unwrap_or_default() + 1; 240 | if pos < self.member_count { 241 | self.member_state.select(Some(pos)) 242 | } 243 | } 244 | KeyCode::Esc => { 245 | self.dialog = Dialog::None; 246 | self.editing_mode = EditingMode::Command; 247 | } 248 | KeyCode::Char(c) => match c { 249 | 'q' => { 250 | lock.page = Page::Networks; 251 | self.member_state.select(Some(0)); 252 | self.dialog = Dialog::None; 253 | self.editing_mode = EditingMode::Command; 254 | } 255 | 'h' => { 256 | self.dialog = match self.dialog { 257 | Dialog::Help => Dialog::None, 258 | _ => Dialog::Help, 259 | } 260 | } 261 | 'r' => { 262 | if let Some(members) = &lock.members.get(id) { 263 | if let Some(selected) = self.member_state.selected() { 264 | self.dialog = Dialog::RenameMember( 265 | members[selected].network_id.clone().unwrap(), 266 | members[selected].node_id.clone().unwrap(), 267 | ); 268 | self.editing_mode = EditingMode::Editing; 269 | self.inputbuffer = members[selected].name.clone().unwrap(); 270 | } 271 | } 272 | } 273 | 'A' => { 274 | self.dialog = Dialog::AddMember(id.to_string()); 275 | self.editing_mode = EditingMode::Editing; 276 | self.inputbuffer = String::new(); 277 | } 278 | 'a' => { 279 | if let Some(members) = &lock.members.get(id) { 280 | if let Some(selected) = self.member_state.selected() { 281 | let node_id = members[selected].node_id.clone().unwrap(); 282 | let client = central_client( 283 | lock.api_key_for_id(id.to_string()).unwrap().to_string(), 284 | )?; 285 | crate::client::sync_authorize_member( 286 | client, 287 | id.to_string(), 288 | node_id, 289 | )?; 290 | } 291 | } 292 | } 293 | 'd' => { 294 | if let Some(members) = &lock.members.get(id) { 295 | if let Some(selected) = self.member_state.selected() { 296 | let node_id = members[selected].node_id.clone().unwrap(); 297 | let client = central_client( 298 | lock.api_key_for_id(id.to_string()).unwrap().to_string(), 299 | )?; 300 | crate::client::sync_deauthorize_member( 301 | client, 302 | id.to_string(), 303 | node_id, 304 | )?; 305 | } 306 | } 307 | } 308 | 'D' => { 309 | if let Some(members) = &lock.members.get(id) { 310 | if let Some(selected) = self.member_state.selected() { 311 | let node_id = members[selected].node_id.clone().unwrap(); 312 | let client = central_client( 313 | lock.api_key_for_id(id.to_string()).unwrap().to_string(), 314 | )?; 315 | crate::client::sync_delete_member(client, id.to_string(), node_id)?; 316 | } 317 | } 318 | } 319 | x => { 320 | if let Some(members) = &lock.members.get(id) { 321 | { 322 | if let Some(member) = members 323 | .iter() 324 | .nth(lock.network_state.selected().unwrap_or_default()) 325 | { 326 | if let Some(s) = 327 | lock.user_config().command_for_member(x, member) 328 | { 329 | App::run_command(terminal, true, s)?; 330 | } 331 | } 332 | } 333 | } 334 | } 335 | }, 336 | _ => {} 337 | }, 338 | Page::Networks => match &self.dialog { 339 | Dialog::NetworkFlags(id) => match key.code { 340 | KeyCode::Char('n') => { 341 | crate::client::toggle_flag(id.to_string(), NetworkFlag::AllowDNS)?; 342 | } 343 | KeyCode::Char('d') => { 344 | crate::client::toggle_flag(id.to_string(), NetworkFlag::AllowDefault)?; 345 | } 346 | KeyCode::Char('g') => { 347 | crate::client::toggle_flag(id.to_string(), NetworkFlag::AllowGlobal)?; 348 | } 349 | KeyCode::Char('m') => { 350 | crate::client::toggle_flag(id.to_string(), NetworkFlag::AllowManaged)?; 351 | } 352 | KeyCode::Esc | KeyCode::Char('q') => { 353 | self.dialog = Dialog::None; 354 | } 355 | _ => {} 356 | }, 357 | Dialog::None => match key.code { 358 | KeyCode::Up => { 359 | let pos = lock.network_state.selected().unwrap_or_default(); 360 | lock.network_state 361 | .select(if pos > 0 { Some(pos - 1) } else { Some(0) }); 362 | } 363 | KeyCode::Down => { 364 | let pos = lock.network_state.selected().unwrap_or_default() + 1; 365 | let count = lock.count(); 366 | if pos < count { 367 | lock.network_state.select(Some(pos)) 368 | } 369 | } 370 | KeyCode::Esc => { 371 | self.dialog = Dialog::None; 372 | self.editing_mode = EditingMode::Command; 373 | } 374 | KeyCode::Char(c) => match c { 375 | 'q' => return Ok(true), 376 | 'd' => { 377 | let pos = lock.network_state.selected().unwrap_or_default(); 378 | lock.remove_network(pos); 379 | } 380 | 'l' => { 381 | let pos = lock.network_state.selected().unwrap_or_default(); 382 | let id = lock.get_network_id_by_pos(pos); 383 | crate::client::leave_network(id)?; 384 | } 385 | 'j' => { 386 | let pos = lock.network_state.selected().unwrap_or_default(); 387 | let id = lock.get_network_id_by_pos(pos); 388 | crate::client::join_network(id)?; 389 | } 390 | 'J' => { 391 | self.dialog = Dialog::Join; 392 | self.editing_mode = EditingMode::Editing; 393 | self.inputbuffer = String::new(); 394 | } 395 | 'c' => { 396 | self.inputbuffer = 397 | serde_json::to_string_pretty(&lock.get_network_by_pos( 398 | lock.network_state.selected().unwrap_or_default(), 399 | ))?; 400 | self.dialog = Dialog::Config; 401 | } 402 | 't' => { 403 | let filter = match lock.filter() { 404 | ListFilter::None => ListFilter::Connected, 405 | ListFilter::Connected => ListFilter::None, 406 | }; 407 | 408 | lock.set_filter(filter); 409 | lock.network_state.select(Some(0)) 410 | } 411 | 'h' => { 412 | self.dialog = match self.dialog { 413 | Dialog::Help => Dialog::None, 414 | _ => Dialog::Help, 415 | } 416 | } 417 | 's' => { 418 | let id = lock.get_network_id_by_pos( 419 | lock.network_state.selected().unwrap_or_default(), 420 | ); 421 | let key = lock.api_key_for_id(id.clone()); 422 | if let Some(_) = key { 423 | self.member_state.select(Some(0)); 424 | lock.page = Page::Network(id) 425 | } else { 426 | self.dialog = Dialog::APIKey(id); 427 | self.editing_mode = EditingMode::Editing; 428 | self.inputbuffer = String::new(); 429 | } 430 | } 431 | 'f' => { 432 | let pos = lock.network_state.selected().unwrap_or_default(); 433 | let id = lock.get_network_id_by_pos(pos); 434 | self.dialog = Dialog::NetworkFlags(id); 435 | } 436 | 'e' => { 437 | let pos = lock.network_state.selected().unwrap_or_default(); 438 | if let Some(network) = lock.get_network_by_pos(pos) { 439 | if let Some(api_key) = 440 | lock.api_key_for_id(network.subtype_1.id.clone().unwrap()) 441 | { 442 | let client = central_client(api_key.to_string())?; 443 | let net = crate::client::sync_get_network( 444 | client.clone(), 445 | network.subtype_1.id.clone().unwrap(), 446 | )?; 447 | 448 | let mut tf = NamedTempFile::new()?; 449 | 450 | tf.write_all(net.rules_source.clone().unwrap().as_bytes())?; 451 | let path = tf.into_temp_path(); 452 | let modif = path.metadata()?.modified()?; 453 | 454 | App::run_command( 455 | terminal, 456 | false, 457 | format!("$EDITOR {}", path.display()), 458 | )?; 459 | 460 | if path.metadata()?.modified()? != modif { 461 | crate::client::sync_apply_network_rules( 462 | client, 463 | network.subtype_1.id.clone().unwrap(), 464 | std::fs::read_to_string(path)?, 465 | )?; 466 | } 467 | } 468 | } 469 | } 470 | x => { 471 | if let Some(net) = lock.get_network_by_pos( 472 | lock.network_state.selected().unwrap_or_default(), 473 | ) { 474 | if let Some(s) = lock.user_config().command_for_network(x, net) { 475 | App::run_command(terminal, true, s)?; 476 | } 477 | } 478 | } 479 | }, 480 | _ => {} 481 | }, 482 | Dialog::Help => match key.code { 483 | KeyCode::Esc | KeyCode::Char('q') | KeyCode::Char('h') => { 484 | self.dialog = Dialog::None; 485 | } 486 | _ => {} 487 | }, 488 | _ => {} 489 | }, 490 | } 491 | 492 | Ok(false) 493 | } 494 | 495 | fn edit_mode_key( 496 | &mut self, 497 | _terminal: &mut Terminal>, 498 | settings: Arc>, 499 | key: KeyEvent, 500 | ) { 501 | match key.code { 502 | KeyCode::Char(x) => { 503 | self.inputbuffer.push(x); 504 | } 505 | KeyCode::Esc => { 506 | self.inputbuffer = String::new(); 507 | self.dialog = Dialog::None; 508 | self.editing_mode = EditingMode::Command; 509 | } 510 | KeyCode::Backspace => { 511 | if self.inputbuffer.len() > 0 { 512 | self.inputbuffer 513 | .drain(self.inputbuffer.len() - 1..self.inputbuffer.len()); 514 | } 515 | } 516 | KeyCode::Enter => { 517 | match &self.dialog { 518 | Dialog::Join => { 519 | crate::client::join_network(self.inputbuffer.clone()).unwrap(); 520 | } 521 | Dialog::APIKey(id) => { 522 | let mut lock = settings.lock().unwrap(); 523 | lock.set_api_key_for_id(id.clone(), self.inputbuffer.clone()); 524 | lock.page = Page::Network(id.clone()); 525 | } 526 | Dialog::AddMember(network_id) => { 527 | let lock = settings.lock().unwrap(); 528 | crate::client::sync_authorize_member( 529 | central_client( 530 | lock.api_key_for_id(network_id.to_string()) 531 | .unwrap() 532 | .to_string(), 533 | ) 534 | .unwrap(), 535 | network_id.to_string(), 536 | self.inputbuffer.clone(), 537 | ) 538 | .unwrap(); 539 | } 540 | Dialog::RenameMember(network_id, member_id) => { 541 | let mut lock = settings.lock().unwrap(); 542 | client::sync_update_member_name( 543 | central_client( 544 | lock.api_key_for_id(network_id.to_string()) 545 | .unwrap() 546 | .to_string(), 547 | ) 548 | .unwrap(), 549 | network_id.to_string(), 550 | member_id.to_string(), 551 | self.inputbuffer.clone(), 552 | ) 553 | .unwrap(); 554 | lock.page = Page::Network(network_id.clone()); 555 | } 556 | _ => {} 557 | } 558 | 559 | self.inputbuffer = String::new(); 560 | self.dialog = Dialog::None; 561 | self.editing_mode = EditingMode::Command; 562 | } 563 | _ => {} 564 | } 565 | } 566 | 567 | fn run_command( 568 | terminal: &mut Terminal>, 569 | trap: bool, // wrap the terminal for pty, signal handling 570 | s: String, 571 | ) -> Result<(), anyhow::Error> { 572 | let mut args: Vec = vec!["-c".to_string()]; 573 | args.push(s); 574 | 575 | terminal.clear()?; 576 | let (sc, mut r) = mpsc::unbounded_channel(); 577 | let t = tokio::runtime::Builder::new_multi_thread() 578 | .enable_all() 579 | .build()?; 580 | 581 | crate::temp_mute_terminal!(terminal, { 582 | let s2 = sc.clone(); 583 | t.spawn(async move { 584 | // let pty_system = native_pty_system(); 585 | // let pair = pty_system.openpty(PtySize { 586 | // rows: terminal.size().unwrap().height, 587 | // cols: terminal.size().unwrap().width, 588 | // pixel_width: 0, 589 | // pixel_height: 0, 590 | // })?; 591 | 592 | // let mut cmd = CommandBuilder::new("/bin/sh"); 593 | // cmd.args(args); 594 | 595 | let mut child = tokio::process::Command::new("/bin/sh") 596 | .args(args) 597 | .stdin(Stdio::inherit()) 598 | .stdout(Stdio::inherit()) 599 | .stderr(Stdio::inherit()) 600 | .spawn() 601 | .unwrap(); 602 | 603 | let pid = child.id(); 604 | 605 | tokio::spawn(async move { 606 | if trap { 607 | let _ = tokio::signal::ctrl_c().await; 608 | 609 | nix::sys::signal::kill( 610 | nix::unistd::Pid::from_raw(pid.unwrap() as i32), 611 | Some(nix::sys::signal::SIGTERM), 612 | ) 613 | .unwrap(); 614 | } 615 | }); 616 | 617 | s2.send(child.wait().await).unwrap(); 618 | }); 619 | }); 620 | 621 | loop { 622 | if let Ok(_) = r.try_recv() { 623 | break; 624 | } else { 625 | std::thread::sleep(Duration::new(0, 10)) 626 | } 627 | } 628 | 629 | t.shutdown_background(); 630 | drop(sc); 631 | eprintln!("\nPress ENTER to continue"); 632 | let mut buf = [0u8; 1]; 633 | let _ = std::io::stdin().read(&mut buf).unwrap(); 634 | terminal.clear()?; 635 | 636 | Ok(()) 637 | } 638 | } 639 | -------------------------------------------------------------------------------- /src/client.rs: -------------------------------------------------------------------------------- 1 | // NOTE: since most of the outer code is sync w/ threads, and most of the code in here is async, 2 | // we've adopted a weird model in here where we instantiate the tokio runtime on each use, and tear 3 | // it down afterwards. It's not the most efficient pattern I am well aware but it does work. 4 | // 5 | // -erikh 6 | // 7 | use std::{ 8 | path::Path, 9 | time::{Duration, Instant}, 10 | }; 11 | 12 | use anyhow::anyhow; 13 | use http::{HeaderMap, HeaderValue}; 14 | use tokio::sync::mpsc; 15 | use zerotier_central_api::types::Network as CentralNetwork; 16 | use zerotier_central_api::{types::Member, Client, ResponseValue}; 17 | use zerotier_one_api::types::Network; 18 | 19 | use crate::app::NetworkFlag; 20 | 21 | // address of Central 22 | const CENTRAL_BASEURL: &str = "https://my.zerotier.com/api/v1"; 23 | 24 | // this provides the production configuration for talking to central through the openapi libraries. 25 | pub fn central_client(token: String) -> Result { 26 | let mut headers = HeaderMap::new(); 27 | headers.insert( 28 | "Authorization", 29 | HeaderValue::from_str(&format!("bearer {}", token))?, 30 | ); 31 | 32 | Ok(zerotier_central_api::Client::new_with_client( 33 | &std::env::var("ZEROTIER_CENTRAL_INSTANCE").unwrap_or(CENTRAL_BASEURL.to_string()), 34 | reqwest::Client::builder() 35 | .https_only(true) 36 | .default_headers(headers) 37 | .build()?, 38 | )) 39 | } 40 | 41 | // determine the path of the authtoken.secret 42 | pub fn authtoken_path(arg: Option<&Path>) -> &Path { 43 | if let Some(arg) = arg { 44 | return arg; 45 | } 46 | 47 | if cfg!(target_os = "linux") { 48 | Path::new("/var/lib/zerotier-one/authtoken.secret") 49 | } else if cfg!(target_os = "windows") { 50 | Path::new("C:/ProgramData/ZeroTier/One/authtoken.secret") 51 | } else if cfg!(target_os = "macos") { 52 | Path::new("/Library/Application Support/ZeroTier/One/authtoken.secret") 53 | } else { 54 | panic!("authtoken.secret not found; please provide the -s option to provide a custom path") 55 | } 56 | } 57 | 58 | pub fn local_client_from_file( 59 | authtoken_path: &Path, 60 | ) -> Result { 61 | let authtoken = std::fs::read_to_string(authtoken_path)?; 62 | local_client(authtoken) 63 | } 64 | 65 | fn local_client(authtoken: String) -> Result { 66 | let mut headers = HeaderMap::new(); 67 | headers.insert("X-ZT1-Auth", HeaderValue::from_str(&authtoken)?); 68 | 69 | Ok(zerotier_one_api::Client::new_with_client( 70 | "http://127.0.0.1:9993", 71 | reqwest::Client::builder() 72 | .default_headers(headers) 73 | .build()?, 74 | )) 75 | } 76 | 77 | pub async fn get_networks(s: mpsc::UnboundedSender>) -> Result<(), anyhow::Error> { 78 | let client = local_client_from_file(authtoken_path(None))?; 79 | let networks = client.get_networks().await?; 80 | 81 | s.send(networks.to_vec())?; 82 | Ok(()) 83 | } 84 | 85 | pub fn leave_network(network_id: String) -> Result, zerotier_one_api::Error> { 86 | let t = tokio::runtime::Builder::new_multi_thread() 87 | .enable_all() 88 | .build() 89 | .unwrap(); 90 | 91 | let (s, mut r) = mpsc::unbounded_channel(); 92 | 93 | t.spawn(async move { 94 | let client = local_client_from_file(authtoken_path(None)).unwrap(); 95 | s.send(client.delete_network(&network_id).await).unwrap() 96 | }); 97 | 98 | let res: Result, zerotier_one_api::Error>; 99 | 100 | loop { 101 | if let Ok(r) = r.try_recv() { 102 | res = r; 103 | break; 104 | } 105 | } 106 | 107 | t.shutdown_background(); 108 | res 109 | } 110 | 111 | pub fn join_network(network_id: String) -> Result, zerotier_one_api::Error> { 112 | let t = tokio::runtime::Builder::new_multi_thread() 113 | .enable_all() 114 | .build() 115 | .unwrap(); 116 | let (s, mut r) = mpsc::unbounded_channel(); 117 | 118 | t.spawn(async move { 119 | let client = local_client_from_file(authtoken_path(None)).unwrap(); 120 | s.send( 121 | client 122 | .update_network( 123 | &network_id, 124 | &Network { 125 | subtype_0: zerotier_one_api::types::NetworkSubtype0 { 126 | allow_default: None, 127 | allow_dns: None, 128 | allow_global: None, 129 | allow_managed: None, 130 | }, 131 | subtype_1: zerotier_one_api::types::NetworkSubtype1 { 132 | allow_default: None, 133 | allow_dns: None, 134 | allow_global: None, 135 | allow_managed: None, 136 | assigned_addresses: Vec::new(), 137 | bridge: None, 138 | broadcast_enabled: None, 139 | dns: None, 140 | id: None, 141 | mac: None, 142 | mtu: None, 143 | multicast_subscriptions: Vec::new(), 144 | name: None, 145 | netconf_revision: None, 146 | port_device_name: None, 147 | port_error: None, 148 | routes: Vec::new(), 149 | status: None, 150 | type_: None, 151 | }, 152 | }, 153 | ) 154 | .await, 155 | ) 156 | }); 157 | 158 | let res: Result, zerotier_one_api::Error>; 159 | 160 | loop { 161 | if let Ok(r) = r.try_recv() { 162 | res = r; 163 | break; 164 | } 165 | } 166 | 167 | t.shutdown_background(); 168 | res 169 | } 170 | 171 | pub fn sync_get_networks() -> Result, anyhow::Error> { 172 | let (s, mut r) = mpsc::unbounded_channel(); 173 | 174 | let t = tokio::runtime::Builder::new_multi_thread() 175 | .enable_all() 176 | .build()?; 177 | t.spawn(crate::client::get_networks(s)); 178 | 179 | let networks: Vec; 180 | 181 | let timeout = Instant::now(); 182 | 183 | 'outer: loop { 184 | match r.try_recv() { 185 | Ok(n) => { 186 | networks = n; 187 | break 'outer; 188 | } 189 | 190 | Err(_) => std::thread::sleep(Duration::new(0, 10)), 191 | } 192 | 193 | if timeout.elapsed() > Duration::new(3, 0) { 194 | return Err(anyhow!("timeout reading from zerotier")); 195 | } 196 | } 197 | 198 | t.shutdown_background(); 199 | Ok(networks) 200 | } 201 | 202 | pub fn sync_get_members(client: Client, id: String) -> Result, anyhow::Error> { 203 | let (s, mut r) = mpsc::unbounded_channel(); 204 | 205 | let t = tokio::runtime::Builder::new_multi_thread() 206 | .enable_all() 207 | .build()?; 208 | t.spawn(async move { s.send(client.get_network_member_list(&id).await).unwrap() }); 209 | 210 | let members: Vec; 211 | 212 | let timeout = Instant::now(); 213 | 214 | 'outer: loop { 215 | match r.try_recv() { 216 | Ok(m) => match m { 217 | Ok(m) => { 218 | members = m.to_vec(); 219 | break 'outer; 220 | } 221 | Err(e) => return Err(anyhow!(e)), 222 | }, 223 | 224 | Err(_) => std::thread::sleep(Duration::new(0, 10)), 225 | } 226 | 227 | if timeout.elapsed() > Duration::new(3, 0) { 228 | return Err(anyhow!("timeout reading from zerotier")); 229 | } 230 | } 231 | 232 | t.shutdown_background(); 233 | Ok(members) 234 | } 235 | 236 | pub fn sync_update_member_name( 237 | client: Client, 238 | network_id: String, 239 | id: String, 240 | name: String, 241 | ) -> Result, anyhow::Error> { 242 | let (s, mut r) = mpsc::unbounded_channel(); 243 | 244 | let t = tokio::runtime::Builder::new_multi_thread() 245 | .enable_all() 246 | .build()?; 247 | t.spawn(async move { 248 | let mut member = client.get_network_member(&network_id, &id).await.unwrap(); 249 | member.name = Some(name); 250 | s.send( 251 | client 252 | .update_network_member(&network_id, &id, &member) 253 | .await, 254 | ) 255 | .unwrap(); 256 | }); 257 | 258 | let timeout = Instant::now(); 259 | 260 | loop { 261 | if let Ok(res) = r.try_recv() { 262 | t.shutdown_background(); 263 | return Ok(res?); 264 | } else { 265 | std::thread::sleep(Duration::new(0, 10)); 266 | } 267 | 268 | if timeout.elapsed() > Duration::new(3, 0) { 269 | t.shutdown_background(); 270 | return Err(anyhow!("timeout reading from zerotier")); 271 | } 272 | } 273 | } 274 | 275 | pub fn sync_member_auth( 276 | client: Client, 277 | network_id: String, 278 | id: String, 279 | auth: bool, 280 | ) -> Result, anyhow::Error> { 281 | let (s, mut r) = mpsc::unbounded_channel(); 282 | 283 | let t = tokio::runtime::Builder::new_multi_thread() 284 | .enable_all() 285 | .build()?; 286 | t.spawn(async move { 287 | let mut member = client.get_network_member(&network_id, &id).await.unwrap(); 288 | member.config.as_mut().unwrap().authorized = Some(auth); 289 | s.send( 290 | client 291 | .update_network_member(&network_id, &id, &member) 292 | .await, 293 | ) 294 | .unwrap(); 295 | }); 296 | 297 | let timeout = Instant::now(); 298 | 299 | loop { 300 | if let Ok(res) = r.try_recv() { 301 | t.shutdown_background(); 302 | return Ok(res?); 303 | } else { 304 | std::thread::sleep(Duration::new(0, 10)); 305 | } 306 | 307 | if timeout.elapsed() > Duration::new(3, 0) { 308 | t.shutdown_background(); 309 | return Err(anyhow!("timeout reading from zerotier")); 310 | } 311 | } 312 | } 313 | 314 | pub fn sync_deauthorize_member( 315 | client: Client, 316 | network_id: String, 317 | id: String, 318 | ) -> Result, anyhow::Error> { 319 | sync_member_auth(client, network_id, id, false) 320 | } 321 | 322 | pub fn sync_authorize_member( 323 | client: Client, 324 | network_id: String, 325 | id: String, 326 | ) -> Result, anyhow::Error> { 327 | sync_member_auth(client, network_id, id, true) 328 | } 329 | 330 | pub fn sync_delete_member( 331 | client: Client, 332 | network_id: String, 333 | id: String, 334 | ) -> Result, anyhow::Error> { 335 | let (s, mut r) = mpsc::unbounded_channel(); 336 | 337 | let t = tokio::runtime::Builder::new_multi_thread() 338 | .enable_all() 339 | .build()?; 340 | t.spawn(async move { 341 | s.send(client.delete_network_member(&network_id, &id).await) 342 | .unwrap(); 343 | }); 344 | 345 | let timeout = Instant::now(); 346 | 347 | loop { 348 | if let Ok(res) = r.try_recv() { 349 | t.shutdown_background(); 350 | return Ok(res?); 351 | } else { 352 | std::thread::sleep(Duration::new(0, 10)); 353 | } 354 | 355 | if timeout.elapsed() > Duration::new(3, 0) { 356 | t.shutdown_background(); 357 | return Err(anyhow!("timeout reading from zerotier")); 358 | } 359 | } 360 | } 361 | 362 | macro_rules! true_or_none { 363 | ($code:expr) => { 364 | $code = $code.map_or(Some(false), |m| Some(!m)); 365 | }; 366 | } 367 | 368 | pub fn toggle_flag(id: String, flag: NetworkFlag) -> Result, anyhow::Error> { 369 | let (s, mut r) = mpsc::unbounded_channel(); 370 | 371 | let t = tokio::runtime::Builder::new_multi_thread() 372 | .enable_all() 373 | .build()?; 374 | 375 | t.spawn(async move { 376 | let local = local_client_from_file(authtoken_path(None)).unwrap(); 377 | let mut network = match local.get_network(&id.clone()).await { 378 | Ok(network) => network, 379 | Err(e) => { 380 | s.send(Err(e)).unwrap(); 381 | return; 382 | } 383 | }; 384 | 385 | match flag { 386 | NetworkFlag::AllowDNS => { 387 | true_or_none!(network.subtype_0.allow_dns); 388 | } 389 | NetworkFlag::AllowGlobal => { 390 | true_or_none!(network.subtype_0.allow_global); 391 | } 392 | NetworkFlag::AllowManaged => { 393 | true_or_none!(network.subtype_0.allow_managed); 394 | } 395 | NetworkFlag::AllowDefault => { 396 | true_or_none!(network.subtype_0.allow_default); 397 | } 398 | } 399 | 400 | s.send(local.update_network(&id, &network).await).unwrap(); 401 | }); 402 | 403 | let timeout = Instant::now(); 404 | 405 | loop { 406 | if let Ok(res) = r.try_recv() { 407 | t.shutdown_background(); 408 | return Ok(res?); 409 | } else { 410 | std::thread::sleep(Duration::new(0, 10)); 411 | } 412 | 413 | if timeout.elapsed() > Duration::new(3, 0) { 414 | t.shutdown_background(); 415 | return Err(anyhow!("timeout reading from zerotier")); 416 | } 417 | } 418 | } 419 | 420 | pub fn sync_get_network( 421 | client: Client, 422 | network_id: String, 423 | ) -> Result, anyhow::Error> { 424 | let (s, mut r) = mpsc::unbounded_channel(); 425 | 426 | let t = tokio::runtime::Builder::new_multi_thread() 427 | .enable_all() 428 | .build()?; 429 | t.spawn(async move { s.send(client.get_network_by_id(&network_id).await).unwrap() }); 430 | 431 | let timeout = Instant::now(); 432 | 433 | loop { 434 | if let Ok(res) = r.try_recv() { 435 | t.shutdown_background(); 436 | return Ok(res?); 437 | } else { 438 | std::thread::sleep(Duration::new(0, 10)); 439 | } 440 | 441 | if timeout.elapsed() > Duration::new(3, 0) { 442 | t.shutdown_background(); 443 | return Err(anyhow!("timeout reading from zerotier")); 444 | } 445 | } 446 | } 447 | 448 | pub fn sync_apply_network_rules( 449 | client: Client, 450 | network_id: String, 451 | rules: String, 452 | ) -> Result, anyhow::Error> { 453 | let (s, mut r) = mpsc::unbounded_channel(); 454 | 455 | let t = tokio::runtime::Builder::new_multi_thread() 456 | .enable_all() 457 | .build()?; 458 | t.spawn(async move { 459 | let mut net = client.get_network_by_id(&network_id).await.unwrap(); 460 | net.rules_source = Some(rules); 461 | let res = client.update_network(&network_id, &net).await; 462 | s.send(res).unwrap(); 463 | }); 464 | 465 | let timeout = Instant::now(); 466 | 467 | loop { 468 | if let Ok(res) = r.try_recv() { 469 | t.shutdown_background(); 470 | return Ok(res?); 471 | } else { 472 | std::thread::sleep(Duration::new(0, 10)); 473 | } 474 | 475 | if timeout.elapsed() > Duration::new(3, 0) { 476 | t.shutdown_background(); 477 | return Err(anyhow!("timeout reading from zerotier")); 478 | } 479 | } 480 | } 481 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | collections::{HashMap, HashSet}, 3 | path::PathBuf, 4 | }; 5 | 6 | use serde::{Deserialize, Serialize}; 7 | use tui::widgets::TableState; 8 | use zerotier_central_api::types::Member; 9 | use zerotier_one_api::types::Network; 10 | 11 | use crate::{ 12 | app::{ListFilter, Page, STATUS_DISCONNECTED}, 13 | nets::Nets, 14 | }; 15 | 16 | pub fn config_path() -> PathBuf { 17 | directories::UserDirs::new() 18 | .expect("could not locate your home directory") 19 | .home_dir() 20 | .join(".config.zerotier") 21 | } 22 | 23 | fn template_network(s: Option<&String>, network: &Network) -> Option { 24 | if s.is_none() { 25 | return None; 26 | } 27 | 28 | Some( 29 | s.clone() 30 | .unwrap() 31 | .replace("%i", &network.subtype_1.port_device_name.clone().unwrap()) 32 | .replace("%n", &network.subtype_1.id.clone().unwrap()) 33 | .replace( 34 | "%a", 35 | &network 36 | .subtype_1 37 | .assigned_addresses 38 | .iter() 39 | .nth(0) 40 | .expect("No assigned addresses"), 41 | ), 42 | ) 43 | } 44 | 45 | fn template_member(s: Option<&String>, member: &Member) -> Option { 46 | if s.is_none() { 47 | return None; 48 | } 49 | 50 | return Some( 51 | s.clone() 52 | .unwrap() 53 | .replace("%n", &member.network_id.clone().unwrap()) 54 | .replace("%i", &member.node_id.clone().unwrap()) 55 | .replace("%N", &member.name.clone().unwrap()) 56 | .replace( 57 | "%a", 58 | &member 59 | .config 60 | .clone() 61 | .unwrap() 62 | .ip_assignments 63 | .unwrap() 64 | .iter() 65 | .nth(0) 66 | .expect("No assigned addresses"), 67 | ), 68 | ); 69 | } 70 | 71 | #[derive(Debug, Clone, Serialize, Deserialize)] 72 | pub struct UserConfig { 73 | network_commands: HashMap, 74 | member_commands: HashMap, 75 | } 76 | 77 | impl UserConfig { 78 | pub fn from_dir(filename: PathBuf) -> Result { 79 | let config_file = std::fs::read_to_string(filename.join("config.json"))?; 80 | Ok(serde_json::from_str(&config_file)?) 81 | } 82 | 83 | pub fn command_for_network(&self, c: char, network: &Network) -> Option { 84 | template_network(self.network_commands.get(&c), network) 85 | } 86 | 87 | pub fn command_for_member(&self, c: char, member: &Member) -> Option { 88 | template_member(self.member_commands.get(&c), member) 89 | } 90 | } 91 | 92 | impl Default for UserConfig { 93 | fn default() -> Self { 94 | Self { 95 | network_commands: HashMap::new(), 96 | member_commands: HashMap::new(), 97 | } 98 | } 99 | } 100 | 101 | #[derive(Debug, Clone, Serialize, Deserialize)] 102 | pub struct Settings { 103 | api_keys: HashMap, 104 | savednetworks: HashMap, 105 | savednetworksidx: Vec, 106 | pub members: HashMap>, 107 | filter: ListFilter, 108 | #[serde(skip)] 109 | pub last_error: Option, 110 | #[serde(skip)] 111 | pub page: Page, 112 | #[serde(skip)] 113 | pub network_state: TableState, 114 | #[serde(skip)] 115 | user_config: UserConfig, 116 | #[serde(skip)] 117 | pub nets: Nets, 118 | } 119 | 120 | impl Default for Settings { 121 | fn default() -> Self { 122 | Self { 123 | last_error: None, 124 | members: HashMap::new(), 125 | page: Page::Networks, 126 | api_keys: HashMap::new(), 127 | user_config: UserConfig::default(), 128 | network_state: TableState::default(), 129 | filter: ListFilter::None, 130 | savednetworks: HashMap::new(), 131 | savednetworksidx: Vec::new(), 132 | nets: Nets::new().unwrap(), 133 | } 134 | } 135 | } 136 | 137 | impl Settings { 138 | pub fn from_dir(filename: PathBuf) -> Result { 139 | let config_file = std::fs::read_to_string(filename.join("settings.json"))?; 140 | let mut config: Self = serde_json::from_str(&config_file)?; 141 | 142 | config.user_config = match UserConfig::from_dir(filename) { 143 | Ok(uc) => uc, 144 | Err(_) => UserConfig::default(), 145 | }; 146 | 147 | Ok(config) 148 | } 149 | 150 | pub fn to_file(&self, filename: PathBuf) -> Result<(), anyhow::Error> { 151 | Ok(std::fs::write( 152 | filename.join("settings.json"), 153 | serde_json::to_string_pretty(self)?, 154 | )?) 155 | } 156 | 157 | pub fn user_config(&self) -> UserConfig { 158 | self.user_config.clone() 159 | } 160 | 161 | pub fn set_filter(&mut self, filter: ListFilter) { 162 | self.filter = filter 163 | } 164 | 165 | pub fn filter(&self) -> ListFilter { 166 | self.filter.clone() 167 | } 168 | 169 | pub fn update_networks(&mut self, networks: Vec) -> Result { 170 | let mut new = false; 171 | let mut ids = HashSet::new(); 172 | 173 | for network in &networks { 174 | let id = network.subtype_1.id.clone().unwrap(); 175 | 176 | ids.insert(id.clone()); 177 | 178 | if !self.savednetworks.contains_key(&id) { 179 | new = true; 180 | } 181 | 182 | self.savednetworks.insert(id, network.clone()); 183 | } 184 | 185 | for (id, network) in self.savednetworks.iter_mut() { 186 | if !self.savednetworksidx.contains(id) { 187 | self.savednetworksidx.push(id.clone()); 188 | } 189 | 190 | if !ids.contains(id) { 191 | network.subtype_1.status = Some(crate::app::STATUS_DISCONNECTED.to_string()); 192 | continue; 193 | } 194 | 195 | self.nets 196 | .store_usage(network.subtype_1.port_device_name.clone().unwrap()); 197 | } 198 | 199 | Ok(new) 200 | } 201 | 202 | pub fn remove_network(&mut self, pos: usize) { 203 | let id = self.savednetworksidx[pos].clone(); 204 | 205 | let base = if pos > 0 { pos - 1 } else { pos }; 206 | let end = if pos > 0 { pos } else { pos + 1 }; 207 | 208 | self.savednetworksidx = self.savednetworksidx.splice(base..=end, []).collect(); 209 | self.savednetworks.remove(&id); 210 | } 211 | 212 | pub fn get_network_by_pos(&self, pos: usize) -> Option<&Network> { 213 | self.savednetworks.get(&self.get_network_id_by_pos(pos)) 214 | } 215 | 216 | pub fn get_network_id_by_pos(&self, pos: usize) -> String { 217 | self.savednetworksidx[pos].clone() 218 | } 219 | 220 | pub fn get(&self, id: &str) -> Option<&Network> { 221 | self.savednetworks.get(id) 222 | } 223 | 224 | pub fn idx_iter(&self) -> impl Iterator { 225 | self.savednetworksidx.iter() 226 | } 227 | 228 | pub fn count(&self) -> usize { 229 | self.idx_iter() 230 | .filter(|x| { 231 | if let ListFilter::Connected = self.filter() { 232 | self.get(&x).unwrap().subtype_1.status.clone().unwrap() != STATUS_DISCONNECTED 233 | } else { 234 | true 235 | } 236 | }) 237 | .count() 238 | } 239 | 240 | pub fn api_key_for_id(&self, id: String) -> Option<&String> { 241 | self.api_keys.get(&id) 242 | } 243 | 244 | pub fn set_api_key_for_id(&mut self, id: String, api_key: String) { 245 | self.api_keys.insert(id, api_key); 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /src/display.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | sync::{Arc, Mutex}, 3 | time::SystemTime, 4 | }; 5 | 6 | use time::{Duration, OffsetDateTime}; 7 | use tui::{ 8 | backend::Backend, 9 | layout::{Constraint, Layout, Rect}, 10 | style::{Color, Modifier, Style}, 11 | text::Span, 12 | widgets::{Block, Borders, Cell, Clear, Paragraph, Row, Table}, 13 | Frame, 14 | }; 15 | use zerotier_central_api::types::Member; 16 | use zerotier_one_api::types::Network; 17 | 18 | use crate::{ 19 | app::{App, Dialog, ListFilter, Page, STATUS_DISCONNECTED}, 20 | config::Settings, 21 | }; 22 | 23 | fn dialog(f: &mut Frame, app: &mut App, margin: u16, help_text: String) { 24 | let w = f.size().width; 25 | 26 | let layout = Layout::default() 27 | .direction(tui::layout::Direction::Vertical) 28 | .horizontal_margin(w / 2 - margin) 29 | .constraints( 30 | [ 31 | Constraint::Percentage(50), 32 | Constraint::Length(3), 33 | Constraint::Min(1), 34 | ] 35 | .as_ref(), 36 | ) 37 | .split(f.size()); 38 | 39 | let p = Paragraph::new(app.inputbuffer.as_ref()).block( 40 | Block::default() 41 | .borders(Borders::ALL) 42 | .title(format!("] {} [", help_text)), 43 | ); 44 | 45 | f.render_widget(Clear, layout[1]); 46 | f.render_widget(p, layout[1]); 47 | } 48 | 49 | fn dialog_api_key(f: &mut Frame, app: &mut App) { 50 | dialog(f, app, 20, "Enter your Network API Key".to_string()) 51 | } 52 | 53 | fn dialog_rename_member(f: &mut Frame, app: &mut App) { 54 | dialog(f, app, 20, "Enter the new name".to_string()) 55 | } 56 | 57 | fn dialog_add_member(f: &mut Frame, app: &mut App) { 58 | dialog(f, app, 20, "Enter the new node ID".to_string()) 59 | } 60 | 61 | fn dialog_join(f: &mut Frame, app: &mut App) { 62 | dialog(f, app, 10, "Join a Network".to_string()) 63 | } 64 | 65 | lazy_static::lazy_static! { 66 | static ref HELP_TEXT: Vec> = vec![ 67 | vec![ 68 | ["Up/Down", "Navigate the List"], 69 | ["", "back out of something"], 70 | ["d", "Delete a list member"], 71 | ["q", "Quit"], 72 | ["j", "Join a bookmarked network"], 73 | ["l", "Leave a bookmarked network"], 74 | ["J", "Join a network by address"], 75 | ["c", "review network settings"], 76 | ["t", "toggle disconnected in list"], 77 | ["s", "show network members (requires API key)"], 78 | ["e", "edit network rules (requires API key)"], 79 | ], 80 | vec![ 81 | ["Up/Down", "Navigate the List"], 82 | ["q", "quit to networks screen"], 83 | ["r", "Rename a Member"], 84 | ["a", "Authorize a deauthorized member"], 85 | ["A", "Authorize an arbitrary member ID"], 86 | ["d", "Deauthorize an authorized member"], 87 | ["D", "Delete a member"], 88 | ], 89 | ]; 90 | } 91 | 92 | pub fn dialog_help(f: &mut Frame, page: Page) { 93 | let size = f.size(); 94 | let w = size.width; 95 | let h = size.height; 96 | 97 | let block = Block::default() 98 | .borders(Borders::ALL) 99 | .title(Span::from("[ Help ]")); 100 | 101 | let help_text = &HELP_TEXT[match page { 102 | Page::Networks => 0, 103 | Page::Network(_) => 1, 104 | }]; 105 | 106 | let rows = help_text 107 | .iter() 108 | .map(|s| { 109 | Row::new(vec![ 110 | Cell::from(s[0].to_string()), 111 | Cell::from(s[1].to_string()), 112 | ]) 113 | }) 114 | .collect::>(); 115 | 116 | let table = Table::new(rows) 117 | .block(block) 118 | .widths(&[Constraint::Length(10), Constraint::Percentage(100)]); 119 | 120 | let mut rect = Rect::default(); 121 | rect.x = w / 4; 122 | rect.y = h / 4; 123 | rect.width = w / 2; 124 | rect.height = h / 2; 125 | f.render_widget(Clear, rect); 126 | f.render_widget(table, rect); 127 | } 128 | 129 | fn dialog_flags(f: &mut Frame, _app: &mut App, network: Network) { 130 | let size = f.size(); 131 | let w = size.width; 132 | let h = size.height; 133 | 134 | let block = Block::default() 135 | .borders(Borders::ALL) 136 | .title(Span::from("[ Set Flags ]")); 137 | 138 | let rows = vec![ 139 | Row::new(vec![ 140 | Cell::from(Span::styled( 141 | format!("Allow D[n]S",), 142 | Style::default().fg(Color::White), 143 | )), 144 | Cell::from(Span::styled( 145 | format!("{}", network.subtype_0.allow_dns.unwrap_or_default()), 146 | Style::default().fg(if network.subtype_0.allow_dns.unwrap_or_default() { 147 | Color::LightGreen 148 | } else { 149 | Color::LightRed 150 | }), 151 | )), 152 | ]), 153 | Row::new(vec![ 154 | Cell::from(Span::styled( 155 | format!("Allow [D]efault",), 156 | Style::default().fg(Color::White), 157 | )), 158 | Cell::from(Span::styled( 159 | format!("{}", network.subtype_0.allow_default.unwrap_or_default()), 160 | Style::default().fg(if network.subtype_0.allow_default.unwrap_or_default() { 161 | Color::LightGreen 162 | } else { 163 | Color::LightRed 164 | }), 165 | )), 166 | ]), 167 | Row::new(vec![ 168 | Cell::from(Span::styled( 169 | format!("Allow [M]anaged",), 170 | Style::default().fg(Color::White), 171 | )), 172 | Cell::from(Span::styled( 173 | format!("{}", network.subtype_0.allow_managed.unwrap_or_default()), 174 | Style::default().fg(if network.subtype_0.allow_managed.unwrap_or_default() { 175 | Color::LightGreen 176 | } else { 177 | Color::LightRed 178 | }), 179 | )), 180 | ]), 181 | Row::new(vec![ 182 | Cell::from(Span::styled( 183 | format!("Allow [G]lobal",), 184 | Style::default().fg(Color::White), 185 | )), 186 | Cell::from(Span::styled( 187 | format!("{}", network.subtype_0.allow_global.unwrap_or_default()), 188 | Style::default().fg(if network.subtype_0.allow_global.unwrap_or_default() { 189 | Color::LightGreen 190 | } else { 191 | Color::LightRed 192 | }), 193 | )), 194 | ]), 195 | ]; 196 | 197 | let table = Table::new(rows) 198 | .block(block) 199 | .widths(&[Constraint::Percentage(50), Constraint::Percentage(50)]); 200 | 201 | let mut rect = Rect::default(); 202 | rect.x = w / 4; 203 | rect.y = h / 4; 204 | rect.width = w / 2; 205 | rect.height = h / 2; 206 | f.render_widget(Clear, rect); 207 | f.render_widget(table, rect); 208 | } 209 | 210 | pub fn display_dialogs( 211 | f: &mut Frame<'_, B>, 212 | app: &mut App, 213 | settings: Arc>, 214 | ) { 215 | match app.dialog.clone() { 216 | Dialog::Join => { 217 | dialog_join(f, app); 218 | } 219 | Dialog::APIKey(_) => { 220 | dialog_api_key(f, app); 221 | } 222 | Dialog::Help => { 223 | dialog_help(f, settings.lock().unwrap().page.clone()); 224 | } 225 | Dialog::RenameMember(_, _) => { 226 | dialog_rename_member(f, app); 227 | } 228 | Dialog::AddMember(_) => { 229 | dialog_add_member(f, app); 230 | } 231 | Dialog::NetworkFlags(id) => { 232 | dialog_flags(f, app, settings.lock().unwrap().get(&id).unwrap().clone()); 233 | } 234 | _ => {} 235 | } 236 | } 237 | 238 | pub fn display_network( 239 | f: &mut Frame<'_, B>, 240 | app: &mut App, 241 | members: Vec, 242 | ) -> Result<(), anyhow::Error> { 243 | let list = Layout::default() 244 | .constraints([Constraint::Min(4)]) 245 | .split(f.size()); 246 | 247 | let titleblock = Block::default() 248 | .borders(Borders::ALL) 249 | .title("[ ZeroTier Terminal UI | Press h for Help ]"); 250 | 251 | let rows = members 252 | .iter() 253 | .map(|m| { 254 | let authed = m.config.clone().unwrap().authorized.unwrap_or_default(); 255 | let caps = m.config.clone().unwrap().capabilities.unwrap(); 256 | 257 | Row::new(vec![ 258 | Cell::from(Span::styled( 259 | m.node_id.clone().unwrap(), 260 | Style::default().fg(Color::Cyan), 261 | )), 262 | Cell::from(Span::styled( 263 | m.name.clone().unwrap(), 264 | Style::default().fg(Color::LightCyan), 265 | )), 266 | Cell::from(Span::styled( 267 | format!( 268 | "{}", 269 | fancy_duration::FancyDuration::new( 270 | OffsetDateTime::from(SystemTime::now()) 271 | - OffsetDateTime::UNIX_EPOCH 272 | .checked_add(Duration::new(m.last_online.unwrap() / 1000, 0)) 273 | .unwrap() 274 | ) 275 | .to_string() 276 | ), 277 | Style::default().fg(Color::LightCyan), 278 | )), 279 | Cell::from(Span::styled( 280 | m.config 281 | .clone() 282 | .unwrap() 283 | .ip_assignments 284 | .unwrap_or_default() 285 | .join(", "), 286 | Style::default().fg(Color::LightGreen), 287 | )), 288 | Cell::from(Span::styled( 289 | if authed { "Auth" } else { "Unauth" }, 290 | Style::default().fg(if authed { 291 | Color::LightGreen 292 | } else { 293 | Color::LightRed 294 | }), 295 | )), 296 | Cell::from(Span::styled( 297 | caps.iter() 298 | .map(|x| format!("{}", x)) 299 | .collect::>() 300 | .join(", "), 301 | Style::default().fg(Color::LightGreen), 302 | )), 303 | ]) 304 | }) 305 | .collect::>(); 306 | 307 | app.member_count = rows.len(); 308 | 309 | let table = Table::new(rows) 310 | .block(titleblock) 311 | .header(Row::new(vec![ 312 | Cell::from(Span::styled("Node ID", Style::default().fg(Color::White))), 313 | Cell::from(Span::styled("Name", Style::default().fg(Color::White))), 314 | Cell::from(Span::styled( 315 | "Last Online", 316 | Style::default().fg(Color::White), 317 | )), 318 | Cell::from(Span::styled( 319 | "IP Addresses", 320 | Style::default().fg(Color::White), 321 | )), 322 | Cell::from(Span::styled( 323 | "Auth Status", 324 | Style::default().fg(Color::White), 325 | )), 326 | Cell::from(Span::styled( 327 | "Capabilities", 328 | Style::default().fg(Color::White), 329 | )), 330 | ])) 331 | .widths(&[ 332 | Constraint::Length(12), 333 | Constraint::Length(20), 334 | Constraint::Length(25), 335 | Constraint::Length(25), 336 | Constraint::Length(8), 337 | Constraint::Length(15), 338 | ]) 339 | .highlight_style(Style::default().add_modifier(Modifier::BOLD)) 340 | .highlight_symbol("> "); 341 | 342 | f.render_stateful_widget(table, list[0], &mut app.member_state); 343 | Ok(()) 344 | } 345 | 346 | pub fn display_networks( 347 | f: &mut Frame<'_, B>, 348 | _app: &mut App, 349 | settings: Arc>, 350 | ) -> Result<(), anyhow::Error> { 351 | let list = Layout::default() 352 | .constraints([Constraint::Min(4)]) 353 | .split(f.size()); 354 | 355 | let titleblock = Block::default() 356 | .borders(Borders::ALL) 357 | .title("[ ZeroTier Terminal UI | Press h for Help ]"); 358 | 359 | let mut lock = settings.lock().unwrap(); 360 | 361 | let rows = lock 362 | .idx_iter() 363 | .filter_map(|k| { 364 | let v = match lock.get(k) { 365 | Some(v) => v, 366 | None => return None, 367 | }; 368 | 369 | if let ListFilter::Connected = lock.filter() { 370 | if v.subtype_1.status.clone().unwrap() == STATUS_DISCONNECTED { 371 | return None; 372 | } 373 | } 374 | 375 | Some(Row::new(vec![ 376 | Cell::from(Span::styled( 377 | k.clone(), 378 | Style::default().fg(Color::LightCyan), 379 | )), 380 | Cell::from(Span::styled( 381 | v.subtype_1.name.clone().unwrap_or_default(), 382 | Style::default().fg(Color::Cyan), 383 | )), 384 | Cell::from(Span::styled( 385 | v.subtype_1.status.clone().unwrap(), 386 | Style::default().fg(match v.subtype_1.status.clone().unwrap().as_str() { 387 | "OK" => Color::LightGreen, 388 | "REQUESTING_CONFIGURATION" => Color::LightYellow, 389 | STATUS_DISCONNECTED => Color::LightRed, 390 | _ => Color::LightRed, 391 | }), 392 | )), 393 | Cell::from(Span::styled( 394 | v.subtype_1.assigned_addresses.join(", "), 395 | Style::default().fg(Color::LightGreen), 396 | )), 397 | Cell::from(Span::styled( 398 | if let Some(s) = lock 399 | .nets 400 | .clone() 401 | .get_usage(v.subtype_1.port_device_name.clone().unwrap()) 402 | { 403 | s 404 | } else { 405 | "".to_string() 406 | }, 407 | Style::default().fg(Color::LightMagenta), 408 | )), 409 | ])) 410 | }) 411 | .collect::>(); 412 | 413 | if lock.network_state.selected().is_none() && rows.len() > 0 { 414 | lock.network_state.select(Some(0)); 415 | } 416 | 417 | let table = Table::new(rows) 418 | .block(titleblock) 419 | .header(Row::new(vec![ 420 | Cell::from(Span::styled( 421 | "Network ID", 422 | Style::default().fg(Color::White), 423 | )), 424 | Cell::from(Span::styled("Name", Style::default().fg(Color::White))), 425 | Cell::from(Span::styled("Status", Style::default().fg(Color::White))), 426 | Cell::from(Span::styled( 427 | "Assigned IPs", 428 | Style::default().fg(Color::White), 429 | )), 430 | Cell::from(Span::styled("Usage", Style::default().fg(Color::White))), 431 | ])) 432 | .widths(&[ 433 | Constraint::Length(16), 434 | Constraint::Length(20), 435 | Constraint::Length(15), 436 | Constraint::Length(20), 437 | Constraint::Length(35), 438 | ]) 439 | .highlight_style(Style::default().add_modifier(Modifier::BOLD)) 440 | .highlight_symbol("> "); 441 | 442 | f.render_stateful_widget(table, list[0], &mut lock.network_state); 443 | Ok(()) 444 | } 445 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | sync::{Arc, Mutex}, 3 | time::Duration, 4 | }; 5 | 6 | use app::Page; 7 | use client::central_client; 8 | use tui::widgets::TableState; 9 | 10 | use crate::{ 11 | config::{config_path, Settings}, 12 | terminal::deinit_terminal, 13 | }; 14 | 15 | mod app; 16 | mod client; 17 | mod config; 18 | mod display; 19 | mod nets; 20 | mod terminal; 21 | 22 | fn main() -> Result<(), anyhow::Error> { 23 | client::local_client_from_file(client::authtoken_path(None)).expect( 24 | "must be able to read the authtoken.secret file in the zerotier configuration directory", 25 | ); 26 | 27 | let mut terminal = terminal::init_terminal()?; 28 | 29 | let mut app = app::App::default(); 30 | std::fs::create_dir_all(config_path())?; 31 | let settings = Arc::new(Mutex::new(match Settings::from_dir(config_path()) { 32 | Ok(c) => c, 33 | Err(_) => Settings::default(), 34 | })); 35 | 36 | terminal.clear()?; 37 | eprintln!("Polling ZeroTier for network information..."); 38 | 39 | let s = settings.clone(); 40 | std::thread::spawn(move || start_supervisors(s)); 41 | let res = app.run(&mut terminal, settings.clone()); 42 | 43 | settings.lock().unwrap().to_file(config_path())?; 44 | deinit_terminal(terminal)?; 45 | 46 | res 47 | } 48 | 49 | fn start_supervisors(settings: Arc>) { 50 | loop { 51 | let mut lock = settings.lock().unwrap(); 52 | match lock.page.clone() { 53 | Page::Networks => { 54 | let networks = crate::client::sync_get_networks().unwrap(); 55 | lock.nets.refresh().unwrap(); 56 | if lock.update_networks(networks).unwrap() { 57 | lock.network_state = TableState::default(); 58 | }; 59 | } 60 | Page::Network(id) => { 61 | if let Some(key) = lock.api_key_for_id(id.clone()) { 62 | let client = central_client(key.to_string()).unwrap(); 63 | match crate::client::sync_get_members(client, id.clone()) { 64 | Ok(members) => { 65 | lock.members.insert(id.clone(), members); 66 | } 67 | Err(e) => { 68 | lock.last_error = Some(e.to_string()); 69 | } 70 | } 71 | } 72 | } 73 | } 74 | 75 | drop(lock); 76 | 77 | std::thread::sleep(Duration::new(3, 0)); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/nets.rs: -------------------------------------------------------------------------------- 1 | use std::{collections::HashMap, time::Instant}; 2 | 3 | use sys_metrics::network::IoNet; 4 | 5 | #[derive(Clone, Debug)] 6 | pub struct Nets { 7 | nets: Vec, 8 | last_usage: HashMap>, 9 | } 10 | 11 | impl Default for Nets { 12 | fn default() -> Self { 13 | Self { 14 | nets: sys_metrics::network::get_ionets().unwrap(), 15 | last_usage: HashMap::new(), 16 | } 17 | } 18 | } 19 | 20 | impl Nets { 21 | pub fn new() -> Result { 22 | Ok(Self { 23 | last_usage: HashMap::new(), 24 | nets: sys_metrics::network::get_ionets()?, 25 | }) 26 | } 27 | 28 | #[allow(unused)] 29 | pub fn len(&self) -> usize { 30 | self.nets.len() 31 | } 32 | 33 | pub fn refresh(&mut self) -> Result<(), anyhow::Error> { 34 | self.nets = sys_metrics::network::get_ionets()?; 35 | Ok(()) 36 | } 37 | 38 | pub fn find_by_interface(&self, interface: String) -> Option { 39 | for net in &self.nets { 40 | if interface == net.interface { 41 | return Some(net.clone()); 42 | } 43 | } 44 | 45 | None 46 | } 47 | 48 | pub fn store_usage(&mut self, interface: String) { 49 | if let Some(net) = self.find_by_interface(interface.clone()) { 50 | if let Some(v) = self.last_usage.get_mut(&interface) { 51 | v.push((net.rx_bytes as u128, net.tx_bytes as u128, Instant::now())); 52 | if v.len() > 2 { 53 | let v2 = v 54 | .iter() 55 | .skip(v.len() - 3) 56 | .map(|k| *k) 57 | .collect::>(); 58 | self.last_usage.insert(net.interface.clone(), v2); 59 | } 60 | } else { 61 | self.last_usage.insert( 62 | net.interface.clone(), 63 | vec![(net.rx_bytes as u128, net.tx_bytes as u128, Instant::now())], 64 | ); 65 | } 66 | } 67 | } 68 | 69 | pub fn get_usage(&mut self, interface: String) -> Option { 70 | if let Some(s) = self.last_usage.get_mut(&interface) { 71 | if s.len() < 2 { 72 | return None; 73 | } else { 74 | let len = s.len(); 75 | let mut i = s.iter(); 76 | let first = i.nth(len - 2).unwrap(); 77 | let mut i = s.iter(); 78 | let second = i.nth(len - 1).unwrap(); 79 | 80 | let elapsed = second.2.duration_since(first.2).as_millis() as f64 / 1000 as f64; 81 | let mut rx_bytes: f64 = second.0 as f64 - first.0 as f64; 82 | let mut tx_bytes: f64 = second.1 as f64 - first.1 as f64; 83 | 84 | if elapsed > 1.0 { 85 | rx_bytes /= elapsed; 86 | tx_bytes /= elapsed; 87 | } else { 88 | rx_bytes *= 1.0 + (1.0 - elapsed); 89 | tx_bytes *= 1.0 + (1.0 - elapsed); 90 | } 91 | 92 | Some(format!( 93 | "Rx: {}/s | Tx: {}/s", 94 | byte_unit::Byte::from_bytes(rx_bytes as u128) 95 | .get_appropriate_unit(true) 96 | .to_string(), 97 | byte_unit::Byte::from_bytes(tx_bytes as u128) 98 | .get_appropriate_unit(true) 99 | .to_string(), 100 | )) 101 | } 102 | } else { 103 | None 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/terminal.rs: -------------------------------------------------------------------------------- 1 | use std::io::Write; 2 | 3 | use crossterm::{ 4 | execute, 5 | terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, 6 | }; 7 | use tui::{backend::CrosstermBackend, Terminal}; 8 | 9 | pub fn init_terminal() -> std::io::Result>> { 10 | enable_raw_mode()?; 11 | let mut stdout = std::io::stdout(); 12 | execute!(stdout, EnterAlternateScreen)?; 13 | let backend = CrosstermBackend::new(stdout); 14 | 15 | Ok(Terminal::new(backend)?) 16 | } 17 | 18 | pub fn deinit_terminal( 19 | mut terminal: Terminal>, 20 | ) -> std::io::Result<()> { 21 | disable_raw_mode()?; 22 | execute!(terminal.backend_mut(), LeaveAlternateScreen)?; 23 | terminal.show_cursor()?; 24 | Ok(()) 25 | } 26 | 27 | #[macro_export] 28 | macro_rules! temp_mute_terminal { 29 | ($terminal:expr, $code:block) => { 30 | disable_raw_mode()?; 31 | execute!($terminal.backend_mut(), LeaveAlternateScreen)?; 32 | $terminal.show_cursor()?; 33 | $code(); 34 | enable_raw_mode()?; 35 | execute!($terminal.backend_mut(), EnterAlternateScreen)?; 36 | $terminal.hide_cursor()?; 37 | $terminal.clear()?; 38 | }; 39 | } 40 | --------------------------------------------------------------------------------