mirror of
https://github.com/zaphar/durnitisp.git
synced 2025-07-21 18:10:27 -04:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d32c27b31c | |||
![]() |
4755513f5d | ||
![]() |
feb6684e8f | ||
5341153a86 | |||
f609dcfef3 |
441
Cargo.lock
generated
441
Cargo.lock
generated
@ -1,6 +1,18 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
@ -36,10 +48,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
@ -59,6 +83,28 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.18"
|
||||
@ -66,18 +112,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10bcb9d7dcbf7002aaffbb53eac22906b64cdcc127971dcc387d8eb7c95d5560"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "durnitisp"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"gflags",
|
||||
"icmp-socket",
|
||||
"metrics",
|
||||
"metrics-exporter-prometheus",
|
||||
"nursery",
|
||||
"prometheus",
|
||||
"resolve",
|
||||
"socket2 0.5.1",
|
||||
"tiny_http",
|
||||
@ -86,10 +133,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
@ -117,7 +170,7 @@ checksum = "07ab1d33648a58677c98ee6ed81ce592e108d4e9847ce62a15302da7e5bfd437"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -128,7 +181,16 @@ checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -158,6 +220,16 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inventory"
|
||||
version = "0.1.10"
|
||||
@ -177,7 +249,16 @@ checksum = "75c094e94816723ab936484666968f5b58060492e880f3c8d00489a1e244fa51"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -188,19 +269,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
version = "0.2.161"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
]
|
||||
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
@ -227,10 +298,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.4"
|
||||
name = "memoffset"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metrics"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ae428771d17306715c5091d446327d1cfdedc82185c65ba8423ab404e45bf10"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metrics-exporter-prometheus"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85b6f8152da6d7892ff1b7a1c0fa3f435e92b5918ad67035c3bb432111d9a29b"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"indexmap",
|
||||
"metrics",
|
||||
"metrics-util",
|
||||
"quanta",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metrics-util"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15b482df36c13dd1869d73d14d28cd4855fbd6cfc32294bee109908a9f4a4ed7"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
"hashbrown",
|
||||
"metrics",
|
||||
"quanta",
|
||||
"sketches-ddsketch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nursery"
|
||||
@ -240,32 +352,9 @@ checksum = "a4bd2d4e0cd7c6bb256afbc59a5921c3ead56f05d7696c92e05b6978858b6fa5"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.13.0"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
@ -273,41 +362,41 @@ version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prometheus"
|
||||
version = "0.13.1"
|
||||
name = "quanta"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cface98dfa6d645ea4c789839f176e4b072265d085bfcc48eaa8d137f58d3c39"
|
||||
checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fnv",
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
"parking_lot",
|
||||
"protobuf",
|
||||
"thiserror",
|
||||
"crossbeam-utils",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"raw-cpuid",
|
||||
"wasi",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "protobuf"
|
||||
version = "2.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86473d5f16580f10b131a0bf0afb68f8e029d1835d33a00f37281b05694e5312"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.8"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -350,6 +439,15 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
|
||||
[[package]]
|
||||
name = "raw-cpuid"
|
||||
version = "11.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rdrand"
|
||||
version = "0.4.0"
|
||||
@ -359,15 +457,6 @@ dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast"
|
||||
version = "1.0.6"
|
||||
@ -385,7 +474,7 @@ checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -416,10 +505,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.6.1"
|
||||
name = "sketches-ddsketch"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
checksum = "c1e9a774a6c28142ac54bb25d25562e6bcf957493a184f15ad4eebccb23e410a"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
@ -438,7 +533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc8d618c6641ae355025c449427f9e96b98abf99a772be3cef6708d15c77147a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.45.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -452,6 +547,17 @@ dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.23"
|
||||
@ -469,7 +575,7 @@ checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -528,7 +634,7 @@ checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.60",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -575,6 +681,12 @@ dependencies = [
|
||||
"matches",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.16"
|
||||
@ -596,6 +708,82 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log 0.4.14",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.60",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.60",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@ -618,19 +806,6 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc 0.36.1",
|
||||
"windows_i686_gnu 0.36.1",
|
||||
"windows_i686_msvc 0.36.1",
|
||||
"windows_x86_64_gnu 0.36.1",
|
||||
"windows_x86_64_msvc 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
@ -647,12 +822,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -661,48 +836,24 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
@ -715,14 +866,28 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.85",
|
||||
]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "durnitisp"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
authors = ["Jeremy Wall <jeremy@marzhillstudios.com>"]
|
||||
edition = "2018"
|
||||
|
||||
@ -12,8 +12,9 @@ tracing-subscriber = "0.3.14"
|
||||
anyhow = "1"
|
||||
gflags = "^0.3"
|
||||
nursery = "^0.0.1"
|
||||
prometheus = "0.13.1"
|
||||
metrics = "0.24.0"
|
||||
metrics-exporter-prometheus = {version = "0.16.0", default-features = false}
|
||||
tiny_http = "0.12.0"
|
||||
socket2 = "0.5.1"
|
||||
socket2 = "0.5.1"
|
||||
icmp-socket = "0.2.0"
|
||||
resolve = "^0.2.0"
|
||||
resolve = "^0.2.0"
|
||||
|
12
flake.lock
generated
12
flake.lock
generated
@ -36,11 +36,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1639947939,
|
||||
"narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=",
|
||||
"lastModified": 1671096816,
|
||||
"narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653",
|
||||
"rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -51,11 +51,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1645937171,
|
||||
"narHash": "sha256-n9f9GZBNMe8UMhcgmmaXNObkH01jjgp7INMrUgBgcy4=",
|
||||
"lastModified": 1678724065,
|
||||
"narHash": "sha256-MjeRjunqfGTBGU401nxIjs7PC9PZZ1FBCZp/bRB3C2M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "22dc22f8cedc58fcb11afe1acb08e9999e78be9c",
|
||||
"rev": "b8afc8489dc96f29f69bec50fdc51e27883f89c1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
77
src/icmp.rs
77
src/icmp.rs
@ -25,8 +25,8 @@ use icmp_socket::{
|
||||
packet::{Icmpv4Message, Icmpv6Message, WithEchoRequest},
|
||||
IcmpSocket, IcmpSocket4, IcmpSocket6, Icmpv4Packet, Icmpv6Packet,
|
||||
};
|
||||
use metrics::{counter, gauge, histogram};
|
||||
use nursery::{thread, Nursery};
|
||||
use prometheus::{CounterVec, GaugeVec};
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
|
||||
gflags::define! {
|
||||
@ -62,17 +62,23 @@ fn resolve_host_address(host: &str) -> String {
|
||||
|
||||
struct State<AddrType> {
|
||||
destinations: HashMap<u16, (String, AddrType)>, // domain, address
|
||||
// TODO(jwall): This should be a time tracker by both identifier and sequence
|
||||
time_tracker: BTreeMap<u16, BTreeMap<u16, Instant>>,
|
||||
destination_counter: BTreeMap<u16, u16>,
|
||||
latency_guage: GaugeVec,
|
||||
ping_counter: CounterVec,
|
||||
// TODO(jwall): Add histogram for latency as well.
|
||||
}
|
||||
|
||||
fn make_ping_count_labels(domain_name: &str, result: &str) -> [(&'static str, String); 2] {
|
||||
[
|
||||
("domain", domain_name.to_owned()),
|
||||
("result", result.to_owned()),
|
||||
]
|
||||
}
|
||||
|
||||
impl<AddrType: std::fmt::Display> State<AddrType> {
|
||||
fn handle_echo_reply(&mut self, identifier: u16, sequence: u16) -> bool {
|
||||
if let Some((domain_name, dest)) = self.destinations.get(&identifier) {
|
||||
let time_tracker = self.time_tracker.get_mut(&identifier);
|
||||
let mut result = false;
|
||||
if let Some(Some(send_time)) = time_tracker.as_ref().map(|m| m.get(&sequence)) {
|
||||
let elapsed = Instant::now().sub(send_time.clone()).as_micros() as f64 / 1000.00;
|
||||
// We make a copy here to avoid the borrow above sticking around for too long.
|
||||
@ -83,18 +89,18 @@ impl<AddrType: std::fmt::Display> State<AddrType> {
|
||||
seq = sequence,
|
||||
"Reply",
|
||||
);
|
||||
self.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "ok", "domain" => domain_name})
|
||||
.inc();
|
||||
counter!("ping_counter", &make_ping_count_labels(domain_name, "ok")).increment(1);
|
||||
if elapsed as i32 != 0 {
|
||||
self.latency_guage
|
||||
.with(&prometheus::labels! {"domain" => domain_name.as_str()})
|
||||
.set(elapsed);
|
||||
let labels = [("domain", domain_name.to_owned())];
|
||||
let latency = gauge!("ping_latency", &labels);
|
||||
latency.increment(elapsed);
|
||||
let latency_hist = histogram!("ping_latency_hist_ms", &labels);
|
||||
latency_hist.record(elapsed);
|
||||
}
|
||||
self.time_tracker
|
||||
.get_mut(&identifier)
|
||||
.and_then(|m| m.remove(&sequence));
|
||||
return true;
|
||||
result = true;
|
||||
} else {
|
||||
error!(sequence, "Discarding unexpected sequence",);
|
||||
};
|
||||
@ -113,9 +119,11 @@ impl<AddrType: std::fmt::Display> State<AddrType> {
|
||||
seq = sequence,
|
||||
"Dropped"
|
||||
);
|
||||
self.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "timeout", "domain" => domain_name})
|
||||
.inc();
|
||||
counter!(
|
||||
"ping_counter",
|
||||
&make_ping_count_labels(domain_name, "dropped")
|
||||
)
|
||||
.increment(1);
|
||||
for_delete.push(*k);
|
||||
}
|
||||
}
|
||||
@ -127,6 +135,7 @@ impl<AddrType: std::fmt::Display> State<AddrType> {
|
||||
.get_mut(&identifier)
|
||||
.and_then(|m| m.remove(&k));
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
warn!(identifier, "Discarding wrong identifier");
|
||||
}
|
||||
@ -173,9 +182,11 @@ impl<'a> PacketHandler<Icmpv6Packet, Ipv6Addr> for &'a mut State<Ipv6Addr> {
|
||||
},
|
||||
}) => {
|
||||
if let Some((domain_name, _addr)) = self.destinations.get(&identifier) {
|
||||
self.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "unreachable", "domain" => domain_name})
|
||||
.inc();
|
||||
counter!(
|
||||
"ping_counter",
|
||||
&make_ping_count_labels(domain_name, "unreachable")
|
||||
)
|
||||
.increment(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -199,17 +210,12 @@ impl<'a> PacketHandler<Icmpv6Packet, Ipv6Addr> for &'a mut State<Ipv6Addr> {
|
||||
checksum: _,
|
||||
message:
|
||||
Icmpv6Message::EchoRequest {
|
||||
identifier,
|
||||
identifier: _,
|
||||
sequence: _,
|
||||
payload: _,
|
||||
},
|
||||
}) => {
|
||||
if let Some((domain_name, _addr)) = self.destinations.get(&identifier) {
|
||||
self.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "parameter_problem", "domain" => domain_name})
|
||||
.inc();
|
||||
return true;
|
||||
}
|
||||
// TODO log but otherwise ignore this.
|
||||
}
|
||||
Err(e) => {
|
||||
// We ignore these as well but log it.
|
||||
@ -290,10 +296,7 @@ where
|
||||
);
|
||||
match self.send_to_destination(dest, identifier, sequence) {
|
||||
Err(e) => {
|
||||
state
|
||||
.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "err", "type" => "send"})
|
||||
.inc();
|
||||
counter!("ping_counter", &make_ping_count_labels(domain_name, "err")).increment(1);
|
||||
error!(
|
||||
domain=domain_name, %dest, err=?e,
|
||||
"Error sending. Trying again later",
|
||||
@ -386,11 +389,8 @@ where
|
||||
}
|
||||
Err(e) => {
|
||||
error!(err = ?e, "Error receiving packet");
|
||||
handler
|
||||
.get_mut_state()
|
||||
.ping_counter
|
||||
.with(&prometheus::labels! {"result" => "err", "domain" => "unknown"})
|
||||
.inc();
|
||||
counter!("ping_counter", &make_ping_count_labels("unknown", "err"))
|
||||
.increment(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -426,12 +426,7 @@ impl Multi {
|
||||
}
|
||||
|
||||
#[instrument(name = "ICMP", skip_all)]
|
||||
pub fn schedule_echo_server(
|
||||
domain_names: &Vec<&str>,
|
||||
ping_latency_guage: GaugeVec,
|
||||
ping_counter: CounterVec,
|
||||
parent: &mut Nursery,
|
||||
) {
|
||||
pub fn schedule_echo_server(domain_names: &Vec<&str>, parent: &mut Nursery) {
|
||||
let resolved: Vec<(String, IpAddr)> = domain_names
|
||||
.iter()
|
||||
.map(|domain_name| {
|
||||
@ -470,8 +465,6 @@ pub fn schedule_echo_server(
|
||||
destinations: v4_destinations,
|
||||
time_tracker: BTreeMap::new(),
|
||||
destination_counter: BTreeMap::new(),
|
||||
latency_guage: ping_latency_guage.clone(),
|
||||
ping_counter: ping_counter.clone(),
|
||||
};
|
||||
let mut v6_destinations = HashMap::new();
|
||||
let mut v6_id_counter = 42;
|
||||
@ -491,8 +484,6 @@ pub fn schedule_echo_server(
|
||||
destinations: v6_destinations,
|
||||
time_tracker: BTreeMap::new(),
|
||||
destination_counter: BTreeMap::new(),
|
||||
latency_guage: ping_latency_guage,
|
||||
ping_counter,
|
||||
};
|
||||
let v6_pinger = PingerImpl {
|
||||
sock: IcmpSocket6::new().expect("Failed to open Icmpv6 Socket"),
|
||||
|
76
src/main.rs
76
src/main.rs
@ -15,10 +15,9 @@ use std::convert::Into;
|
||||
use std::sync::Arc;
|
||||
|
||||
use gflags;
|
||||
use metrics_exporter_prometheus;
|
||||
use nursery::thread;
|
||||
use nursery::{Nursery, Waitable};
|
||||
use prometheus::{self, GaugeVec};
|
||||
use prometheus::{CounterVec, Encoder, IntGaugeVec, Opts, Registry, TextEncoder};
|
||||
use tiny_http;
|
||||
use tracing::{debug, error, info, instrument, Level};
|
||||
use tracing_subscriber::FmtSubscriber;
|
||||
@ -93,49 +92,11 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
let ping_hosts: Vec<&str> = PINGHOSTS.flag.split(",").collect();
|
||||
|
||||
let builder = metrics_exporter_prometheus::PrometheusBuilder::new();
|
||||
let prom_handle = builder
|
||||
.install_recorder()
|
||||
.expect("Failed to install prometheus exporter");
|
||||
// Create a Registry and register metrics.
|
||||
let r = Registry::new();
|
||||
let stun_counter_vec = CounterVec::new(
|
||||
Opts::new(
|
||||
"stun_attempt_counter",
|
||||
"Counter for the good, bad, and total attempts to connect to stun server.",
|
||||
),
|
||||
&["result", "domain"],
|
||||
)
|
||||
.unwrap();
|
||||
let stun_success_vec = IntGaugeVec::new(
|
||||
Opts::new("stun_success", "Stun probe successes"),
|
||||
&["domain"],
|
||||
)
|
||||
.unwrap();
|
||||
let stun_latency_vec = IntGaugeVec::new(
|
||||
Opts::new(
|
||||
"stun_attempt_latency_ms",
|
||||
"Latency guage in millis per stun domain.",
|
||||
),
|
||||
&["domain"],
|
||||
)
|
||||
.unwrap();
|
||||
let ping_latency_vec = GaugeVec::new(
|
||||
Opts::new("ping_latency", "ICMP Ping latency in milliseconds"),
|
||||
&["domain"],
|
||||
)
|
||||
.unwrap();
|
||||
let ping_counter_vec = CounterVec::new(
|
||||
Opts::new("ping_counter", "Ping Request Counter"),
|
||||
&["result", "domain"],
|
||||
)
|
||||
.unwrap();
|
||||
r.register(Box::new(stun_counter_vec.clone()))
|
||||
.expect("Failed to register stun connection counter");
|
||||
r.register(Box::new(stun_latency_vec.clone()))
|
||||
.expect("Failed to register stun latency guage");
|
||||
r.register(Box::new(stun_success_vec.clone()))
|
||||
.expect("Failed to register stun success gauge");
|
||||
r.register(Box::new(ping_latency_vec.clone()))
|
||||
.expect("Failed to register ping latency guage");
|
||||
r.register(Box::new(ping_counter_vec.clone()))
|
||||
.expect("Failed to register ping counter");
|
||||
let stun_socket_addrs = util::resolve_socket_addrs(&stun_servers).unwrap();
|
||||
let stun_servers = Arc::new(stun_servers);
|
||||
let ping_hosts = Arc::new(ping_hosts);
|
||||
@ -165,13 +126,8 @@ fn main() -> anyhow::Result<()> {
|
||||
info!("Waiting for request");
|
||||
match server.recv() {
|
||||
Ok(req) => {
|
||||
let mut buffer = vec![];
|
||||
// Gather the metrics.
|
||||
let encoder = TextEncoder::new();
|
||||
let metric_families = r.gather();
|
||||
encoder.encode(&metric_families, &mut buffer).unwrap();
|
||||
|
||||
let response = tiny_http::Response::from_data(buffer).with_status_code(200);
|
||||
let response = tiny_http::Response::from_data(prom_handle.render())
|
||||
.with_status_code(200);
|
||||
if let Err(e) = req.respond(response) {
|
||||
error!(err = ?e, "Error responding to request");
|
||||
}
|
||||
@ -185,27 +141,15 @@ fn main() -> anyhow::Result<()> {
|
||||
parent.adopt(Box::new(render_thread));
|
||||
}
|
||||
{
|
||||
let ping_latency_vec = ping_latency_vec.clone();
|
||||
let ping_counter_vec = ping_counter_vec.clone();
|
||||
icmp::schedule_echo_server(&ping_hosts, ping_latency_vec, ping_counter_vec, &mut parent);
|
||||
icmp::schedule_echo_server(&ping_hosts, &mut parent);
|
||||
}
|
||||
// Then we attempt to start connections to each stun server.
|
||||
for (i, s) in stun_socket_addrs.iter().enumerate() {
|
||||
let stun_servers_copy = stun_servers.clone();
|
||||
let stun_counter_vec_copy = stun_counter_vec.clone();
|
||||
let stun_latency_vec_copy = stun_latency_vec.clone();
|
||||
let stun_success_vec_copy = stun_success_vec.clone();
|
||||
if let Some(s) = s.clone() {
|
||||
let domain_name = *stun_servers_copy.get(i).unwrap();
|
||||
let connect_thread = thread::Pending::new(move || {
|
||||
stun::start_listen_thread(
|
||||
domain_name,
|
||||
s.into(),
|
||||
stun_counter_vec_copy,
|
||||
stun_latency_vec_copy,
|
||||
stun_success_vec_copy,
|
||||
)
|
||||
});
|
||||
let connect_thread =
|
||||
thread::Pending::new(move || stun::start_listen_thread(domain_name, s.into()));
|
||||
parent.schedule(Box::new(connect_thread));
|
||||
// Spread the probe threads out so they're somewhat uniformly distributed.
|
||||
std::thread::sleep(std::time::Duration::from_micros(
|
||||
|
75
src/stun.rs
75
src/stun.rs
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use gflags;
|
||||
use prometheus::{CounterVec, IntGaugeVec};
|
||||
use metrics::{counter, gauge};
|
||||
use std::convert::From;
|
||||
use std::io;
|
||||
use std::net::{SocketAddr, UdpSocket};
|
||||
@ -70,18 +70,21 @@ fn attempt_stun_connect(addr: SocketAddr) -> Result<SystemTime, ConnectError> {
|
||||
Ok(SystemTime::now())
|
||||
}
|
||||
|
||||
fn make_count_labels(domain_name: &str, result: &str) -> [(&'static str, String); 2] {
|
||||
[
|
||||
("domain", domain_name.to_owned()),
|
||||
("result", result.to_owned()),
|
||||
]
|
||||
}
|
||||
|
||||
#[instrument(
|
||||
name = "STUN",
|
||||
fields(domain=domain_name, socket=%s),
|
||||
skip(stun_counter_vec_copy, stun_latency_vec_copy, stun_success_vec_copy)
|
||||
)]
|
||||
pub fn start_listen_thread(
|
||||
domain_name: &str,
|
||||
s: SocketAddr,
|
||||
stun_counter_vec_copy: CounterVec,
|
||||
stun_latency_vec_copy: IntGaugeVec,
|
||||
stun_success_vec_copy: IntGaugeVec,
|
||||
) {
|
||||
pub fn start_listen_thread(domain_name: &str, s: SocketAddr) {
|
||||
let labels: [(&str, String); 1] = [("domain", domain_name.to_owned())];
|
||||
let success = gauge!("stun_success", &labels);
|
||||
|
||||
debug!("starting thread");
|
||||
loop {
|
||||
let now = SystemTime::now();
|
||||
@ -94,16 +97,14 @@ pub fn start_listen_thread(
|
||||
millis = finish_time.duration_since(now).unwrap().as_millis(),
|
||||
conn_type = "Stun connection",
|
||||
);
|
||||
stun_counter_vec_copy
|
||||
.with(&prometheus::labels! {"result" => "ok", "domain" => domain_name})
|
||||
.inc();
|
||||
stun_latency_vec_copy
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
// Technically this could be lossy but we'll chance it anyway.
|
||||
.set(finish_time.duration_since(now).unwrap().as_millis() as i64);
|
||||
stun_success_vec_copy
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
.set(1);
|
||||
counter!(
|
||||
"stun_attempt_counter",
|
||||
&make_count_labels(domain_name, "ok")
|
||||
)
|
||||
.increment(1);
|
||||
gauge!("stun_attempt_latency_ms", &labels)
|
||||
.increment(finish_time.duration_since(now).unwrap().as_millis() as f64);
|
||||
success.set(1);
|
||||
}
|
||||
Err(ConnectError::Timeout(finish_time)) => {
|
||||
info!(
|
||||
@ -112,24 +113,24 @@ pub fn start_listen_thread(
|
||||
millis = finish_time.duration_since(now).unwrap().as_millis(),
|
||||
conn_type = "Stun connection",
|
||||
);
|
||||
stun_counter_vec_copy
|
||||
.with(&prometheus::labels! {"result" => "timeout", "domain" => domain_name})
|
||||
.inc();
|
||||
stun_success_vec_copy
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
.set(0);
|
||||
counter!(
|
||||
"stun_attempt_counter",
|
||||
&make_count_labels(domain_name, "timeout")
|
||||
)
|
||||
.increment(1);
|
||||
success.set(0);
|
||||
}
|
||||
Err(ConnectError::Err(e)) => {
|
||||
error!(
|
||||
timeout=true, success=false, err = ?e,
|
||||
conn_type="Stun connection",
|
||||
);
|
||||
stun_counter_vec_copy
|
||||
.with(&prometheus::labels! {"result" => "err", "domain" => domain_name})
|
||||
.inc();
|
||||
stun_success_vec_copy
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
.set(0);
|
||||
counter!(
|
||||
"stun_attempt_counter",
|
||||
&make_count_labels(domain_name, "err")
|
||||
)
|
||||
.increment(1);
|
||||
success.set(0);
|
||||
}
|
||||
Err(ConnectError::Incomplete) => {
|
||||
error!(
|
||||
@ -138,12 +139,12 @@ pub fn start_listen_thread(
|
||||
err = "Incomplete",
|
||||
conn_type = "Stun connection",
|
||||
);
|
||||
stun_counter_vec_copy
|
||||
.with(&prometheus::labels! {"result" => "incomplete", "domain" => domain_name})
|
||||
.inc();
|
||||
stun_success_vec_copy
|
||||
.with(&prometheus::labels! {"domain" => domain_name})
|
||||
.set(0);
|
||||
counter!(
|
||||
"stun_attempt_counter",
|
||||
&make_count_labels(domain_name, "incomplete")
|
||||
)
|
||||
.increment(1);
|
||||
success.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user