├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── dedock ├── Cargo.toml └── src └── main.rs /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 = "anstream" 7 | version = "0.3.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" 10 | dependencies = [ 11 | "anstyle", 12 | "anstyle-parse", 13 | "anstyle-query", 14 | "anstyle-wincon", 15 | "colorchoice", 16 | "is-terminal", 17 | "utf8parse", 18 | ] 19 | 20 | [[package]] 21 | name = "anstyle" 22 | version = "1.0.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" 25 | 26 | [[package]] 27 | name = "anstyle-parse" 28 | version = "0.2.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" 31 | dependencies = [ 32 | "utf8parse", 33 | ] 34 | 35 | [[package]] 36 | name = "anstyle-query" 37 | version = "1.0.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" 40 | dependencies = [ 41 | "windows-sys 0.48.0", 42 | ] 43 | 44 | [[package]] 45 | name = "anstyle-wincon" 46 | version = "1.0.1" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" 49 | dependencies = [ 50 | "anstyle", 51 | "windows-sys 0.48.0", 52 | ] 53 | 54 | [[package]] 55 | name = "autocfg" 56 | version = "1.1.0" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 59 | 60 | [[package]] 61 | name = "bitflags" 62 | version = "1.3.2" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 65 | 66 | [[package]] 67 | name = "bytes" 68 | version = "1.4.0" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 71 | 72 | [[package]] 73 | name = "cc" 74 | version = "1.0.79" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 77 | 78 | [[package]] 79 | name = "cfg-if" 80 | version = "1.0.0" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 83 | 84 | [[package]] 85 | name = "clap" 86 | version = "4.3.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" 89 | dependencies = [ 90 | "clap_builder", 91 | "clap_derive", 92 | "once_cell", 93 | ] 94 | 95 | [[package]] 96 | name = "clap_builder" 97 | version = "4.3.0" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" 100 | dependencies = [ 101 | "anstream", 102 | "anstyle", 103 | "bitflags", 104 | "clap_lex", 105 | "strsim", 106 | ] 107 | 108 | [[package]] 109 | name = "clap_derive" 110 | version = "4.3.0" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" 113 | dependencies = [ 114 | "heck", 115 | "proc-macro2", 116 | "quote", 117 | "syn", 118 | ] 119 | 120 | [[package]] 121 | name = "clap_lex" 122 | version = "0.5.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" 125 | 126 | [[package]] 127 | name = "colorchoice" 128 | version = "1.0.0" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 131 | 132 | [[package]] 133 | name = "dedock" 134 | version = "0.1.0" 135 | dependencies = [ 136 | "clap", 137 | "libc", 138 | "nix", 139 | "tokio", 140 | ] 141 | 142 | [[package]] 143 | name = "errno" 144 | version = "0.3.1" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 147 | dependencies = [ 148 | "errno-dragonfly", 149 | "libc", 150 | "windows-sys 0.48.0", 151 | ] 152 | 153 | [[package]] 154 | name = "errno-dragonfly" 155 | version = "0.1.2" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 158 | dependencies = [ 159 | "cc", 160 | "libc", 161 | ] 162 | 163 | [[package]] 164 | name = "heck" 165 | version = "0.4.1" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 168 | 169 | [[package]] 170 | name = "hermit-abi" 171 | version = "0.2.6" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 174 | dependencies = [ 175 | "libc", 176 | ] 177 | 178 | [[package]] 179 | name = "hermit-abi" 180 | version = "0.3.1" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 183 | 184 | [[package]] 185 | name = "io-lifetimes" 186 | version = "1.0.10" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" 189 | dependencies = [ 190 | "hermit-abi 0.3.1", 191 | "libc", 192 | "windows-sys 0.48.0", 193 | ] 194 | 195 | [[package]] 196 | name = "is-terminal" 197 | version = "0.4.7" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" 200 | dependencies = [ 201 | "hermit-abi 0.3.1", 202 | "io-lifetimes", 203 | "rustix", 204 | "windows-sys 0.48.0", 205 | ] 206 | 207 | [[package]] 208 | name = "libc" 209 | version = "0.2.144" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" 212 | 213 | [[package]] 214 | name = "linux-raw-sys" 215 | version = "0.3.8" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" 218 | 219 | [[package]] 220 | name = "lock_api" 221 | version = "0.4.9" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 224 | dependencies = [ 225 | "autocfg", 226 | "scopeguard", 227 | ] 228 | 229 | [[package]] 230 | name = "log" 231 | version = "0.4.17" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 234 | dependencies = [ 235 | "cfg-if", 236 | ] 237 | 238 | [[package]] 239 | name = "memoffset" 240 | version = "0.7.1" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" 243 | dependencies = [ 244 | "autocfg", 245 | ] 246 | 247 | [[package]] 248 | name = "mio" 249 | version = "0.8.6" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" 252 | dependencies = [ 253 | "libc", 254 | "log", 255 | "wasi", 256 | "windows-sys 0.45.0", 257 | ] 258 | 259 | [[package]] 260 | name = "nix" 261 | version = "0.26.2" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" 264 | dependencies = [ 265 | "bitflags", 266 | "cfg-if", 267 | "libc", 268 | "memoffset", 269 | "pin-utils", 270 | "static_assertions", 271 | ] 272 | 273 | [[package]] 274 | name = "num_cpus" 275 | version = "1.15.0" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 278 | dependencies = [ 279 | "hermit-abi 0.2.6", 280 | "libc", 281 | ] 282 | 283 | [[package]] 284 | name = "once_cell" 285 | version = "1.17.1" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 288 | 289 | [[package]] 290 | name = "parking_lot" 291 | version = "0.12.1" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 294 | dependencies = [ 295 | "lock_api", 296 | "parking_lot_core", 297 | ] 298 | 299 | [[package]] 300 | name = "parking_lot_core" 301 | version = "0.9.7" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" 304 | dependencies = [ 305 | "cfg-if", 306 | "libc", 307 | "redox_syscall", 308 | "smallvec", 309 | "windows-sys 0.45.0", 310 | ] 311 | 312 | [[package]] 313 | name = "pin-project-lite" 314 | version = "0.2.9" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 317 | 318 | [[package]] 319 | name = "pin-utils" 320 | version = "0.1.0" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 323 | 324 | [[package]] 325 | name = "proc-macro2" 326 | version = "1.0.58" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" 329 | dependencies = [ 330 | "unicode-ident", 331 | ] 332 | 333 | [[package]] 334 | name = "quote" 335 | version = "1.0.27" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" 338 | dependencies = [ 339 | "proc-macro2", 340 | ] 341 | 342 | [[package]] 343 | name = "redox_syscall" 344 | version = "0.2.16" 345 | source = "registry+https://github.com/rust-lang/crates.io-index" 346 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 347 | dependencies = [ 348 | "bitflags", 349 | ] 350 | 351 | [[package]] 352 | name = "rustix" 353 | version = "0.37.19" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" 356 | dependencies = [ 357 | "bitflags", 358 | "errno", 359 | "io-lifetimes", 360 | "libc", 361 | "linux-raw-sys", 362 | "windows-sys 0.48.0", 363 | ] 364 | 365 | [[package]] 366 | name = "scopeguard" 367 | version = "1.1.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 370 | 371 | [[package]] 372 | name = "signal-hook-registry" 373 | version = "1.4.1" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 376 | dependencies = [ 377 | "libc", 378 | ] 379 | 380 | [[package]] 381 | name = "smallvec" 382 | version = "1.10.0" 383 | source = "registry+https://github.com/rust-lang/crates.io-index" 384 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 385 | 386 | [[package]] 387 | name = "socket2" 388 | version = "0.4.9" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 391 | dependencies = [ 392 | "libc", 393 | "winapi", 394 | ] 395 | 396 | [[package]] 397 | name = "static_assertions" 398 | version = "1.1.0" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 401 | 402 | [[package]] 403 | name = "strsim" 404 | version = "0.10.0" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 407 | 408 | [[package]] 409 | name = "syn" 410 | version = "2.0.16" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" 413 | dependencies = [ 414 | "proc-macro2", 415 | "quote", 416 | "unicode-ident", 417 | ] 418 | 419 | [[package]] 420 | name = "tokio" 421 | version = "1.28.1" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" 424 | dependencies = [ 425 | "autocfg", 426 | "bytes", 427 | "libc", 428 | "mio", 429 | "num_cpus", 430 | "parking_lot", 431 | "pin-project-lite", 432 | "signal-hook-registry", 433 | "socket2", 434 | "tokio-macros", 435 | "windows-sys 0.48.0", 436 | ] 437 | 438 | [[package]] 439 | name = "tokio-macros" 440 | version = "2.1.0" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 443 | dependencies = [ 444 | "proc-macro2", 445 | "quote", 446 | "syn", 447 | ] 448 | 449 | [[package]] 450 | name = "unicode-ident" 451 | version = "1.0.8" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 454 | 455 | [[package]] 456 | name = "utf8parse" 457 | version = "0.2.1" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 460 | 461 | [[package]] 462 | name = "wasi" 463 | version = "0.11.0+wasi-snapshot-preview1" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 466 | 467 | [[package]] 468 | name = "winapi" 469 | version = "0.3.9" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 472 | dependencies = [ 473 | "winapi-i686-pc-windows-gnu", 474 | "winapi-x86_64-pc-windows-gnu", 475 | ] 476 | 477 | [[package]] 478 | name = "winapi-i686-pc-windows-gnu" 479 | version = "0.4.0" 480 | source = "registry+https://github.com/rust-lang/crates.io-index" 481 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 482 | 483 | [[package]] 484 | name = "winapi-x86_64-pc-windows-gnu" 485 | version = "0.4.0" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 488 | 489 | [[package]] 490 | name = "windows-sys" 491 | version = "0.45.0" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 494 | dependencies = [ 495 | "windows-targets 0.42.2", 496 | ] 497 | 498 | [[package]] 499 | name = "windows-sys" 500 | version = "0.48.0" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 503 | dependencies = [ 504 | "windows-targets 0.48.0", 505 | ] 506 | 507 | [[package]] 508 | name = "windows-targets" 509 | version = "0.42.2" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 512 | dependencies = [ 513 | "windows_aarch64_gnullvm 0.42.2", 514 | "windows_aarch64_msvc 0.42.2", 515 | "windows_i686_gnu 0.42.2", 516 | "windows_i686_msvc 0.42.2", 517 | "windows_x86_64_gnu 0.42.2", 518 | "windows_x86_64_gnullvm 0.42.2", 519 | "windows_x86_64_msvc 0.42.2", 520 | ] 521 | 522 | [[package]] 523 | name = "windows-targets" 524 | version = "0.48.0" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 527 | dependencies = [ 528 | "windows_aarch64_gnullvm 0.48.0", 529 | "windows_aarch64_msvc 0.48.0", 530 | "windows_i686_gnu 0.48.0", 531 | "windows_i686_msvc 0.48.0", 532 | "windows_x86_64_gnu 0.48.0", 533 | "windows_x86_64_gnullvm 0.48.0", 534 | "windows_x86_64_msvc 0.48.0", 535 | ] 536 | 537 | [[package]] 538 | name = "windows_aarch64_gnullvm" 539 | version = "0.42.2" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 542 | 543 | [[package]] 544 | name = "windows_aarch64_gnullvm" 545 | version = "0.48.0" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 548 | 549 | [[package]] 550 | name = "windows_aarch64_msvc" 551 | version = "0.42.2" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 554 | 555 | [[package]] 556 | name = "windows_aarch64_msvc" 557 | version = "0.48.0" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 560 | 561 | [[package]] 562 | name = "windows_i686_gnu" 563 | version = "0.42.2" 564 | source = "registry+https://github.com/rust-lang/crates.io-index" 565 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 566 | 567 | [[package]] 568 | name = "windows_i686_gnu" 569 | version = "0.48.0" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 572 | 573 | [[package]] 574 | name = "windows_i686_msvc" 575 | version = "0.42.2" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 578 | 579 | [[package]] 580 | name = "windows_i686_msvc" 581 | version = "0.48.0" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 584 | 585 | [[package]] 586 | name = "windows_x86_64_gnu" 587 | version = "0.42.2" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 590 | 591 | [[package]] 592 | name = "windows_x86_64_gnu" 593 | version = "0.48.0" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 596 | 597 | [[package]] 598 | name = "windows_x86_64_gnullvm" 599 | version = "0.42.2" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 602 | 603 | [[package]] 604 | name = "windows_x86_64_gnullvm" 605 | version = "0.48.0" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 608 | 609 | [[package]] 610 | name = "windows_x86_64_msvc" 611 | version = "0.42.2" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 614 | 615 | [[package]] 616 | name = "windows_x86_64_msvc" 617 | version = "0.48.0" 618 | source = "registry+https://github.com/rust-lang/crates.io-index" 619 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 620 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | members = [ 4 | "dedock", 5 | ] 6 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dedock 2 | 3 | > NOTICE: `dedock` is highly experimental and should not be used in production 4 | > environments. Expect rapid iteration and breaking changes. 5 | 6 | `dedock` is a ~container~ runtime, with a particular focus on enabling embedded 7 | software development across all platforms. It supports native "containers" on 8 | both Linux and macOS. 9 | 10 | ## How It Works 11 | 12 | `dedock` is not a container runtime in that it does not provide meaningful 13 | isolation from a security perspective and is not compliant with the [OCI Runtime 14 | Specification](https://github.com/opencontainers/runtime-spec). The primary 15 | purpose of `dedock` is to enable the distribution of portable development 16 | environments. It does so by partially adopting [OCI 17 | images](https://github.com/opencontainers/image-spec) to distribute filesystem 18 | bundles with tooling and dependencies pre-installed. 19 | 20 | `dedock` uses [`chroot(1)`](https://linux.die.net/man/1/chroot) on Linux and 21 | macOS to isolate the filesystem of the "containers" it runs. Because no other 22 | isolation is employed, executables in the filesystem run natively on the host 23 | machine, meaning that there is no virtualization layer, even when running on 24 | macOS. As such, separate images must be built for macOS (Darwin) and Linux. 25 | 26 | ## Status 27 | 28 | `dedock` is very much in the technical demo stage and should not be relied upon 29 | for critical operations. The initial motivation for the project was to allow for 30 | developers to build, flash, and debug software on embedded devices attached to a 31 | host machine. As such, there are a number of defaults that would not make sense 32 | for general usage, including always running with `stdout` / `stdin` / `stdout` 33 | attached to a pseudoterminal and always mounting `/dev`. 34 | 35 | The future of the project is very much dependant on feedback from community 36 | members, but the following goals are presently in scope for `dedock`: 37 | 38 | - Providing more options for configuration. 39 | - Supporting rootless containers. 40 | - Running on Windows. 41 | - Maintaining a set of useful base images. 42 | - Offering image build tooling. 43 | 44 | ## License 45 | 46 | Licensed under either of 47 | 48 | * Apache License, Version 2.0 49 | ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 50 | * MIT license 51 | ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 52 | 53 | at your option. 54 | 55 | ## Contribution 56 | 57 | Unless you explicitly state otherwise, any contribution intentionally submitted 58 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 59 | dual licensed as above, without any additional terms or conditions. 60 | -------------------------------------------------------------------------------- /dedock/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dedock" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | clap = { version = "4.3.0", features = ["derive"] } 8 | tokio = { version = "1", features = ["full"] } 9 | nix = "0.26" 10 | libc = "0.2" 11 | -------------------------------------------------------------------------------- /dedock/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::{Parser, Subcommand}; 2 | #[cfg(target_os = "linux")] 3 | use nix::mount::{mount, umount, MsFlags}; 4 | use nix::sys::stat::Mode; 5 | use nix::{ 6 | fcntl::{open, OFlag}, 7 | unistd::setsid, 8 | }; 9 | use std::os::fd::FromRawFd; 10 | use std::os::unix::fs; 11 | use std::path::Path; 12 | use std::process::Command; 13 | use std::{ 14 | env::current_exe, 15 | io::{self, copy}, 16 | }; 17 | use std::{ffi::CStr, fs::File}; 18 | use std::{os::unix::process::CommandExt, process::Stdio}; 19 | 20 | /// dedock is not a container runtime. 21 | #[derive(Parser, Debug)] 22 | #[command(author, version, about, long_about = None)] 23 | #[command(propagate_version = true)] 24 | struct Dedock { 25 | #[command(subcommand)] 26 | command: Commands, 27 | } 28 | 29 | #[derive(Subcommand, Debug)] 30 | enum Commands { 31 | Run { 32 | /// Directory to use for container filesystem root. 33 | #[arg(default_value_t = String::from("./container"))] 34 | root: String, 35 | }, 36 | Fork { 37 | /// File descriptor for tty. 38 | tty: String, 39 | /// Directory to use for container filesystem root. 40 | root: String, 41 | /// The command to execute after chroot. 42 | cmd: String, 43 | }, 44 | } 45 | 46 | #[tokio::main] 47 | async fn main() -> Result<(), Box> { 48 | let dedock = Dedock::parse(); 49 | match &dedock.command { 50 | Commands::Run { root } => { 51 | let pty_fd = unsafe { libc::posix_openpt(libc::O_RDWR) }; 52 | 53 | if pty_fd < 0 { 54 | panic!("failed to open pty"); 55 | } 56 | 57 | let err = unsafe { libc::grantpt(pty_fd) }; 58 | if err < 0 { 59 | panic!("failed to grantpt"); 60 | } 61 | let err = unsafe { libc::unlockpt(pty_fd) }; 62 | if err < 0 { 63 | panic!("failed to grantpt"); 64 | } 65 | 66 | // TODO(hasheddan): consider using ptsname_r on Linux systems. 67 | let ret = unsafe { libc::ptsname(pty_fd) }; 68 | if ret.is_null() { 69 | panic!("failed to get ptsname"); 70 | } 71 | let tty = unsafe { CStr::from_ptr(ret) }.to_string_lossy(); 72 | 73 | // Get current executable. 74 | let exe_path = current_exe().unwrap(); 75 | let exe = exe_path.to_str().unwrap(); 76 | 77 | let mut child = Command::new(exe); 78 | child.args(["fork", &tty, root, "/bin/bash"]); 79 | 80 | let pty_fd_clone = unsafe { libc::fcntl(pty_fd, libc::F_DUPFD, pty_fd) }; 81 | if pty_fd_clone < 0 { 82 | panic!("failed clone"); 83 | } 84 | let mut pty_read = unsafe { File::from_raw_fd(pty_fd) }; 85 | let mut pty_write = unsafe { File::from_raw_fd(pty_fd_clone) }; 86 | // TODO(hasheddan): use a more robust reading / writing strategy. 87 | let writer = tokio::spawn(async move { 88 | copy(&mut io::stdin(), &mut pty_write); 89 | }); 90 | 91 | // Mount /dev. 92 | let p = Path::new(root).join("dev"); 93 | const NONE: Option<&'static [u8]> = None; 94 | 95 | // On macOS we call mount as a subcommand to mount devfs. 96 | #[cfg(target_os = "macos")] 97 | Command::new("mount") 98 | .args(["-t", "devfs", "devfs", p.to_str().unwrap()]) 99 | .output()?; 100 | 101 | // On Linux we bind mount /dev. 102 | #[cfg(target_os = "linux")] 103 | mount( 104 | Some(Path::new("/dev")), 105 | p.as_path(), 106 | NONE, 107 | MsFlags::MS_BIND, 108 | NONE, 109 | )?; 110 | 111 | // Start runner. stdin, stdout, stderr are inherited by default. 112 | let mut runner = child.spawn().unwrap(); 113 | 114 | let reader = tokio::spawn(async move { 115 | // Use our own stdout because io::stdout is buffered. 116 | let mut std = unsafe { File::from_raw_fd(1) }; 117 | copy(&mut pty_read, &mut std); 118 | }); 119 | 120 | let out = runner.wait()?; 121 | 122 | if !out.success() { 123 | println!("Container exited unsuccessfully."); 124 | } 125 | 126 | // Unmount /dev. 127 | #[cfg(target_os = "macos")] 128 | Command::new("unmount").arg(p.to_str().unwrap()).output()?; 129 | #[cfg(target_os = "linux")] 130 | umount(p.as_path())?; 131 | tokio::join!(writer, reader); 132 | } 133 | Commands::Fork { tty, root, cmd } => { 134 | let tty_fd = open(Path::new(&tty), OFlag::O_RDWR, Mode::empty())?; 135 | unsafe { 136 | let mut termios = core::mem::MaybeUninit::uninit(); 137 | let res = libc::tcgetattr(tty_fd, termios.as_mut_ptr()); 138 | if res < 0 { 139 | panic!("failed to get tty attributes"); 140 | } 141 | let mut termios = termios.assume_init(); 142 | libc::cfmakeraw(&mut termios); 143 | libc::tcsetattr(tty_fd, libc::TCSANOW, &termios); 144 | }; 145 | let mut cmd = Command::new(cmd); 146 | unsafe { 147 | cmd.pre_exec(move || { 148 | setsid().unwrap(); 149 | #[cfg(target_os = "macos")] 150 | let tiocsctty: u64 = libc::TIOCSCTTY.into(); 151 | #[cfg(target_os = "linux")] 152 | let tiocsctty = libc::TIOCSCTTY; 153 | let errno = libc::ioctl(tty_fd, tiocsctty, 1); 154 | if errno == -1 { 155 | panic!("failed to set controlling terminal") 156 | } 157 | Ok(()) 158 | }) 159 | }; 160 | cmd.stdout(unsafe { Stdio::from_raw_fd(tty_fd) }); 161 | cmd.stderr(unsafe { Stdio::from_raw_fd(tty_fd) }); 162 | cmd.stdin(unsafe { Stdio::from_raw_fd(tty_fd) }); 163 | fs::chroot(root)?; 164 | std::env::set_current_dir("/")?; 165 | cmd.output()?; 166 | } 167 | } 168 | Ok(()) 169 | } 170 | --------------------------------------------------------------------------------