workspace и reboot-модуль: второй продакшн бинарь и упаковка
This commit is contained in:
Generated
+863
@@ -0,0 +1,863 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aho-corasick"
|
||||||
|
version = "1.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"once_cell_polyfill",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.102"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "awg2-harness"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"chrono",
|
||||||
|
"clap",
|
||||||
|
"rand",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"toml",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "awg2-reboot-scheduler"
|
||||||
|
version = "0.2.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"chrono",
|
||||||
|
"clap",
|
||||||
|
"rand",
|
||||||
|
"serde",
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.20.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.62"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
|
||||||
|
dependencies = [
|
||||||
|
"find-msvc-tools",
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
|
||||||
|
dependencies = [
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
"clap_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_derive"
|
||||||
|
version = "4.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "equivalent"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "find-msvc-tools"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"pin-project-lite",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.17.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.65"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
||||||
|
dependencies = [
|
||||||
|
"equivalent",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.98"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"futures-util",
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.186"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matchers"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
|
||||||
|
dependencies = [
|
||||||
|
"regex-automata",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nu-ansi-term"
|
||||||
|
version = "0.50.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.21.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.106"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.45"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-automata"
|
||||||
|
version = "0.4.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.8.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_core"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.149"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"memchr",
|
||||||
|
"serde",
|
||||||
|
"serde_core",
|
||||||
|
"zmij",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_spanned"
|
||||||
|
version = "0.6.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sharded-slab"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "1.15.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.117"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "2.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "2.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thread_local"
|
||||||
|
version = "1.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.8.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_edit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_datetime"
|
||||||
|
version = "0.6.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_edit"
|
||||||
|
version = "0.22.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_write",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_write"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing"
|
||||||
|
version = "0.1.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||||
|
dependencies = [
|
||||||
|
"pin-project-lite",
|
||||||
|
"tracing-attributes",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-attributes"
|
||||||
|
version = "0.1.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.36"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"valuable",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-log"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-subscriber"
|
||||||
|
version = "0.3.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
|
||||||
|
dependencies = [
|
||||||
|
"matchers",
|
||||||
|
"nu-ansi-term",
|
||||||
|
"once_cell",
|
||||||
|
"regex-automata",
|
||||||
|
"sharded-slab",
|
||||||
|
"smallvec",
|
||||||
|
"thread_local",
|
||||||
|
"tracing",
|
||||||
|
"tracing-core",
|
||||||
|
"tracing-log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.24"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "valuable"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.1+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"once_cell",
|
||||||
|
"rustversion",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.121"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.62.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-implement",
|
||||||
|
"windows-interface",
|
||||||
|
"windows-link",
|
||||||
|
"windows-result",
|
||||||
|
"windows-strings",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-implement"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-interface"
|
||||||
|
version = "0.59.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-result"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.61.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winnow"
|
||||||
|
version = "0.7.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.48"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.8.48"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zmij"
|
||||||
|
version = "1.0.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"traffic_core",
|
||||||
|
"reboot_module",
|
||||||
|
]
|
||||||
|
resolver = "3"
|
||||||
|
|
||||||
@@ -10,15 +10,15 @@
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
AWG2_harness/
|
AWG2_harness/
|
||||||
├── Amnezia limits (old bash)/ # historical reference only (не часть production path)
|
├── Amnezia limits (old bash)/ # production reference behavior
|
||||||
├── reboot_module/ # archived legacy module (не часть production path)
|
├── reboot_module/ # production auxiliary binary: awg2-reboot-scheduler
|
||||||
├── traffic_core/ # целевая зона для Rust traffic/orchestrator логики
|
├── traffic_core/ # целевая зона для Rust traffic/orchestrator логики
|
||||||
└── docs/ # документация по миграции, архитектуре и эксплуатации
|
└── docs/ # документация по миграции, архитектуре и эксплуатации
|
||||||
```
|
```
|
||||||
|
|
||||||
Production reboot path — только встроенный scheduler в [`traffic_core/src/reboot.rs`](traffic_core/src/reboot.rs).
|
Production reboot path — внешний scheduler service [`awg2-reboot-scheduler.service`](awg2-reboot-scheduler.service).
|
||||||
|
|
||||||
Важно: ничего из legacy-деревьев не устанавливается, не вызывается и не требуется для runtime пути `awg2-harness`.
|
Важно: `Amnezia limits (old bash)` используется как эталон production-поведения, а `reboot_module` ставится как второй production-бинарь.
|
||||||
|
|
||||||
## Production deployment model
|
## Production deployment model
|
||||||
|
|
||||||
@@ -48,13 +48,15 @@ apt install ./awg2-harness_*_amd64.deb
|
|||||||
install -d -m 0755 /etc/awg2-harness
|
install -d -m 0755 /etc/awg2-harness
|
||||||
install -m 0644 /root/awg2-harness.config.toml /etc/awg2-harness/config.toml
|
install -m 0644 /root/awg2-harness.config.toml /etc/awg2-harness/config.toml
|
||||||
awg2-harness validate-config --config /etc/awg2-harness/config.toml
|
awg2-harness validate-config --config /etc/awg2-harness/config.toml
|
||||||
|
awg2-harness validate-runtime --config /etc/awg2-harness/config.toml
|
||||||
awg2-harness apply-limits --config /etc/awg2-harness/config.toml
|
awg2-harness apply-limits --config /etc/awg2-harness/config.toml
|
||||||
awg2-harness apply-firewall --config /etc/awg2-harness/config.toml
|
awg2-harness apply-firewall --config /etc/awg2-harness/config.toml
|
||||||
awg2-harness status --config /etc/awg2-harness/config.toml
|
awg2-harness status --config /etc/awg2-harness/config.toml
|
||||||
systemctl enable --now awg2-harness.service
|
systemctl enable --now awg2-harness.service
|
||||||
|
systemctl enable --now awg2-reboot-scheduler.service
|
||||||
```
|
```
|
||||||
|
|
||||||
Ничего из [`Amnezia limits (old bash)/`](Amnezia%20limits%20(old%20bash)/) и [`reboot_module/`](reboot_module/) не запускается в production-пути.
|
В production запускаются оба сервиса: [`awg2-harness.service`](awg2-harness.service) и [`awg2-reboot-scheduler.service`](awg2-reboot-scheduler.service).
|
||||||
|
|
||||||
Основная документация:
|
Основная документация:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=AWG2 Harness reboot scheduler
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
ExecStart=/usr/sbin/awg2-reboot-scheduler --config /etc/awg2-harness/config.toml
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=60
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
@@ -412,13 +412,13 @@ The old status banner “system ready” is not enough. Rust status must be fals
|
|||||||
|
|
||||||
## 16. Reboot module integration
|
## 16. Reboot module integration
|
||||||
|
|
||||||
Move existing `reboot_module` logic into `reboot.rs`:
|
Production reboot path is external binary/service `awg2-reboot-scheduler`:
|
||||||
|
|
||||||
- window from config, not constants;
|
- window from config, not constants;
|
||||||
- random point inside `[window_start_utc, window_end_utc)`;
|
- random point inside reboot window (including cross-midnight windows);
|
||||||
- `systemctl --no-block reboot` remains;
|
- `systemctl --no-block reboot` remains;
|
||||||
- disabled when `reboot.enabled = false`;
|
- disabled when `reboot.enabled = false`;
|
||||||
- daemon logs planned reboot time.
|
- planned reboot timestamp is persisted in `/run/awg2-harness/reboot.plan`.
|
||||||
|
|
||||||
## 17. Swap module
|
## 17. Swap module
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -124,7 +124,7 @@ per-peer ingress filter: src peer_ip -> 2:<id>
|
|||||||
4. `validate-config` — проверка конфига без изменения системы.
|
4. `validate-config` — проверка конфига без изменения системы.
|
||||||
5. `apply-firewall` — ручной reconcile AWG2-owned nftables state, если anti-torrent включён.
|
5. `apply-firewall` — ручной reconcile AWG2-owned nftables state, если anti-torrent включён.
|
||||||
6. `ensure-swap` — идемпотентный setup swap-файла 2 ГБ.
|
6. `ensure-swap` — идемпотентный setup swap-файла 2 ГБ.
|
||||||
7. Встроенный reboot scheduler в `traffic_core` (единый production path, без отдельного runtime-модуля).
|
7. Внешний reboot scheduler `awg2-reboot-scheduler` как отдельный production service.
|
||||||
8. Locking, чтобы одновременно не шли два apply/reconcile.
|
8. Locking, чтобы одновременно не шли два apply/reconcile.
|
||||||
9. Docker event watcher.
|
9. Docker event watcher.
|
||||||
10. Периодический reconciliation loop, потому что Docker events могут быть пропущены.
|
10. Периодический reconciliation loop, потому что Docker events могут быть пропущены.
|
||||||
@@ -140,9 +140,10 @@ awg2-harness apply-firewall
|
|||||||
awg2-harness status
|
awg2-harness status
|
||||||
awg2-harness ensure-swap
|
awg2-harness ensure-swap
|
||||||
awg2-harness validate-config
|
awg2-harness validate-config
|
||||||
|
awg2-harness validate-runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
`daemon` — основной production-режим. Он делает initial reconcile, слушает Docker events, периодически проверяет state, интегрирует reboot scheduler и пишет runtime-логи в journald.
|
`daemon` — основной production-режим. Он делает initial reconcile, слушает Docker events, периодически проверяет state и пишет runtime-логи в journald. Планирование reboot выполняется отдельным сервисом `awg2-reboot-scheduler`.
|
||||||
|
|
||||||
`apply-limits` — немедленный reconcile traffic limits. Команда должна быть безопасной для повторного запуска.
|
`apply-limits` — немедленный reconcile traffic limits. Команда должна быть безопасной для повторного запуска.
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -1,18 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reboot-scheduler"
|
name = "awg2-reboot-scheduler"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Демон планового перезапуска сервера в случайное время в окне 01:00–02:00 UTC"
|
description = "AWG2 reboot scheduler service"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "reboot-scheduler"
|
name = "awg2-reboot-scheduler"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
anyhow = "1.0"
|
||||||
[profile.release]
|
chrono = { version = "0.4", features = ["clock"] }
|
||||||
opt-level = "z"
|
clap = { version = "4.5", features = ["derive"] }
|
||||||
lto = true
|
rand = "0.8"
|
||||||
codegen-units = 1
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
strip = true
|
toml = "0.8"
|
||||||
panic = "abort"
|
|
||||||
|
|||||||
+210
-259
@@ -1,70 +1,191 @@
|
|||||||
//! reboot-scheduler — демон планового перезапуска сервера.
|
use std::{
|
||||||
//!
|
fs,
|
||||||
//! Логика работы:
|
path::PathBuf,
|
||||||
//! 1. При запуске вычисляет случайное время в окне [01:00, 02:00) UTC
|
process::Command,
|
||||||
//! текущих суток (если окно ещё не началось) либо следующих суток.
|
thread,
|
||||||
//! 2. Ждёт до наступления выбранного момента.
|
time::{Duration as StdDuration, SystemTime, UNIX_EPOCH},
|
||||||
//! 3. Выполняет `systemctl --no-block reboot` и завершается:
|
};
|
||||||
//! - код 0 при успешном запросе;
|
|
||||||
//! - код 1 при ошибке.
|
|
||||||
//!
|
|
||||||
//! Логирование ведётся только в stderr/stdout и собирается journald.
|
|
||||||
//! Нет сторонних зависимостей — только std.
|
|
||||||
|
|
||||||
use std::process::Command;
|
use anyhow::Context;
|
||||||
use std::thread;
|
use chrono::{Duration, NaiveDateTime, NaiveTime, Timelike, Utc};
|
||||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
use clap::Parser;
|
||||||
|
use rand::Rng;
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
// ─── Константы ────────────────────────────────────────────────────────────────
|
const DEFAULT_CONFIG_PATH: &str = "/etc/awg2-harness/config.toml";
|
||||||
|
const REBOOT_PLAN_FILE: &str = "/run/awg2-harness/reboot.plan";
|
||||||
|
|
||||||
/// Начало окна перезагрузки — 01:00:00 UTC в секундах от полуночи.
|
#[derive(Debug, Parser)]
|
||||||
const WINDOW_START_SEC: u64 = 3600;
|
#[command(name = "awg2-reboot-scheduler")]
|
||||||
/// Конец окна перезагрузки — 02:00:00 UTC в секундах от полуночи (не включая).
|
struct Cli {
|
||||||
const WINDOW_END_SEC: u64 = 2 * 3600;
|
#[arg(long)]
|
||||||
|
config: Option<PathBuf>,
|
||||||
/// Интервал опроса при ожидании (проверяем раз в 30 секунд).
|
|
||||||
const POLL_INTERVAL: Duration = Duration::from_secs(30);
|
|
||||||
|
|
||||||
// ─── Логгер ───────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
/// Возвращает текущее время в виде строки «YYYY-MM-DD HH:MM:SS UTC».
|
|
||||||
fn fmt_time(ts: u64) -> String {
|
|
||||||
let secs = ts;
|
|
||||||
let days_total = secs / 86400;
|
|
||||||
let time_of_day = secs % 86400;
|
|
||||||
|
|
||||||
let hh = time_of_day / 3600;
|
|
||||||
let mm = (time_of_day % 3600) / 60;
|
|
||||||
let ss = time_of_day % 60;
|
|
||||||
|
|
||||||
// Алгоритм Фликера для перевода дней с эпохи в дату.
|
|
||||||
let z = days_total as i64 + 719468;
|
|
||||||
let era: i64 = if z >= 0 { z } else { z - 146096 } / 146097;
|
|
||||||
let doe = z - era * 146097;
|
|
||||||
let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
|
||||||
let y = yoe + era * 400;
|
|
||||||
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
|
||||||
let mp = (5 * doy + 2) / 153;
|
|
||||||
let d = doy - (153 * mp + 2) / 5 + 1;
|
|
||||||
let m = if mp < 10 { mp + 3 } else { mp - 9 };
|
|
||||||
let y = if m <= 2 { y + 1 } else { y };
|
|
||||||
|
|
||||||
format!(
|
|
||||||
"{:04}-{:02}-{:02} {:02}:{:02}:{:02} UTC",
|
|
||||||
y, m, d, hh, mm, ss
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Записывает строку в журнал с временной меткой.
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
fn log(msg: &str) {
|
struct RootConfig {
|
||||||
let now = unix_now();
|
reboot: RebootConfig,
|
||||||
let line = format!("[{}] {}", fmt_time(now), msg);
|
|
||||||
eprintln!("{}", line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Время ────────────────────────────────────────────────────────────────────
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
struct RebootConfig {
|
||||||
|
enabled: bool,
|
||||||
|
window_start_utc: String,
|
||||||
|
window_end_utc: String,
|
||||||
|
}
|
||||||
|
|
||||||
/// Возвращает текущий unix-timestamp (секунды).
|
fn main() -> anyhow::Result<()> {
|
||||||
|
let cli = Cli::parse();
|
||||||
|
let config_path = cli
|
||||||
|
.config
|
||||||
|
.unwrap_or_else(|| PathBuf::from(DEFAULT_CONFIG_PATH));
|
||||||
|
|
||||||
|
let cfg = load_config(&config_path)?;
|
||||||
|
if !cfg.reboot.enabled {
|
||||||
|
println!("disabled by config");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let planned = next_reboot_time(&cfg.reboot.window_start_utc, &cfg.reboot.window_end_utc)?;
|
||||||
|
persist_plan(planned);
|
||||||
|
println!("reboot planned at UTC {}", planned);
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let now = Utc::now().naive_utc();
|
||||||
|
if now >= planned {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
thread::sleep(StdDuration::from_secs(30));
|
||||||
|
}
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let out = Command::new("systemctl")
|
||||||
|
.args(["--no-block", "reboot"])
|
||||||
|
.output()
|
||||||
|
.context("failed to run systemctl reboot")?;
|
||||||
|
if out.status.success() {
|
||||||
|
println!("reboot request accepted by systemctl");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
eprintln!(
|
||||||
|
"reboot request failed: {}",
|
||||||
|
String::from_utf8_lossy(&out.stderr)
|
||||||
|
);
|
||||||
|
thread::sleep(StdDuration::from_secs(60));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_config(path: &PathBuf) -> anyhow::Result<RootConfig> {
|
||||||
|
let raw = fs::read_to_string(path)
|
||||||
|
.with_context(|| format!("failed to read config: {}", path.display()))?;
|
||||||
|
let cfg: RootConfig = toml::from_str(&raw)
|
||||||
|
.with_context(|| format!("failed to parse config TOML: {}", path.display()))?;
|
||||||
|
Ok(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn persist_plan(planned: NaiveDateTime) {
|
||||||
|
let _ = fs::create_dir_all("/run/awg2-harness");
|
||||||
|
let line = format!(
|
||||||
|
"planned_reboot_utc={}\nplanned_reboot_unix={}\n",
|
||||||
|
planned.format("%Y-%m-%dT%H:%M:%SZ"),
|
||||||
|
planned.and_utc().timestamp()
|
||||||
|
);
|
||||||
|
let _ = fs::write(REBOOT_PLAN_FILE, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn next_reboot_time(start_hhmm: &str, end_hhmm: &str) -> anyhow::Result<NaiveDateTime> {
|
||||||
|
let start = parse_hhmm(start_hhmm)?;
|
||||||
|
let end = parse_hhmm(end_hhmm)?;
|
||||||
|
|
||||||
|
let now = Utc::now().naive_utc();
|
||||||
|
let now_t = NaiveTime::from_hms_opt(now.hour(), now.minute(), now.second())
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("bad current time"))?;
|
||||||
|
|
||||||
|
let (range_start, range_end) = current_or_next_window(now, now_t, start, end)?;
|
||||||
|
let span = (range_end - range_start).num_seconds().max(1);
|
||||||
|
let offset = rand::thread_rng().gen_range(0..span);
|
||||||
|
Ok(range_start + Duration::seconds(offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_or_next_window(
|
||||||
|
now: NaiveDateTime,
|
||||||
|
now_t: NaiveTime,
|
||||||
|
start: NaiveTime,
|
||||||
|
end: NaiveTime,
|
||||||
|
) -> anyhow::Result<(NaiveDateTime, NaiveDateTime)> {
|
||||||
|
let today = now.date();
|
||||||
|
let tomorrow = today
|
||||||
|
.succ_opt()
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("date overflow"))?;
|
||||||
|
|
||||||
|
if start < end {
|
||||||
|
if now_t < start {
|
||||||
|
let s = today
|
||||||
|
.and_hms_opt(start.hour(), start.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid start dt"))?;
|
||||||
|
let e = today
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
return Ok((s, e));
|
||||||
|
}
|
||||||
|
if now_t < end {
|
||||||
|
let e = today
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
return Ok((now, e));
|
||||||
|
}
|
||||||
|
let s = tomorrow
|
||||||
|
.and_hms_opt(start.hour(), start.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid start dt"))?;
|
||||||
|
let e = tomorrow
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
return Ok((s, e));
|
||||||
|
}
|
||||||
|
|
||||||
|
// cross-midnight window, e.g. 23:00..02:00
|
||||||
|
if now_t >= start {
|
||||||
|
let end_day = tomorrow;
|
||||||
|
let e = end_day
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
return Ok((now, e));
|
||||||
|
}
|
||||||
|
if now_t < end {
|
||||||
|
let e = today
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
return Ok((now, e));
|
||||||
|
}
|
||||||
|
let s = today
|
||||||
|
.and_hms_opt(start.hour(), start.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid start dt"))?;
|
||||||
|
let e = tomorrow
|
||||||
|
.and_hms_opt(end.hour(), end.minute(), 0)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("invalid end dt"))?;
|
||||||
|
Ok((s, e))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_hhmm(v: &str) -> anyhow::Result<NaiveTime> {
|
||||||
|
let mut s = v.split(':');
|
||||||
|
let h = s
|
||||||
|
.next()
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("bad time"))?
|
||||||
|
.parse()?;
|
||||||
|
let m = s
|
||||||
|
.next()
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("bad time"))?
|
||||||
|
.parse()?;
|
||||||
|
if s.next().is_some() {
|
||||||
|
anyhow::bail!("bad time")
|
||||||
|
}
|
||||||
|
if h > 23 || m > 59 {
|
||||||
|
anyhow::bail!("bad time")
|
||||||
|
}
|
||||||
|
NaiveTime::from_hms_opt(h, m, 0).ok_or_else(|| anyhow::anyhow!("bad time"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
fn unix_now() -> u64 {
|
fn unix_now() -> u64 {
|
||||||
SystemTime::now()
|
SystemTime::now()
|
||||||
.duration_since(UNIX_EPOCH)
|
.duration_since(UNIX_EPOCH)
|
||||||
@@ -72,215 +193,45 @@ fn unix_now() -> u64 {
|
|||||||
.as_secs()
|
.as_secs()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Простой LCG-генератор псевдослучайных чисел, инициализированный от времени.
|
|
||||||
struct Lcg(u64);
|
|
||||||
|
|
||||||
impl Lcg {
|
|
||||||
fn new(seed: u64) -> Self {
|
|
||||||
// Перемешиваем seed splitmix64, чтобы даже близкие значения давали
|
|
||||||
// разные последовательности.
|
|
||||||
let mut x = seed.wrapping_add(0x9e3779b97f4a7c15);
|
|
||||||
x = (x ^ (x >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
|
|
||||||
x = (x ^ (x >> 27)).wrapping_mul(0x94d049bb133111eb);
|
|
||||||
x ^= x >> 31;
|
|
||||||
Self(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Возвращает следующее псевдослучайное число в диапазоне [0, range).
|
|
||||||
fn next_u64(&mut self, range: u64) -> u64 {
|
|
||||||
// LCG параметры (Knuth).
|
|
||||||
self.0 = self
|
|
||||||
.0
|
|
||||||
.wrapping_mul(6364136223846793005)
|
|
||||||
.wrapping_add(1442695040888963407);
|
|
||||||
self.0 % range
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Вычисляет unix-timestamp следующего момента перезагрузки.
|
|
||||||
///
|
|
||||||
/// Правила:
|
|
||||||
/// - Берём сегодняшнюю полночь UTC.
|
|
||||||
/// - Если сейчас до WINDOW_START, цель — сегодняшнее окно.
|
|
||||||
/// - Иначе — окно следующего дня.
|
|
||||||
/// - Внутри окна выбираем случайную секунду.
|
|
||||||
fn next_reboot_ts_from(now: u64, random_offset: u64) -> u64 {
|
|
||||||
let today_midnight = now - (now % 86400); // полночь текущих суток UTC
|
|
||||||
let time_of_day = now % 86400;
|
|
||||||
|
|
||||||
let base_midnight = if time_of_day < WINDOW_START_SEC {
|
|
||||||
today_midnight
|
|
||||||
} else {
|
|
||||||
today_midnight + 86400 // следующие сутки
|
|
||||||
};
|
|
||||||
|
|
||||||
let window_len = WINDOW_END_SEC - WINDOW_START_SEC; // 3600 секунд
|
|
||||||
let offset = random_offset % window_len;
|
|
||||||
|
|
||||||
base_midnight + WINDOW_START_SEC + offset
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Вычисляет unix-timestamp следующего момента перезагрузки.
|
|
||||||
fn next_reboot_ts() -> u64 {
|
|
||||||
let now = unix_now();
|
|
||||||
let window_len = WINDOW_END_SEC - WINDOW_START_SEC;
|
|
||||||
let mut rng = Lcg::new(now);
|
|
||||||
let offset = rng.next_u64(window_len);
|
|
||||||
next_reboot_ts_from(now, offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Перезагрузка ─────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
fn run_command(program: &str, args: &[&str]) -> Result<std::process::ExitStatus, String> {
|
|
||||||
Command::new(program)
|
|
||||||
.args(args)
|
|
||||||
.status()
|
|
||||||
.map_err(|e| format!("не удалось запустить `{}`: {}", program, e))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Выполняет reboot-запрос через указанную команду.
|
|
||||||
fn do_reboot_with(program: &str, args: &[&str]) -> Result<(), String> {
|
|
||||||
let status = run_command(program, args)?;
|
|
||||||
|
|
||||||
if status.success() {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(format!(
|
|
||||||
"команда `{}` завершилась с кодом {:?}",
|
|
||||||
program,
|
|
||||||
status.code()
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Выполняет мягкую перезагрузку через systemctl.
|
|
||||||
fn do_reboot() -> Result<(), String> {
|
|
||||||
do_reboot_with("systemctl", &["--no-block", "reboot"])
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Точка входа ──────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
log("Демон запущен.");
|
|
||||||
|
|
||||||
let target_ts = next_reboot_ts();
|
|
||||||
log(&format!(
|
|
||||||
"Запланированная перезагрузка: {}",
|
|
||||||
fmt_time(target_ts)
|
|
||||||
));
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let now = unix_now();
|
|
||||||
|
|
||||||
if now >= target_ts {
|
|
||||||
log("Наступило запланированное время. Инициируем перезагрузку.");
|
|
||||||
match do_reboot() {
|
|
||||||
Ok(()) => {
|
|
||||||
log("Запрос на перезагрузку принят (systemctl --no-block reboot).");
|
|
||||||
std::process::exit(0);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
log(&format!(
|
|
||||||
"ОШИБКА: запрос на перезагрузку не выполнен: {}",
|
|
||||||
e
|
|
||||||
));
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let remaining = target_ts - now;
|
|
||||||
// Логируем оставшееся время раз в час (попадаем в окно ±30 с).
|
|
||||||
if remaining % 3600 < 30 {
|
|
||||||
log(&format!("До перезагрузки осталось {} мин.", remaining / 60));
|
|
||||||
}
|
|
||||||
|
|
||||||
thread::sleep(POLL_INTERVAL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn day(seconds: u64) -> u64 {
|
#[test]
|
||||||
seconds - (seconds % 86400)
|
fn parse_time_rejects_invalid() {
|
||||||
|
assert!(parse_hhmm("24:00").is_err());
|
||||||
|
assert!(parse_hhmm("10:60").is_err());
|
||||||
|
assert!(parse_hhmm("ab:cd").is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn next_reboot_before_window_uses_today_window() {
|
fn window_inside_day_now_inside_window_uses_now_to_end() {
|
||||||
let now = 25 * 60;
|
let now = NaiveDateTime::parse_from_str("2026-01-10 01:30:00", "%Y-%m-%d %H:%M:%S")
|
||||||
let ts = next_reboot_ts_from(now, 123);
|
.expect("now");
|
||||||
let base = day(now);
|
let (s, e) = current_or_next_window(
|
||||||
assert!(ts >= base + WINDOW_START_SEC);
|
now,
|
||||||
assert!(ts < base + WINDOW_END_SEC);
|
parse_hhmm("01:30").expect("time"),
|
||||||
|
parse_hhmm("01:00").expect("start"),
|
||||||
|
parse_hhmm("02:00").expect("end"),
|
||||||
|
)
|
||||||
|
.expect("window");
|
||||||
|
assert_eq!(s, now);
|
||||||
|
assert_eq!(e.format("%Y-%m-%d %H:%M:%S").to_string(), "2026-01-10 02:00:00");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn next_reboot_on_start_boundary_uses_next_day_window() {
|
fn cross_midnight_window_supported() {
|
||||||
let now = WINDOW_START_SEC;
|
let now = NaiveDateTime::parse_from_str("2026-01-10 23:30:00", "%Y-%m-%d %H:%M:%S")
|
||||||
let ts = next_reboot_ts_from(now, 0);
|
.expect("now");
|
||||||
let base = day(now) + 86400;
|
let (s, e) = current_or_next_window(
|
||||||
assert!(ts >= base + WINDOW_START_SEC);
|
now,
|
||||||
assert!(ts < base + WINDOW_END_SEC);
|
parse_hhmm("23:30").expect("time"),
|
||||||
|
parse_hhmm("23:00").expect("start"),
|
||||||
|
parse_hhmm("02:00").expect("end"),
|
||||||
|
)
|
||||||
|
.expect("window");
|
||||||
|
assert_eq!(s, now);
|
||||||
|
assert_eq!(e.format("%Y-%m-%d %H:%M:%S").to_string(), "2026-01-11 02:00:00");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn next_reboot_after_window_uses_next_day_window() {
|
|
||||||
let now = WINDOW_END_SEC + 1;
|
|
||||||
let ts = next_reboot_ts_from(now, 42);
|
|
||||||
let base = day(now) + 86400;
|
|
||||||
assert!(ts >= base + WINDOW_START_SEC);
|
|
||||||
assert!(ts < base + WINDOW_END_SEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn next_reboot_always_inside_window() {
|
|
||||||
let now = 1_700_000_000;
|
|
||||||
let ts = next_reboot_ts_from(now, 3599);
|
|
||||||
let tod = ts % 86400;
|
|
||||||
assert!((WINDOW_START_SEC..WINDOW_END_SEC).contains(&tod));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_success_command_returns_ok() {
|
|
||||||
let res = do_reboot_with("/bin/true", &[]);
|
|
||||||
assert!(res.is_ok());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_failing_command_returns_err() {
|
|
||||||
let res = do_reboot_with("/bin/false", &[]);
|
|
||||||
assert!(res.is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_missing_command_returns_err() {
|
|
||||||
let res = do_reboot_with("/definitely/not/exist", &[]);
|
|
||||||
assert!(res.is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_success_command_returns_ok() {
|
|
||||||
let res = do_reboot_with("cmd", &["/C", "exit", "0"]);
|
|
||||||
assert!(res.is_ok());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_failing_command_returns_err() {
|
|
||||||
let res = do_reboot_with("cmd", &["/C", "exit", "1"]);
|
|
||||||
assert!(res.is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
#[test]
|
|
||||||
fn do_reboot_with_missing_command_returns_err() {
|
|
||||||
let res = do_reboot_with("C:\\definitely\\not\\exist\\cmd.exe", &[]);
|
|
||||||
assert!(res.is_err());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+30
-9
@@ -2,8 +2,10 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
WORKSPACE_MANIFEST="$ROOT_DIR/Cargo.toml"
|
||||||
CRATE_MANIFEST="$ROOT_DIR/traffic_core/Cargo.toml"
|
CRATE_MANIFEST="$ROOT_DIR/traffic_core/Cargo.toml"
|
||||||
TARGET_BIN="$ROOT_DIR/traffic_core/target/release/awg2-harness"
|
TARGET_BIN="$ROOT_DIR/target/release/awg2-harness"
|
||||||
|
REBOOT_BIN="$ROOT_DIR/target/release/awg2-reboot-scheduler"
|
||||||
RUST_TOOLCHAIN_FILE="$ROOT_DIR/rust-toolchain.toml"
|
RUST_TOOLCHAIN_FILE="$ROOT_DIR/rust-toolchain.toml"
|
||||||
RUST_TOOLCHAIN_VERSION="1.95.0"
|
RUST_TOOLCHAIN_VERSION="1.95.0"
|
||||||
|
|
||||||
@@ -215,23 +217,33 @@ prepare_build_gate() {
|
|||||||
cargo fmt --manifest-path "$CRATE_MANIFEST" --all --check
|
cargo fmt --manifest-path "$CRATE_MANIFEST" --all --check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo clippy --locked --manifest-path "$CRATE_MANIFEST" --all-targets -- -D warnings
|
if [[ ! -f "$WORKSPACE_MANIFEST" ]]; then
|
||||||
cargo test --locked --manifest-path "$CRATE_MANIFEST" --release
|
echo "Missing workspace manifest: $WORKSPACE_MANIFEST"
|
||||||
cargo build --locked --manifest-path "$CRATE_MANIFEST" --release
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cargo clippy --locked --workspace --all-targets --manifest-path "$WORKSPACE_MANIFEST" -- -D warnings
|
||||||
|
cargo test --locked --workspace --release --manifest-path "$WORKSPACE_MANIFEST"
|
||||||
|
cargo build --locked --workspace --release --manifest-path "$WORKSPACE_MANIFEST"
|
||||||
|
|
||||||
file "$TARGET_BIN"
|
file "$TARGET_BIN"
|
||||||
|
file "$REBOOT_BIN"
|
||||||
ldd "$TARGET_BIN" || true
|
ldd "$TARGET_BIN" || true
|
||||||
|
ldd "$REBOOT_BIN" || true
|
||||||
"$TARGET_BIN" --help >/dev/null
|
"$TARGET_BIN" --help >/dev/null
|
||||||
|
"$REBOOT_BIN" --help >/dev/null
|
||||||
sha256sum "$TARGET_BIN"
|
sha256sum "$TARGET_BIN"
|
||||||
|
sha256sum "$REBOOT_BIN"
|
||||||
ls -lh "$TARGET_BIN"
|
ls -lh "$TARGET_BIN"
|
||||||
|
ls -lh "$REBOOT_BIN"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_artifacts() {
|
install_artifacts() {
|
||||||
require_cmd install
|
require_cmd install
|
||||||
require_cmd systemctl
|
require_cmd systemctl
|
||||||
|
|
||||||
if [[ ! -f "$TARGET_BIN" ]]; then
|
if [[ ! -f "$TARGET_BIN" || ! -f "$REBOOT_BIN" ]]; then
|
||||||
echo "Binary not found: $TARGET_BIN"
|
echo "Binary not found: $TARGET_BIN or $REBOOT_BIN"
|
||||||
echo "Run build first: ./tools/build.sh"
|
echo "Run build first: ./tools/build.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -246,11 +258,14 @@ install_artifacts() {
|
|||||||
setup_root_runner
|
setup_root_runner
|
||||||
"${RUN_AS_ROOT[@]}" install -d -m 0755 /usr/sbin
|
"${RUN_AS_ROOT[@]}" install -d -m 0755 /usr/sbin
|
||||||
"${RUN_AS_ROOT[@]}" install -m 0755 "$TARGET_BIN" /usr/sbin/awg2-harness
|
"${RUN_AS_ROOT[@]}" install -m 0755 "$TARGET_BIN" /usr/sbin/awg2-harness
|
||||||
|
"${RUN_AS_ROOT[@]}" install -m 0755 "$REBOOT_BIN" /usr/sbin/awg2-reboot-scheduler
|
||||||
"${RUN_AS_ROOT[@]}" install -d -m 0755 /lib/systemd/system
|
"${RUN_AS_ROOT[@]}" install -d -m 0755 /lib/systemd/system
|
||||||
"${RUN_AS_ROOT[@]}" install -m 0644 "$ROOT_DIR/awg2-harness.service" /lib/systemd/system/awg2-harness.service
|
"${RUN_AS_ROOT[@]}" install -m 0644 "$ROOT_DIR/awg2-harness.service" /lib/systemd/system/awg2-harness.service
|
||||||
|
"${RUN_AS_ROOT[@]}" install -m 0644 "$ROOT_DIR/awg2-reboot-scheduler.service" /lib/systemd/system/awg2-reboot-scheduler.service
|
||||||
|
|
||||||
if command -v systemd-analyze >/dev/null 2>&1; then
|
if command -v systemd-analyze >/dev/null 2>&1; then
|
||||||
"${RUN_AS_ROOT[@]}" systemd-analyze verify /lib/systemd/system/awg2-harness.service
|
"${RUN_AS_ROOT[@]}" systemd-analyze verify /lib/systemd/system/awg2-harness.service
|
||||||
|
"${RUN_AS_ROOT[@]}" systemd-analyze verify /lib/systemd/system/awg2-reboot-scheduler.service
|
||||||
fi
|
fi
|
||||||
"${RUN_AS_ROOT[@]}" systemctl daemon-reload
|
"${RUN_AS_ROOT[@]}" systemctl daemon-reload
|
||||||
}
|
}
|
||||||
@@ -271,8 +286,8 @@ package_deb() {
|
|||||||
prepare_build_gate
|
prepare_build_gate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f "$TARGET_BIN" ]]; then
|
if [[ ! -f "$TARGET_BIN" || ! -f "$REBOOT_BIN" ]]; then
|
||||||
echo "Binary not found after build: $TARGET_BIN"
|
echo "Binary not found after build: $TARGET_BIN or $REBOOT_BIN"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -295,15 +310,20 @@ package_deb() {
|
|||||||
install -d -m 0755 "$staging/DEBIAN"
|
install -d -m 0755 "$staging/DEBIAN"
|
||||||
install -d -m 0755 "$staging/usr/sbin"
|
install -d -m 0755 "$staging/usr/sbin"
|
||||||
install -d -m 0755 "$staging/lib/systemd/system"
|
install -d -m 0755 "$staging/lib/systemd/system"
|
||||||
|
install -d -m 0755 "$staging/etc/awg2-harness"
|
||||||
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo"
|
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo"
|
||||||
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo/docs"
|
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo/docs"
|
||||||
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo/tools"
|
install -d -m 0755 "$staging/usr/share/doc/awg2-harness/repo/tools"
|
||||||
|
|
||||||
install -m 0755 "$TARGET_BIN" "$staging/usr/sbin/awg2-harness"
|
install -m 0755 "$TARGET_BIN" "$staging/usr/sbin/awg2-harness"
|
||||||
|
install -m 0755 "$REBOOT_BIN" "$staging/usr/sbin/awg2-reboot-scheduler"
|
||||||
install -m 0644 "$ROOT_DIR/awg2-harness.service" "$staging/lib/systemd/system/awg2-harness.service"
|
install -m 0644 "$ROOT_DIR/awg2-harness.service" "$staging/lib/systemd/system/awg2-harness.service"
|
||||||
|
install -m 0644 "$ROOT_DIR/awg2-reboot-scheduler.service" "$staging/lib/systemd/system/awg2-reboot-scheduler.service"
|
||||||
install -m 0644 "$ROOT_DIR/config.example.toml" "$staging/usr/share/doc/awg2-harness/repo/config.example.toml"
|
install -m 0644 "$ROOT_DIR/config.example.toml" "$staging/usr/share/doc/awg2-harness/repo/config.example.toml"
|
||||||
install -m 0644 "$ROOT_DIR/README.md" "$staging/usr/share/doc/awg2-harness/repo/README.md"
|
install -m 0644 "$ROOT_DIR/README.md" "$staging/usr/share/doc/awg2-harness/repo/README.md"
|
||||||
install -m 0644 "$ROOT_DIR/docs/INSTALLATION.md" "$staging/usr/share/doc/awg2-harness/repo/docs/INSTALLATION.md"
|
install -m 0644 "$ROOT_DIR/docs/INSTALLATION.md" "$staging/usr/share/doc/awg2-harness/repo/docs/INSTALLATION.md"
|
||||||
|
install -m 0644 "$ROOT_DIR/docs/CONFIGURATION.md" "$staging/usr/share/doc/awg2-harness/repo/docs/CONFIGURATION.md"
|
||||||
|
install -m 0644 "$ROOT_DIR/docs/ACCEPTANCE_CHECKLIST.md" "$staging/usr/share/doc/awg2-harness/repo/docs/ACCEPTANCE_CHECKLIST.md"
|
||||||
install -m 0644 "$ROOT_DIR/tools/README.md" "$staging/usr/share/doc/awg2-harness/repo/tools/README.md"
|
install -m 0644 "$ROOT_DIR/tools/README.md" "$staging/usr/share/doc/awg2-harness/repo/tools/README.md"
|
||||||
|
|
||||||
cat >"$staging/DEBIAN/control" <<EOF
|
cat >"$staging/DEBIAN/control" <<EOF
|
||||||
@@ -317,7 +337,7 @@ Depends: libc6, iproute2, wireguard-tools, nftables, kmod, util-linux, procps, s
|
|||||||
Description: Host-side orchestrator for AmneziaWG traffic shaping and lifecycle recovery
|
Description: Host-side orchestrator for AmneziaWG traffic shaping and lifecycle recovery
|
||||||
AWG2 Harness manages AmneziaWG traffic shaping, IFB ingress shaping,
|
AWG2 Harness manages AmneziaWG traffic shaping, IFB ingress shaping,
|
||||||
nftables anti-torrent guard, reboot scheduling, swap setup and daemonized
|
nftables anti-torrent guard, reboot scheduling, swap setup and daemonized
|
||||||
drift recovery on dedicated Debian hosts.
|
drift recovery on dedicated Debian hosts. Includes external reboot scheduler.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >"$staging/DEBIAN/postinst" <<'EOF'
|
cat >"$staging/DEBIAN/postinst" <<'EOF'
|
||||||
@@ -365,6 +385,7 @@ enable_service() {
|
|||||||
require_cmd systemctl
|
require_cmd systemctl
|
||||||
setup_root_runner
|
setup_root_runner
|
||||||
"${RUN_AS_ROOT[@]}" systemctl enable --now awg2-harness.service
|
"${RUN_AS_ROOT[@]}" systemctl enable --now awg2-harness.service
|
||||||
|
"${RUN_AS_ROOT[@]}" systemctl enable --now awg2-reboot-scheduler.service
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_supported_host
|
ensure_supported_host
|
||||||
|
|||||||
Reference in New Issue
Block a user