add dns support
This commit is contained in:
650
Cargo.lock
generated
650
Cargo.lock
generated
@@ -29,7 +29,7 @@ dependencies = [
|
||||
"actix-rt",
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"base64",
|
||||
"base64 0.22.1",
|
||||
"bitflags",
|
||||
"brotli",
|
||||
"bytes",
|
||||
@@ -39,7 +39,7 @@ dependencies = [
|
||||
"flate2",
|
||||
"foldhash",
|
||||
"futures-core",
|
||||
"h2",
|
||||
"h2 0.3.27",
|
||||
"http 0.2.12",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
@@ -49,7 +49,7 @@ dependencies = [
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rand",
|
||||
"rand 0.9.2",
|
||||
"sha1",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
@@ -292,6 +292,17 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
@@ -304,6 +315,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
@@ -331,7 +348,7 @@ version = "0.19.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87a52479c9237eb04047ddb94788c41ca0d26eaff8b697ecfbb4c32f7fdc3b1b"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.22.1",
|
||||
"bollard-stubs",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
@@ -350,7 +367,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"serde_urlencoded",
|
||||
"thiserror",
|
||||
"thiserror 2.0.17",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
@@ -430,6 +447,12 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.42"
|
||||
@@ -502,6 +525,12 @@ dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.5.5"
|
||||
@@ -556,6 +585,48 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dns-comunications"
|
||||
version = "0.1.1"
|
||||
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
"dns-config",
|
||||
"dns-update",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dns-config"
|
||||
version = "0.1.1"
|
||||
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9"
|
||||
dependencies = [
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dns-update"
|
||||
version = "0.1.6"
|
||||
source = "git+ssh://git@github.com/stalwartlabs/dns-update.git#3a0985996dc8119c4adf1d25c6924ea6b981438e"
|
||||
dependencies = [
|
||||
"hickory-client",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sha1",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dns_manager"
|
||||
version = "0.1.1"
|
||||
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9"
|
||||
dependencies = [
|
||||
"dns-comunications",
|
||||
"dns-config",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.20"
|
||||
@@ -571,6 +642,24 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "endian-type"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.4"
|
||||
@@ -748,6 +837,19 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.4"
|
||||
@@ -755,9 +857,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -779,6 +883,25 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"http 1.4.0",
|
||||
"indexmap 2.12.1",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
@@ -810,12 +933,69 @@ dependencies = [
|
||||
"hashbrown 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hickory-client"
|
||||
version = "0.24.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "156579a5cd8d1fc6f0df87cc21b6ee870db978a163a1ba484acd98a4eff5a6de"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"once_cell",
|
||||
"radix_trie",
|
||||
"rand 0.8.5",
|
||||
"rustls 0.21.12",
|
||||
"thiserror 1.0.69",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-proto"
|
||||
version = "0.24.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"h2 0.3.27",
|
||||
"http 0.2.12",
|
||||
"idna",
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"rand 0.8.5",
|
||||
"ring",
|
||||
"rustls 0.21.12",
|
||||
"rustls-pemfile",
|
||||
"thiserror 1.0.69",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
"tokio-rustls 0.24.1",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.12"
|
||||
@@ -882,6 +1062,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"h2 0.4.12",
|
||||
"http 1.4.0",
|
||||
"http-body",
|
||||
"httparse",
|
||||
@@ -909,12 +1090,30 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"
|
||||
dependencies = [
|
||||
"http 1.4.0",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"rustls 0.23.35",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls 0.26.4",
|
||||
"tower-service",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -922,7 +1121,9 @@ dependencies = [
|
||||
"http 1.4.0",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"ipnet",
|
||||
"libc",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"socket2 0.6.1",
|
||||
"tokio",
|
||||
@@ -1100,6 +1301,22 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
|
||||
|
||||
[[package]]
|
||||
name = "iri-string"
|
||||
version = "0.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.2"
|
||||
@@ -1142,7 +1359,7 @@ version = "0.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.3.4",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -1217,6 +1434,12 @@ version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "lru-slab"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.6"
|
||||
@@ -1258,6 +1481,7 @@ dependencies = [
|
||||
"actix-web",
|
||||
"bollard",
|
||||
"derive_more",
|
||||
"dns_manager",
|
||||
"env_logger",
|
||||
"fallible-iterator",
|
||||
"futures",
|
||||
@@ -1269,6 +1493,15 @@ dependencies = [
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nibble_vec"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
@@ -1391,6 +1624,61 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn"
|
||||
version = "0.11.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cfg_aliases",
|
||||
"pin-project-lite",
|
||||
"quinn-proto",
|
||||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustls 0.23.35",
|
||||
"socket2 0.6.1",
|
||||
"thiserror 2.0.17",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn-proto"
|
||||
version = "0.11.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"getrandom 0.3.4",
|
||||
"lru-slab",
|
||||
"rand 0.9.2",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
"rustls 0.23.35",
|
||||
"rustls-pki-types",
|
||||
"slab",
|
||||
"thiserror 2.0.17",
|
||||
"tinyvec",
|
||||
"tracing",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn-udp"
|
||||
version = "0.5.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
|
||||
dependencies = [
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2 0.6.1",
|
||||
"tracing",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.42"
|
||||
@@ -1406,14 +1694,45 @@ version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "radix_trie"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd"
|
||||
dependencies = [
|
||||
"endian-type",
|
||||
"nibble_vec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_chacha 0.9.0",
|
||||
"rand_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1423,7 +1742,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom 0.2.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1432,7 +1760,7 @@ version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1499,6 +1827,59 @@ version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"h2 0.4.12",
|
||||
"http 1.4.0",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"hyper-util",
|
||||
"js-sys",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"quinn",
|
||||
"rustls 0.23.35",
|
||||
"rustls-pki-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tokio-rustls 0.26.4",
|
||||
"tower",
|
||||
"tower-http",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"getrandom 0.2.16",
|
||||
"libc",
|
||||
"untrusted",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.29.0"
|
||||
@@ -1513,6 +1894,12 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
@@ -1522,6 +1909,72 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.21.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"rustls-webpki 0.101.7",
|
||||
"sct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki 0.103.8",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
|
||||
dependencies = [
|
||||
"base64 0.21.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282"
|
||||
dependencies = [
|
||||
"web-time",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.101.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.22"
|
||||
@@ -1564,6 +2017,16 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.27"
|
||||
@@ -1651,7 +2114,7 @@ version = "3.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
@@ -1733,6 +2196,12 @@ version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.111"
|
||||
@@ -1744,6 +2213,15 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
version = "0.13.2"
|
||||
@@ -1755,13 +2233,33 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
"thiserror-impl 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1816,6 +2314,21 @@ dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.48.0"
|
||||
@@ -1844,6 +2357,26 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
|
||||
dependencies = [
|
||||
"rustls 0.21.12",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
|
||||
dependencies = [
|
||||
"rustls 0.23.35",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.17"
|
||||
@@ -1896,6 +2429,45 @@ version = "1.0.6+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http 1.4.0",
|
||||
"http-body",
|
||||
"iri-string",
|
||||
"pin-project-lite",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.3"
|
||||
@@ -1964,6 +2536,12 @@ version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.7"
|
||||
@@ -2037,6 +2615,19 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.106"
|
||||
@@ -2069,6 +2660,35 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-time"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@@ -2388,6 +3008,12 @@ dependencies = [
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
|
||||
|
||||
[[package]]
|
||||
name = "zerotrie"
|
||||
version = "0.2.3"
|
||||
|
||||
@@ -16,6 +16,7 @@ serde = "*"
|
||||
serde_json = "*"
|
||||
fallible-iterator = "*"
|
||||
toml = "0.9"
|
||||
dns_manager = { git = "ssh://git@rochegmr.com/groche97/dns_manager.git"}
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
rustflags = [
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
[server]
|
||||
addr = "127.0.0.1"
|
||||
public_addr = "my_domain.com"
|
||||
listening_addr = "127.0.0.1"
|
||||
port = 8080
|
||||
|
||||
[docker]
|
||||
connection = "unix_default"
|
||||
string = "http://my-custom-docker-server:2735"
|
||||
timeout = 60
|
||||
network_name = "customnetwork"
|
||||
network_addr = "172.20.0.0/24"
|
||||
|
||||
[mrproxy]
|
||||
connection = "tcp"
|
||||
string = "127.0.0.1:25564"
|
||||
[zone]
|
||||
root_domain = "root.domain.example"
|
||||
|
||||
[[dns_server]]
|
||||
connection_str = "tcp://127.0.0.1:53"
|
||||
|
||||
[dns_server.key]
|
||||
name = "key 0 name"
|
||||
value = "key 0 in base64"
|
||||
|
||||
[[dns_server]]
|
||||
connection_str = "udp://192.168.1.1:53"
|
||||
|
||||
[dns_server.key]
|
||||
name = "key 1 name"
|
||||
value = "key 1 in base64"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
use std::net::Ipv4Addr;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::api::error::ReturnedError;
|
||||
use crate::config::{
|
||||
docker::DockerConnectionConfig, mrproxy::MrproxyConnectionConfig, server::ServerConfig,
|
||||
CONFIG_PATH,
|
||||
@@ -5,8 +9,8 @@ use crate::config::{
|
||||
use crate::controller::Controller;
|
||||
use crate::deploy::container_options::Options;
|
||||
use crate::deploy::starter;
|
||||
use crate::{api::error::ReturnedError, config};
|
||||
use actix_web::{delete, get, patch, put, web, App, HttpServer, Responder};
|
||||
use dns_manager::ServerZonesConnection;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -57,7 +61,7 @@ async fn delete_container(
|
||||
controller: web::Data<Controller>,
|
||||
params: web::Query<ConainerStopParams>,
|
||||
) -> Result<String, ReturnedError> {
|
||||
match controller.delete_container(params.name.clone()).await {
|
||||
match controller.delete_container_and_unbind(¶ms.name).await {
|
||||
Ok(response) => Ok(response),
|
||||
Err(e) => Err(ReturnedError {
|
||||
name: e.to_string(),
|
||||
@@ -77,12 +81,14 @@ async fn get_ip(
|
||||
}
|
||||
|
||||
pub async fn start() -> std::io::Result<()> {
|
||||
let server_config = ServerConfig::get_config(CONFIG_PATH).unwrap();
|
||||
let controller = starter::start_docker(
|
||||
DockerConnectionConfig::get_config(CONFIG_PATH).unwrap(),
|
||||
MrproxyConnectionConfig::get_config(config::CONFIG_PATH).unwrap(),
|
||||
MrproxyConnectionConfig::get_config(CONFIG_PATH).unwrap(),
|
||||
ServerZonesConnection::get_config(CONFIG_PATH).unwrap(),
|
||||
Ipv4Addr::from_str(&server_config.pub_addr).unwrap(),
|
||||
)
|
||||
.await;
|
||||
let server_config = ServerConfig::get_config(CONFIG_PATH).unwrap();
|
||||
let data = web::Data::new(controller);
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
@@ -93,7 +99,7 @@ pub async fn start() -> std::io::Result<()> {
|
||||
.service(delete_container)
|
||||
.service(get_ip)
|
||||
})
|
||||
.bind((server_config.addr, server_config.port))?
|
||||
.bind((server_config.linstening_addr, server_config.port))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -3,22 +3,34 @@ use std::{error::Error, fs::read_to_string};
|
||||
use toml::Table;
|
||||
|
||||
pub struct ServerConfig {
|
||||
pub addr: String,
|
||||
pub pub_addr: String,
|
||||
pub linstening_addr: String,
|
||||
pub port: u16,
|
||||
}
|
||||
|
||||
impl ServerConfig {
|
||||
pub fn get_config(file_name: &str) -> Result<Self, Box<dyn Error>> {
|
||||
let stored_file = read_to_string(file_name)?.parse::<Table>()?;
|
||||
let addr = stored_file["server"]["addr"]
|
||||
let pub_addr = stored_file["server"]["public_addr"]
|
||||
.as_str()
|
||||
.ok_or(generate_toml_parser_error_in_field("server addr"))?
|
||||
.ok_or(generate_toml_parser_error_in_field("server public address"))?
|
||||
.to_string();
|
||||
|
||||
let linstening_addr = stored_file["server"]["listening_addr"]
|
||||
.as_str()
|
||||
.ok_or(generate_toml_parser_error_in_field(
|
||||
"server listening address",
|
||||
))?
|
||||
.to_string();
|
||||
|
||||
let port = stored_file["server"]["port"]
|
||||
.as_integer()
|
||||
.ok_or(generate_toml_parser_error_in_field("server port"))? as u16;
|
||||
|
||||
Ok(Self { addr, port })
|
||||
Ok(Self {
|
||||
pub_addr,
|
||||
linstening_addr,
|
||||
port,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::config::{docker::DockerConnectionConfig, mrproxy::MrproxyConnectionConfig};
|
||||
use crate::config::mrproxy::MrproxyConnectionConfig;
|
||||
use crate::database::exposer::MemStorage;
|
||||
use crate::database::instance::Instance;
|
||||
use crate::deploy::container::Container;
|
||||
@@ -6,34 +6,39 @@ use crate::deploy::container_options::Options;
|
||||
use crate::{deploy, mcproxy_client};
|
||||
use bollard::errors::Error;
|
||||
use bollard::Docker;
|
||||
use log::error;
|
||||
use dns_manager::{DnsManager, ServerZonesConnection};
|
||||
use log::{error, warn};
|
||||
use std::error::Error as GenericError;
|
||||
use std::net::Ipv4Addr;
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub struct Controller {
|
||||
driver: Docker,
|
||||
pub_addr: Ipv4Addr,
|
||||
network: String,
|
||||
storage: Mutex<MemStorage>,
|
||||
started: bool,
|
||||
docker_config: DockerConnectionConfig,
|
||||
dns_manager: DnsManager,
|
||||
mrproxy_config: MrproxyConnectionConfig,
|
||||
}
|
||||
|
||||
impl Controller {
|
||||
pub async fn new(
|
||||
driver: Docker,
|
||||
pub_addr: Ipv4Addr,
|
||||
network: String,
|
||||
range: String,
|
||||
docker_config: DockerConnectionConfig,
|
||||
dns_config: ServerZonesConnection,
|
||||
mrproxy_config: MrproxyConnectionConfig,
|
||||
) -> Result<Self, bollard::errors::Error> {
|
||||
) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
deploy::network::Network::new(driver.clone(), network.clone(), range).await?;
|
||||
let cont = Self {
|
||||
driver: driver,
|
||||
pub_addr,
|
||||
network: network,
|
||||
storage: Mutex::new(MemStorage::new().unwrap()),
|
||||
started: false,
|
||||
docker_config,
|
||||
dns_manager: DnsManager::new(dns_config)?,
|
||||
mrproxy_config,
|
||||
};
|
||||
Ok(cont)
|
||||
@@ -83,41 +88,39 @@ impl Controller {
|
||||
.load_container(docker_id, domain.clone(), ip.clone(), image, ops)
|
||||
.await
|
||||
{
|
||||
Ok(c) => {
|
||||
match self
|
||||
.bind_container_in_proxy(domain.clone(), ip, c.clone())
|
||||
.await
|
||||
{
|
||||
Ok(_) => Ok(c),
|
||||
Err(e) => {
|
||||
error!("failed in the bind process with the proxy, deleting the container");
|
||||
self.delete_container(domain).await?;
|
||||
return Err(e);
|
||||
}
|
||||
Ok(c) => match self.bind_container_in_proxy(&domain, ip, &c).await {
|
||||
Ok(_) => {
|
||||
self.add_domain_to_dns(&domain).await?;
|
||||
Ok(c)
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
error!("failed in the bind process with the proxy, deleting the container");
|
||||
self.delete_container_and_unbind(&domain).await?;
|
||||
return Err(e);
|
||||
}
|
||||
},
|
||||
Err(e) => return Err(Box::new(e)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn bind_container_in_proxy(
|
||||
&self,
|
||||
domain: String,
|
||||
domain: &str,
|
||||
ip: Option<String>,
|
||||
container: Container,
|
||||
container: &Container,
|
||||
) -> Result<(), Box<dyn GenericError>> {
|
||||
let ip_final = ip.unwrap_or(container.get_ip(&self.driver).await?);
|
||||
log::debug!("ip binded: {}", ip_final);
|
||||
let mut mrcp_controller =
|
||||
mcproxy_client::controller::Controller::new(&self.mrproxy_config)?;
|
||||
mrcp_controller.insert_new_domain(&domain, &ip_final)?;
|
||||
mrcp_controller.insert_new_domain(&self.dns_manager.get_full_domain(domain), &ip_final)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn unbind_container_in_proxy(&self, domain: &str) -> Result<(), Box<dyn GenericError>> {
|
||||
let mut mrcp_controller =
|
||||
mcproxy_client::controller::Controller::new(&self.mrproxy_config)?;
|
||||
mrcp_controller.remove_domain(&domain)?;
|
||||
mrcp_controller.remove_domain(&self.dns_manager.get_full_domain(domain))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -171,6 +174,7 @@ impl Controller {
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn is_started(&self) -> bool {
|
||||
self.started
|
||||
}
|
||||
@@ -217,11 +221,21 @@ impl Controller {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete_container(&self, domain: String) -> Result<String, Box<dyn GenericError>> {
|
||||
pub async fn delete_container_and_unbind(
|
||||
&self,
|
||||
domain: &str,
|
||||
) -> Result<String, Box<dyn GenericError>> {
|
||||
match self.storage.lock().unwrap().remove_instance(&domain) {
|
||||
Some(data) => match data.1 {
|
||||
Some(c) => {
|
||||
self.unbind_container_in_proxy(&domain).await?;
|
||||
let r_unbind = self.unbind_container_in_proxy(&domain).await;
|
||||
if r_unbind.is_err() {
|
||||
warn!("Error unbinding container {}", domain);
|
||||
}
|
||||
let r_del_domain = self.del_domain_to_dns(domain).await;
|
||||
if r_del_domain.is_err() {
|
||||
warn!("Error deleting domain {} from dns", domain);
|
||||
}
|
||||
self.prune_given_container(c).await
|
||||
}
|
||||
None => Ok(data.0.docker_id),
|
||||
@@ -242,4 +256,14 @@ impl Controller {
|
||||
.unwrap();
|
||||
container.get_ip(&self.driver).await
|
||||
}
|
||||
|
||||
pub async fn add_domain_to_dns(&self, domain: &str) -> Result<(), Box<dyn GenericError>> {
|
||||
self.dns_manager.add_domain(domain, self.pub_addr).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn del_domain_to_dns(&self, domain: &str) -> Result<(), Box<dyn GenericError>> {
|
||||
self.dns_manager.del_domain(domain).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ impl InstanceStorage {
|
||||
Ok(rows.next()?.unwrap().get::<_, String>(0)?)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn get_instance_id(&self, domain: &str) -> Result<Option<i64>> {
|
||||
let mut stmt = self
|
||||
.con
|
||||
|
||||
@@ -7,5 +7,6 @@ pub struct Instance {
|
||||
pub ip: Option<String>,
|
||||
pub domain: String,
|
||||
pub image: i64,
|
||||
#[allow(dead_code)]
|
||||
pub ops: Options,
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ pub struct Container {
|
||||
pub image: String,
|
||||
pub net: String,
|
||||
pub docker_id: Option<String>,
|
||||
#[allow(dead_code)]
|
||||
pub database_id: Option<i64>,
|
||||
pub ops: Options,
|
||||
}
|
||||
|
||||
@@ -3,18 +3,12 @@ use bollard::models::{Ipam, IpamConfig, NetworkCreateRequest};
|
||||
use bollard::query_parameters::ListNetworksOptions;
|
||||
use std::collections::hash_map::HashMap;
|
||||
|
||||
pub struct Network {
|
||||
name: String,
|
||||
range: String,
|
||||
}
|
||||
pub struct Network {}
|
||||
|
||||
impl Network {
|
||||
pub async fn new(docker: bollard::Docker, name: String, range: String) -> Result<Self, Error> {
|
||||
if Self::check_network(docker.clone(), name.clone()).await {
|
||||
Ok(Network {
|
||||
name: name,
|
||||
range: range,
|
||||
})
|
||||
Ok(Network {})
|
||||
} else {
|
||||
Self::create_network(docker, name, range).await
|
||||
}
|
||||
@@ -54,10 +48,7 @@ impl Network {
|
||||
..Default::default()
|
||||
};
|
||||
match docker.create_network(create_network_options).await {
|
||||
Ok(_n) => Ok(Network {
|
||||
name: name,
|
||||
range: range,
|
||||
}),
|
||||
Ok(_n) => Ok(Self {}),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
use crate::{
|
||||
config::{
|
||||
docker::DockerConnectionConfig,
|
||||
@@ -7,10 +9,13 @@ use crate::{
|
||||
controller::Controller,
|
||||
};
|
||||
use bollard::{errors::Error, ClientVersion, Docker};
|
||||
use dns_manager::ServerZonesConnection;
|
||||
|
||||
pub async fn start_docker(
|
||||
docker_config: DockerConnectionConfig,
|
||||
mrproxy_config: MrproxyConnectionConfig,
|
||||
dns_config: ServerZonesConnection,
|
||||
pub_addr: Ipv4Addr,
|
||||
) -> Controller {
|
||||
let docker = match generate_docker_connection(&docker_config) {
|
||||
Ok(d) => d,
|
||||
@@ -19,9 +24,10 @@ pub async fn start_docker(
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("debug"));
|
||||
let controller = match Controller::new(
|
||||
docker,
|
||||
pub_addr,
|
||||
docker_config.network_name.clone(),
|
||||
docker_config.network_addr.clone(),
|
||||
docker_config,
|
||||
dns_config,
|
||||
mrproxy_config,
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user